Skip to content

chore(mothership): take the worker's typed stream contract, own telemetry names in Sim, and rename go-era names to worker - #10273

Merged
waleedlatif1 merged 9 commits into
stagingfrom
chore/post-go-cleanup
Nov 21, 2026
Merged

waleedlatif1 merged 9 commits into
stagingfrom
chore/post-go-cleanup

Conversation

@waleedlatif1

@waleedlatif1 waleedlatif1 commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Takes the worker's stream contract, which is now the single wire source (mothership D117). The worker emitter is type-checked against mothership-stream-v1, so drift is a compile error
  • request/session/contract.ts types every reader from the one v1 envelope; its per-type intersections and resource override are gone
  • Deletes reader code for vocabulary the worker never emits: span structured_result/subagent_result, run resumed, checkpoint_pause.frames and the per-subagent resume fan-out it fed, compaction_done.data, session/trace, steering content/messageId/mode, and goTraceId. error.error/error.data and session chat/title stay, because Sim emits them itself
  • Telemetry names (trace spans, attributes, values, events, metrics) become Sim-owned code in lib/mothership/observability/ (mothership D118). Dead names are pruned, and the raw literals Sim emits now use the constants
  • Go-era names become worker: request/go/ → request/worker/, fetchGo → fetchWorker, withIncomingGoSpan → withIncomingWorkerSpan, the testing mocks, and the sim → worker … span names
  • The persisted recovery key stays goRoute, so older Sim builds keep reading new rows during a rolling deploy or rollback. recovery-config.ts is the only place that maps it to workerRoute
  • Removes the write-only TraceCollector, the dead _serviceCost output (hosted-key spend is metered by recordServiceCost), the Go-only replay.live.test.ts, and stale CODEOWNERS paths

Companion: simstudioai/mothership#997

Type of Change

  • Other: cleanup and contract consolidation

Testing

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
docs Ready Ready Preview Nov 21, 2026 9:32am UTC

Request Review

@github-actions github-actions Bot added the requires-mothership-merge Has a companion PR on the mothership/copilot side — merge in lockstep label Nov 21, 2026
@github-actions

Copy link
Copy Markdown

⚠️ Cross-repo companion check

One or more companion PRs aren't merged into staging yet. Merging this without them will leave copilot and sim out of sync — merge them in lockstep.

  • ❌ simstudioai/mothership#997 — OPEN, not merged (targets staging) — improvement(worker): type the stream against mothership-stream-v1, hand telemetr

@greptile-apps

greptile-apps Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable new defects were established.

Summary

Consolidates stream readers around the worker’s typed envelope and moves telemetry names into Sim-owned files.

  • Sim reads the worker’s v1 stream shapes and drops event types it does not emit.
  • Checkpoint resumes use one bundled continuation, and recovery records keep the old route key.
  • Sim’s telemetry names live in Sim-owned catalogs, while unused trace and metric output is removed.
  • Worker names replace Go-era names across request code, mocks, and trace spans.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Worker[Worker stream] --> Contract[Shared typed envelope]
  Contract --> Server[Sim stream handlers]
  Contract --> Browser[Browser turn model]
  Admission[Turn admission] --> Writer[Recovery writer]
  Writer --> Stored[Stored goRoute]
  Stored --> Reader[Recovery reader]
  Reader --> Route[In-memory workerRoute]
  Route --> Resume[Resume worker request]
Loading

Reviews (4) · Last reviewed commit: "chore(mothership): sync the worker's con..." · Reviewed by Greptile

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 194 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread apps/sim/tools/index.ts Resolved
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 194 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 200 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

…y contracts, and rename go-era names to worker
…ite-only trace collector and dead _serviceCost output

Recovery rows keep the goRoute key every deployed Sim parses, so a rollback or
mixed-version deploy still takes over in-flight runs; workerRoute is the in-memory
name only. Also removes TraceCollector and its span plumbing (nothing read it),
the _serviceCost tool output no reader consumes, Go-era span data fallbacks
(pending, tool_call_id), the Go-only billing replay live test, and takes the
worker contract's removal of the async tool status by owning it in async-runs.
…ecovery 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.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 200 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit 534c8ba into staging Nov 21, 2026
170 of 173 checks passed
@waleedlatif1
waleedlatif1 deleted the chore/post-go-cleanup branch November 23, 2026 00:04

This branch was successfully deployed

1 active deployment
Preview — 375a0dc9 Deployed Nov 21, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

requires-mothership-merge Has a companion PR on the mothership/copilot side — merge in lockstep

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant