Skip to content

Commit 3f30b20

Browse files
committed
improvement(mothership): own Sim's telemetry names, map the goRoute recovery key in one place, and simplify the stream contract types
- Move the trace span, attribute, attribute-value, event and metric name tables out of generated/ into lib/mothership/observability/ as Sim-owned code; the worker no longer syncs them. CODEOWNERS keeps them with the mothership team. - StreamRecoveryConfigSchema reads the persisted goRoute key as workerRoute, and persistedStreamRecoveryConfig writes it back as goRoute, so no caller names the stored key. - Derive SyntheticFilePreviewEventEnvelope and EnvelopeToStreamEvent from MothershipStreamV1Envelope, drop a duplicate doc comment, and replace a nested ternary in applyStreamEvent with plain branches.
1 parent f018122 commit 3f30b20

66 files changed

Lines changed: 665 additions & 640 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/CODEOWNERS‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
/apps/sim/lib/mothership/async-runs/ @simstudioai/mothership
1212
/apps/sim/lib/mothership/request/ @simstudioai/mothership
1313
/apps/sim/lib/mothership/generated/ @simstudioai/mothership
14+
/apps/sim/lib/mothership/observability/ @simstudioai/mothership
1415
/apps/sim/lib/mothership/constants.ts @simstudioai/mothership
1516
/apps/sim/lib/core/utils/sse.ts @simstudioai/mothership
1617

‎apps/sim/app/api/billing/update-cost/route.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ import { generateRequestId } from '@/lib/core/utils/request'
4747
import { withRouteHandler } from '@/lib/core/utils/with-route-handler'
4848
import { BillingInFlightCode } from '@/lib/mothership/generated/billing'
4949
import { BILLING_CALLBACK_OUTCOME } from '@/lib/mothership/generated/billing-protocol-v1'
50-
import { BillingRouteOutcome } from '@/lib/mothership/generated/trace-attribute-values-v1'
51-
import { TraceAttr } from '@/lib/mothership/generated/trace-attributes-v1'
52-
import { TraceSpan } from '@/lib/mothership/generated/trace-spans-v1'
5350
import { recordJobRunSpend } from '@/lib/mothership/jobs/budget'
51+
import { BillingRouteOutcome } from '@/lib/mothership/observability/trace-attribute-values'
52+
import { TraceAttr } from '@/lib/mothership/observability/trace-attributes'
53+
import { TraceSpan } from '@/lib/mothership/observability/trace-spans'
5454
import { checkInternalApiKey } from '@/lib/mothership/request/http'
5555
import { withIncomingWorkerSpan } from '@/lib/mothership/request/otel'
5656

‎apps/sim/app/api/copilot/api-keys/validate/route.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ import {
5858
COPILOT_VALIDATION_PURPOSE,
5959
type CopilotBillingProtocol,
6060
} from '@/lib/mothership/generated/billing-protocol-v1'
61-
import { CopilotValidateOutcome } from '@/lib/mothership/generated/trace-attribute-values-v1'
62-
import { TraceAttr } from '@/lib/mothership/generated/trace-attributes-v1'
63-
import { TraceSpan } from '@/lib/mothership/generated/trace-spans-v1'
61+
import { CopilotValidateOutcome } from '@/lib/mothership/observability/trace-attribute-values'
62+
import { TraceAttr } from '@/lib/mothership/observability/trace-attributes'
63+
import { TraceSpan } from '@/lib/mothership/observability/trace-spans'
6464
import { checkInternalApiKey } from '@/lib/mothership/request/http'
6565
import { withIncomingWorkerSpan } from '@/lib/mothership/request/otel'
6666

‎apps/sim/app/api/copilot/chat/steer/route.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
internalRateLimits,
88
internalSessionAuth,
99
} from '@/lib/api/server/routes'
10-
import { TraceSpan } from '@/lib/mothership/generated/trace-spans-v1'
10+
import { TraceSpan } from '@/lib/mothership/observability/trace-spans'
1111
import {
1212
runControlOperations,
1313
SteeringNotQueuedError,

‎apps/sim/app/api/copilot/confirm/route.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ import {
2323
getClaimedWorkflowExecutionId,
2424
getRunSegment,
2525
} from '@/lib/mothership/async-runs/repository'
26-
import { CopilotConfirmOutcome } from '@/lib/mothership/generated/trace-attribute-values-v1'
27-
import { TraceAttr } from '@/lib/mothership/generated/trace-attributes-v1'
28-
import { TraceSpan } from '@/lib/mothership/generated/trace-spans-v1'
26+
import { CopilotConfirmOutcome } from '@/lib/mothership/observability/trace-attribute-values'
27+
import { TraceAttr } from '@/lib/mothership/observability/trace-attributes'
28+
import { TraceSpan } from '@/lib/mothership/observability/trace-spans'
2929
import {
3030
authenticateCopilotRequestSessionOnly,
3131
createInternalServerErrorResponse,

‎apps/sim/app/api/copilot/tool-permission/route.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import {
1111
getRunSegment,
1212
recordToolPermissionDecision,
1313
} from '@/lib/mothership/async-runs/repository'
14-
import { TraceAttr } from '@/lib/mothership/generated/trace-attributes-v1'
15-
import { TraceSpan } from '@/lib/mothership/generated/trace-spans-v1'
14+
import { TraceAttr } from '@/lib/mothership/observability/trace-attributes'
15+
import { TraceSpan } from '@/lib/mothership/observability/trace-spans'
1616
import {
1717
publishToolPermissionDecision,
1818
TOOL_PERMISSION_DECISION,

‎apps/sim/app/api/copilot/tools/execute/route.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import { getRunSecretAuthority } from '@/lib/mothership/async-runs/repository'
99
import { toolResultForModel } from '@/lib/mothership/chat/sim-key-redaction'
1010
import { prepareCopilotEnvironmentContext } from '@/lib/mothership/environment-context'
1111
import { MothershipStreamV1ToolOutcome } from '@/lib/mothership/generated/mothership-stream-v1'
12-
import { TraceAttr } from '@/lib/mothership/generated/trace-attributes-v1'
13-
import { TraceSpan } from '@/lib/mothership/generated/trace-spans-v1'
12+
import { TraceAttr } from '@/lib/mothership/observability/trace-attributes'
13+
import { TraceSpan } from '@/lib/mothership/observability/trace-spans'
1414
import { checkInternalApiKey } from '@/lib/mothership/request/http'
1515
import { withIncomingWorkerSpan } from '@/lib/mothership/request/otel'
1616
import {

‎apps/sim/app/api/mothership/chat/stream/route.test.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import {
88
MothershipStreamV1CompletionStatus,
99
MothershipStreamV1EventType,
1010
} from '@/lib/mothership/generated/mothership-stream-v1'
11-
import { CopilotResumeOutcome } from '@/lib/mothership/generated/trace-attribute-values-v1'
12-
import { TraceAttr } from '@/lib/mothership/generated/trace-attributes-v1'
13-
import { TraceSpan } from '@/lib/mothership/generated/trace-spans-v1'
11+
import { CopilotResumeOutcome } from '@/lib/mothership/observability/trace-attribute-values'
12+
import { TraceAttr } from '@/lib/mothership/observability/trace-attributes'
13+
import { TraceSpan } from '@/lib/mothership/observability/trace-spans'
1414

1515
const { getLatestRunForStream, readEvents, readFilePreviewSessions, findReplayGap } = vi.hoisted(
1616
() => ({

‎apps/sim/app/api/telemetry/route.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { isProd } from '@/lib/core/config/env-flags'
88
import { enforceIpRateLimit } from '@/lib/core/rate-limiter'
99
import { withRouteHandler } from '@/lib/core/utils/with-route-handler'
1010
import { isTelemetryDisabled, normalizeOtlpTracesUrl } from '@/lib/monitoring/otlp'
11-
import { TraceAttr } from '@/lib/mothership/generated/trace-attributes-v1'
11+
import { TraceAttr } from '@/lib/mothership/observability/trace-attributes'
1212
import telemetryConfig from '@/telemetry.config'
1313

1414
const logger = createLogger('TelemetryAPI')

‎apps/sim/app/api/workflows/[id]/execute/route.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ import {
9898
settleClientWorkflowToolExecution,
9999
} from '@/lib/mothership/async-runs/repository'
100100
import { COPILOT_WORKFLOW_EXECUTION_CONFLICT_CODE } from '@/lib/mothership/constants'
101-
import { CopilotDegradedReason } from '@/lib/mothership/generated/trace-attribute-values-v1'
101+
import { CopilotDegradedReason } from '@/lib/mothership/observability/trace-attribute-values'
102102
import { recordDegraded } from '@/lib/mothership/request/metrics'
103103
import {
104104
reportQueuedClientWorkflowTool,

0 commit comments

Comments
 (0)