Skip to content

fork seams: move orchestratorMcp.ts and OrchestratorMcpService.ts to seams, announce the #817 lines (step 1) - #965

Merged
scuttletoby merged 2 commits into
mainfrom
fork/817-seam-list
Nov 22, 2026
Merged

scuttletoby merged 2 commits into
mainfrom
fork/817-seam-list

Conversation

@scuttletoby

Copy link
Copy Markdown
Owner

Problem

#817 (design in #808, row 1 follow-up) adds lines to two upstream files: packages/contracts/src/orchestratorMcp.ts and apps/server/src/mcp/OrchestratorMcpService.ts. Both are pending in .github/fork-seams.json, and a pending file takes no new fork line. So per docs/fork/updates.md ("Adding a seam line", and the pending-to-seam move under "What guards it") they first become seam entries and the new lines get announced, in a list-only pull request. Then the #817 change goes in.

Change

This changes only .github/fork-seams.json. Neither file's text changes.

  1. Move both files from pending to files. The new entries list exactly the fork lines each file has today, counted from upstream: 8 in the contract (usage pacing's usagePacingNote and the usage_pacing_hold / slots_full codes) and 35 in the service (the DelegateChecks seats). Those were the two ceilings. The service's lost entry ({"lines": 5, "gone": 5}) stays as it is. With seam entries, fork-follow holds each line to its entry, not just to a count.
  2. Announce the lines Contract fields for a linked child's secret requests and 'unknown'; a secret ends a wait (seam PR, #808) #817 adds (since 2026-11-22; please refresh it if this merges on a later day). There are three lines in all: two in the contract and one in the service.

packages/contracts/src/orchestratorMcp.ts. The import goes among the imports, and the spread goes in OrchestratorMcpDelegateTaskResult after next:

import * as ForkOrchestratorMcp from "./forkOrchestratorMcp.ts"; // Fork: its result fields
...ForkOrchestratorMcp.ForkDelegateTaskResultFields,

apps/server/src/mcp/OrchestratorMcpService.ts, as the first operand in upstream's endsTaskWait:

DelegateChecks.promptEndsWait(result) || // Fork: a secret request ends a wait (#817)

Why each line is needed, and why no existing fork hook can carry it

  • Contract spread (...ForkOrchestratorMcp.ForkDelegateTaskResultFields,). Contract fields for a linked child's secret requests and 'unknown'; a secret ends a wait (seam PR, #808) #817 adds two optional fields to OrchestratorMcpDelegateTaskResult: pendingSecretRequests (itemId, label, reason, never a value) and an "unknown" marker (promptsKnown: false). A field reaches the wire only when it is in this Schema.Struct. The delegate/wait/status tools in toolkits/orchestrator/tools.ts encode with this schema, and the service builds results with satisfies against its type. Today the file has no fork hook into this struct. Its only fork lines are the inline usagePacingNote field and two error codes, and neither one can carry new fields. A single spread of fork-owned fields keeps the definitions, caps and patterns in the fork's own file (forkOrchestratorMcp.ts, which matches the fork* naming the check already takes as the fork's). It also means later fork fields on this result need no new line here. This is the same pattern settings.ts uses with ...ForkSettings.*Fields.
  • Contract import. The spread needs its module. orchestratorMcp.ts imports no fork module today, so there is no existing import to reuse. Writing the two fields inline would avoid the import, but it would put the nested schemas and their annotations into upstream's file as several more fork lines, and the formatter wraps them over many lines.
  • Service seat in endsTaskWait. endsTaskWait decides when a blocking delegate_task / task_status wait returns. It is used for the first read in waitForTask, as the stream filter that ends the wait, and in readTask's choice of next. It is a module-level pure function that only ends on hasPendingQuestion, pendingApproval or a terminal status, so a pending secret request can never end a wait (the gap Contract fields for a linked child's secret requests and 'unknown'; a secret ends a wait (seam PR, #808) #817 names). The existing fork seat delegateChecks.remotePrompts(task, status) only shapes the result. It cannot change this decision unless it sets hasPendingQuestion or pendingApproval for a secret. That would misreport it as a question or approval the agent is invited to answer, and Seamless fleet: every prompt from any machine (questions, approvals, secrets, sign-ins) shows up in the thread the owner reads #808 says secrets are never answered by an agent. The delegateChecks instance from make is also not in scope at module level. The seat uses the module's existing import * as DelegateChecks (already a seam line), so the service needs no new import: one line in total.

Nothing else in this PR. The #817 change itself (the fork fields file, promptEndsWait, remotePrompts filling the fields, the watcher waking a live wait on a secret, and failing-first tests) is step 2. In that PR the three lines move from announced to added.

Verification

  • node .github/scripts/fork-seam-check.cjs --config-ref origin/main origin/main HEAD passes. It notes that both moved entries "list exactly the fork lines counted from upstream" (it fetched upstream read-only to count them).
  • node .github/scripts/fork-seam-check.cjs --from-upstream <merge-base of main and upstream> HEAD passes ("only the pinned seams", list from the head).
  • node --test .github/scripts/fork-seam-check.test.cjs: 117 pass, 0 fail.
  • vp run check:changed: format, typecheck (43 packages) and the one test it picked all pass.
  • Dry run of step 2: a throwaway commit on top of this branch added the three announced lines exactly as written, plus a stub forkOrchestratorMcp.ts and a stub promptEndsWait, all formatted with vp fmt. Judged with this branch's list as config, it passes ("only the pinned seams"). The commit was not pushed.

Part of #817: this is step 1 of 2, the seam list. Still left: the contract fields, the endsTaskWait seat and the watcher change, with tests.

🤖 Generated with Claude Code

…seams, announce the #817 lines (step 1)

Part of #817. List only: both files leave "pending" for seam entries that
list their current fork lines (8 and 35), and announce the lines #817 adds:
one spread of fork result fields plus its import in the contract, and one
call in endsTaskWait so a pending secret request ends a blocking wait.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@scuttletoby

Copy link
Copy Markdown
Owner Author

lens: code · reviewer: lens agent · read at: 60f5ac5
verdict: safe to merge
covered: the full diff (.github/fork-seams.json only); issues #817 and #808 with every comment; the PR body; packages/contracts/src/orchestratorMcp.ts and apps/server/src/mcp/OrchestratorMcpService.ts on main (endsTaskWait, waitForTask, readTask, readRemoteTask, TASK_WAKE_EVENTS); apps/server/src/fork/remoteTaskPromptWakes.ts; docs/fork/updates.md ("Adding a seam line", pending to files); the settings.ts entry as precedent
checks: (1) recounted both files from the upstream base the checker uses (dd941b9) to main: the trimmed added lines match each new added list exactly as multisets, 8 in the contract and 35 in the service. Main moved one commit past the PR's base (#960), which touches neither file nor the list. (2) The kept lost entry {"lines": 5, "gone": 5} matches main: 5 upstream lines in the service lost one copy each (target: { ...input.target, environmentId }, 1 to 0; modelSelection: target.modelSelection,, return yield* input.mode === "wait", const target = yield* resolveTargetRechecking({ 2 to 1 each; }), 41 to 40). (3) fork-seam-check.cjs --config-ref origin/main origin/main HEAD passes, with the note that both moved entries list exactly the fork lines counted from upstream. --from-upstream dd941b9c3b58 HEAD passes ("only the pinned seams"). node --test .github/scripts/fork-seam-check.test.cjs: 117 pass, 0 fail. vp fmt --check .github/fork-seams.json: clean. (4) Ran a local dry run of step 2 in my own temp worktree, then reverted it: put the three announced lines where the body says (the import after ./auth.ts, the spread after next, the operand first in endsTaskWait) and ran vp fmt on both files. The formatter keeps all three lines exactly as announced. (5) JSON: parses. Both paths are gone from pending (the rest stays sorted) and are not duplicated in files. Key order why, added, announced{since, added} matches the other announced entries. Appending at the end of files matches how entries are added today (that map is not sorted). since is 2026-11-22, the same day as main's head commit.
state: list-only, so a re-run gives the same result (no file text changes, and the counts are exact from upstream). If it stops half-way, nothing is written outside the list. Against old state: main's list judges this PR, and both moves are counted from upstream. The lost entry is still valid because its file now sits in files. The announcement expires 14 days after since (main's commit dates), so step 2 must merge before then, or since must be refreshed first. If this merges on a later day, refresh since as the body says.
blocker: none
major: none
minor: step 2 note, not for this PR: the spread ...ForkOrchestratorMcp.ForkDelegateTaskResultFields, is evaluated when the contract module loads, so forkOrchestratorMcp.ts must not import values from orchestratorMcp.ts. A cycle there would spread undefined silently. Keep it on baseSchemas-level imports, as forkSettings.ts does.
minor: step 2 note: for a linked child, the wait's stream wakes only on the parent's subagent.updated, so the secret only ends a live wait once remoteTaskPromptWakes.ts stops sending every secret as a message (its prompt.kind !== "secret" guard, line 158). That change is in a fork file and needs no further upstream line (TASK_WAKE_EVENTS stays as it is), so the 3 announced lines are complete and the smallest seam: 1 call in endsTaskWait on the existing DelegateChecks import, and 1 import plus 1 spread, the same pattern as settings.ts.

🤖 Generated with Claude Code

@scuttletoby

Copy link
Copy Markdown
Owner Author

lens: merge-path · reviewer: lens agent · read at: 60f5ac5
verdict: safe to merge
covered: the lens prompt (.github/fork-lens-merge-path.md); issues #817 and #808 with their comments; the PR body; the full diff (.github/fork-seams.json only, +66 / -2); the checker's path for a move from "pending" to "files" (.github/scripts/fork-seam-check.cjs:385-460, promotedFiles at :610, findListedNotFork at :666); docs/fork/updates.md ("What guards it", "Adding a seam line")
checks:

  • node .github/scripts/fork-seam-check.cjs --config-ref origin/main origin/main HEAD: passes. It fetched upstream read-only and notes that both moved entries list exactly the fork lines counted from upstream (merge-base dd941b9).
  • --from-upstream dd941b9c3b58 HEAD: passes ("only the pinned seams"). This run also holds the unchanged lost entry (5 / 5).
  • Counted by hand (multiset of trimmed lines, upstream merge-base vs head): the contract has 8 fork lines, equal to the 8 listed, with 0 gone. The service has 35, equal to the 35 listed (}); 3×, parent, 2× and isRetry: isRetryOfAcceptedDelegation, 2× included), with 5 gone, equal to lost.gone 5. None of the 3 announced lines is in the head or in upstream.
  • Next upstream sync: I three-way merged both files onto upstream's current main (147 commits past the merge-base; it changes both files). No conflict, and the counts are still 8 / 35 / 5 gone, with the listed lines still exactly the fork lines.
  • Step 2 dry run (a local throwaway commit, not pushed): the 3 announced lines at their stated places plus a stub fork module. Judged by this head's list it passes; judged by main's list today it is refused ("pending ... adds 1 / 2 more lines").
  • node --test .github/scripts/fork-seam-check.test.cjs: 117 pass, 0 fail. The move path has its own tests (test file :2487, :2510, :2545, :2597; an announced line the file already has, refused in a move, at :2581).
  • Smallest seam: the contract needs the spread in the Schema.Struct (the tools encode with it, and the service checks against its type with satisfies) and the spread's import (the file imports no fork module). The service needs one operand in the module-level endsTaskWait, which has 3 call sites. delegateChecks.remotePrompts only shapes the result, and to end a wait it would have to report a secret as a question or approval, which Seamless fleet: every prompt from any machine (questions, approvals, secrets, sign-ins) shows up in the thread the owner reads #808 rules out. The seat reuses the listed import * as DelegateChecks. forkOrchestratorMcp.ts matches the fork-name pattern (FORK_SEGMENT, checker :234), and upstream has no such file.
  • Moving the files out of "pending" weakens nothing I found. A pull request on a seam file gets a per-line text allowance, and here it has no spare copy (all 8 and all 35 are in use), where a pending file only had a count. The generic listed lines (});, }),, parent,, target,) keep the documented limit of counting by text: a pull request that drops upstream's copy instead of the fork's is caught only by fork-follow. A pending file has the same limit. If upstream renames a file, the old path becomes a note and the new path is an unlisted upstream file held to no fork line, so fork-follow stops (fails closed). If the merge lands on a later day, since is judged by main's commit date, and an expired announcement blocks only step 2 (fails closed).
  • This is not the first move from "pending" to a seam entry: fork seams: server.ts is a declared seam; announce the handoff owner line (#361) #582 moved apps/server/src/server.ts the same way, with lines left and an announcement.
    state: runs again: the change is list-only, and the checker gives the same answer on the same commits. Stopped half-way (step 1 merged, step 2 not): the 3 announced lines stay usable for 14 days from 2026-11-22 (by main's commit dates), then expire, and only step 2 is refused until they are announced again. Old state: main's pending ceilings 8 and 35 become entries that list exactly those lines, and lost 5 / 5 is unchanged. Next upstream sync: both files merge cleanly with the counts unchanged.
    blocker: none
    major: none
    minor: .github/fork-seams.json:478 and :525, since "2026-11-22": the branch is BEHIND main (fix(fork-kit): review kit follow-ups from the #955 reviews #960), so updating it makes a new head. If the update or the merge lands after 2026-11-22, refresh since (as the PR body says), and step 2 has to merge by 2026-12-06 or the lines must be announced again.
    minor: the merge gate classes .github/fork-seams.json as normal, not critical (the gate rule at .github/fork-pr-queue.json:21 leaves it out; NOT_GATE at fork-ci/actions/pr-queue/review_judge.test.py:451, Owner question: extra reviewer for workflow and gate changes? #82). On its own the gate would accept one code lens for this list-only guard change, so the three-lens read here is a choice, not enforced. This predates the PR and is not this PR's to fix.
    minor: for step 2 (optional): once the spread exists, usagePacingNote (.github/fork-seams.json:466-472) could move into ForkDelegateTaskResultFields, taking 4 fork lines out of the contract. Also, apps/server/src/fork/delegateChecks.seatOrder.test.ts reads the service's text, so step 2 probably has to update it.

🤖 Generated with Claude Code

@scuttletoby

Copy link
Copy Markdown
Owner Author

lens: state · reviewer: lens agent · read at: 60f5ac5
verdict: safe to merge
covered: the full diff (.github/fork-seams.json only), #817 and #808 with their comments, the PR body, the pending-to-files move path in .github/scripts/fork-seam-check.cjs (findUnlistedChanges move branch, promotedFiles, findListedNotFork, findLostLines, findSpareSeamLines, lowerList) and the seam rules in docs/fork/updates.md
checks: seam-check tests 117/117 pass; the PR run (config main, main..head) passes and counts both moved entries exactly from upstream (merge-base dd941b9); --from-upstream on the head and on main passes; mutation: turning off the "listed !== want" move rule turns one move test red; local throwaway probes, nothing pushed (results below)
state: runs again: the same commits give the same answer. Later day: the 2026-11-22 announcement holds for a head dated up to 2026-12-06, and fork-follow refuses it from 2026-12-07, which stops fork-follow until step 2 lands or the announcement is re-dated/removed. A head dated 2026-11-20 is refused as dated ahead. Stops half-way: it is one list-only commit; between step 1 and step 2, fork-follow passes, and lowerList only trims "added" and keeps "announced". Old state: the service's "lost" {5, 5} is still held from upstream as before, and on a pull request a seam file now loses no upstream line except a listed one, which is tighter than the pending count. An upstream rename or sync that changes a fork-modified line's text is now refused line by line, where a pending ceiling only checked the total; the fix is the same operator rebase path. Guard: not weakened. Every listed line is pinned exactly, the generic ones too ("parent,", "target,", "});" 3x), and the allowance counts upstream's copies, so a pull request adds none of them.
blocker: none
major: none
minor: .github/fork-seams.json:485 the service's 5 fork-modified upstream lines (its "lost" 5/5, e.g. modelSelection at :508) become one-way: as a seam file, a pull request that puts back upstream's original text is refused ("adds" an unlisted line), and that line can't be announced because the file already has a copy. While the file was pending, the same change passed with its ceiling and "lost" lowered. This was already true of the 4 seam files that have "lost" entries, so it is not new to this PR, but it matters for #808's "keep the fork part thin" once upstream's fix lands. Worth a checker follow-up (allow a dropped listed line plus a put-back upstream line when its own "lost" gone drops by one).
minor: .github/fork-seams.json:478 and :525 "since" 2026-11-22 matches today, but the branch is BEHIND main and must be updated before it merges. If the merge slips a day, re-date it as the body says. If step 2 hasn't merged by 2026-12-06, a list-only re-date is needed before fork-follow runs again.
minor: .github/fork-seams.json:496-522 the generic seam lines ("parent,", "target,", "});") keep the documented by-text gap: a pull request may drop upstream's copy instead of the fork's, and only fork-follow sees it. A list-only move can't make them more specific. Reviewers of later changes to these seats should check which copy goes.

probes (throwaway local commits on the head, judged by this PR's list unless noted):
step 2 service line added as announced            -> pass ("only the pinned seams")
same line judged by main's list                   -> refused (pending file grows)
announced line added twice                        -> refused (adds the line)
extra generic seam line "parent,"                 -> refused (adds `parent,`)
listed fork line dropped, own list unchanged      -> refused (remove it from "added")
an upstream line deleted                          -> refused (1 upstream line deleted)
--from-upstream, head dated 2026-12-06 / 12-07   -> pass / refused (announced more than 14 days before)
--from-upstream, head dated 2026-11-20            -> refused (announced after the head's date)
put back `modelSelection: target.modelSelection,` -> seam: refused in the PR run (passes from upstream);
  with own "added" and "lost" lowered                pending (on the base): pass

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant