Skip to content

improvement(mothership): use the synced replay-end frame contract - #10352

Merged
waleedlatif1 merged 1 commit into
stagingfrom
improvement/mship-contract-sync
Nov 23, 2026
Merged

waleedlatif1 merged 1 commit into
stagingfrom
improvement/mship-contract-sync

Conversation

@waleedlatif1

@waleedlatif1 waleedlatif1 commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Syncs the worker contracts:
    • model-router candidate ids now start and end with a letter or digit and are never trimmed;
    • the replay-end frame's payload, kind, reasons and envelope live in mothership-stream-v1 as MothershipStreamV1ReplayEnd*, replacing protocol's StreamReplayEnd.
  • run-replay.ts validates the replay-end frame against the synced kind and reason constants instead of a hand-kept copy, and logs a malformed frame with its zod issue paths. Behaviour is unchanged: an unknown reason or missing length still ends the read as closed
  • The frame stays outside the live run kinds. A contract test pins that the live parser rejects it
  • A model-router test runs the request body Sim builds through the synced ModelRouterRequest, so a tier id the worker would refuse fails in Sim's tests first. Sim's ids (1, 2, 3) pass the stricter rule

Type of Change

  • Improvement

Testing

  • Generated copies are byte-identical to the worker sources (check:contract-sync with this branch as SIM_REPO_PATH)
  • tsc --noEmit and bun run lint clean; vitest for lib/mothership/request/session and lib/model-router pass; test-pattern and test-type audits pass

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)

Companion: simstudioai/mothership#1006

@vercel

vercel Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Nov 23, 2026 8:17pm 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 23, 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#1006 — OPEN, not merged (targets staging) — improvement(worker): tighten router candidate ids and share the replay-end frame

@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 6 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

@greptile-apps

greptile-apps Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

Syncs the worker contracts and uses their replay-end constants in the replay reader.

  • Model-router candidate IDs keep their text and follow the worker’s allowed format.
  • The replay reader uses the shared stream contract for replay-end frames.

Reviews (2) · Last reviewed commit: "improvement(mothership): use the synced ..." · Reviewed by Greptile

Sync the worker contracts: model-router candidate ids now start and end
with a letter or digit and are not trimmed, and the replay-end frame's
payload, kind, reasons and envelope live in mothership-stream-v1 as
MothershipStreamV1ReplayEnd* instead of protocol's StreamReplayEnd.

The run replay reader validates the frame against the synced kind and
reason constants instead of a hand-kept copy, and logs a malformed frame
with its zod issue paths. The frame stays outside the live run kinds; a
contract test pins that the live parser rejects it. A model-router test
runs the request body Sim builds through the synced ModelRouterRequest,
so a tier id the worker would reject fails here first.
@waleedlatif1
waleedlatif1 force-pushed the improvement/mship-contract-sync branch from 557daf8 to debce56 Compare November 23, 2026 20:17
@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 23, 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 6 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 5a3d6d1 into staging Nov 23, 2026
84 checks passed
@waleedlatif1
waleedlatif1 deleted the improvement/mship-contract-sync branch November 23, 2026 20:30

This branch was previously deployed

1 inactive deployment
Preview — debce567 Deployed Nov 23, 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