Repository navigation
fork: report a linked child's pending prompts to its parent (#808 row 1) - #815
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LensVerdict: SAFE. Nothing blocks the merge. Unknown never reads as "not waiting", and no secret value, token or file path reaches the parent. The two majors below are small, and neither makes anything worse than Reviewed head BlockingNone. MajorM1. Text from the other machine goes uncapped and unquoted into the parent's prompt.
M2. A prompt handed to a blocking wait counts as delivered without proof. It can be lost for good, and a secret is always sent this way.
Minor
State question
Unknown is never "not waiting"Checked every caller of
SeamFolding the
Refusing such swaps would need the checker to understand code, and it would also block real clean-ups, so I filed no issue. If the owner wants pending files to only ever shrink, the route is the documented two-step one: a list-only PR that moves the file to Missing contract fieldsReporting a secret request and "unknown" only in Follow-up, one issue: a seam PR on
It would also add a fork seat in |
…s run lasts (#815 fix round) - Text and ids from the linked machine: ids only on a strict pattern (else unknown, "refused"), at most 50 prompts, a secret's label and reason folded to one line, capped (80/300) and quoted as the child's words. - A secret never goes to a blocking wait; it is always a queued message. A question or approval handed to a wait counts only while the parent's run lasts; after it, one message if it is still open there. - The receipt of a sent wake is read before a slot is taken; a machine that does not answer is asked once per round; "older" also names a link no longer accepted. - The remote read's spread line carries its // Fork: marker (no new line). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fix roundHead M1. Text and ids from the other machine (done)
M2. A wait counts as delivery only while it can deliver (done)
Minor
Contract follow-up: #817, a seam PR on Checks
|
A delegated task on a linked machine always reported hasPendingQuestion false and pendingApproval null, so its parent never learned the child was waiting. - New fork route GET /api/fork/task-prompts on each machine: the open questions, approval and secret requests (label and reason only, never a value) of one of its threads. Link token only. - task_status, delegate_task and their waits read it over the existing link through the fork seat remotePrompts (one spread line in the remote read). An unreachable or older machine reads as unknown in next, never as "not waiting". - A watcher wakes the parent once per prompt, the way a local child's question does: it ends a blocking wait if there is one, else it queues one wake message, and cancels that message if the prompt is answered there first. Wake ids are fixed, so a restart sends no second wake. - OrchestratorMcpService.ts is a pending file and may not gain a fork line: the Effect.scoped comment moves onto the (already fork) line it explains, which frees the line the seat takes. Still 35 fork lines. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s run lasts (#815 fix round) - Text and ids from the linked machine: ids only on a strict pattern (else unknown, "refused"), at most 50 prompts, a secret's label and reason folded to one line, capped (80/300) and quoted as the child's words. - A secret never goes to a blocking wait; it is always a queued message. A question or approval handed to a wait counts only while the parent's run lasts; after it, one message if it is still open there. - The receipt of a sent wake is read before a slot is taken; a machine that does not answer is asked once per round; "older" also names a link no longer accepted. - The remote read's spread line carries its // Fork: marker (no new line). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9d4439a to
ede78af
Compare
What and why
A delegated task on a linked (remote) machine always reported
hasPendingQuestion: false, pendingApproval: null. Those values were hardcoded in the remote read ofOrchestratorMcpService.ts("Its questions and approvals are answered in the environment it runs in"). So the parent never learned that its child was waiting on a question, an approval or a secret, and a blocking wait ran to its timeout.This change is #808 row 1: report the child's prompts to the parent and wake the parent. Answering them from the parent is a later row.
GET /api/fork/task-prompts?threadId=…(fork/remoteTaskPrompts.ts), on every machine, link token only (a browser session or client token gets 404). For one of its threads it returns the open questions (requestId,runId), the open approval (the same shape as a local child'spendingApproval) and any open secret requests, with label and reason only, never a value.task_status,delegate_taskand their waits read that route over the existing link (PeerLinks+HttpClient) through a new fork seat,delegateChecks.remotePrompts. That seat is one spread line in upstream's remote read. A linked child now reportshasPendingQuestionandpendingApprovalexactly as a local child does, andnextnames therequestIdand the child'senvironmentId/threadId.nextsays plainly that it is unknown and why.fork/remoteTaskPromptWakes.ts): a watcher reads the open linked tasks every 5 s and wakes the parent once per new prompt, the same way upstream'sDelegatedTaskQuestionReactorwakes it for a local child's question:message.dispatchcarrying adelegated_tasknotification, through the slot gate.What the contract is missing (not added here)
OrchestratorMcpDelegateTaskResult(packages/contracts/src/orchestratorMcp.ts, an upstream file) has:hasPendingQuestion/pendingApproval.Both are therefore reported in
next. Real fields would need the seam steps on that file. One effect: a blocking wait does not end on a secret request alone, because upstream'sendsTaskWaitonly sees the question and approval fields. The watcher's wake still reaches the parent.Upstream file
apps/server/src/mcp/OrchestratorMcpService.tsis apendingfile, which may not gain a fork line. The spread line is the only new one. The// Fork:comment aboutEffect.scopedmoves from its own line onto the line it explains, which was already a fork line. The file stays at 35 fork lines and the// Fork:marker count stays 6.Tests
All new tests are in
apps/server/src/fork/.remoteTaskStatus.test.tsruns upstream's realOrchestratorMcpServicewith a fake machine on the far end. It covers:delegate_taskwait: a question ends the wait at once, and a later question ends it on the task's wake.remoteTaskPromptWakes.test.ts(the watcher) checks:remoteTaskPrompts.test.tschecks the route (real router):found: false;delegateChecks.test.tspins the new seat in the remote read.Fails on the old code / red checks:
remoteTaskStatus.test.tsfail, including "reports its pending question, as a local task's (fails with the fixed false/null)".foundcheck fails "a thread there that is gone wakes no one and clears nothing either";Checks run: 211 tests pass in the changed files plus the
OrchestratorMcpServicetest files. Also clean: typecheck,vp fmt --check, lint and knip,fork-seam-check.cjs --config-ref origin/main origin/main HEAD,fork-seam-check.cjs --from-upstreamandfork-seam-check.test.cjs.General vs project
General. Any T3 user who delegates to a linked machine gets the report and the wake. There are no project facts, and nothing is configured per project.
Upstream fit
Upstream issue 26527 describes this bug. Its fix PR 26344 was closed unmerged, and no open fix PR exists. That PR added a link-only tool (
t3_link_requests) and a projection field. This change keeps upstream's existing result fields and contract unchanged, and adds only a fork route, a fork seat and a fork watcher. If upstream fixes the bug, the seat line and the two fork files can go.Part of #808
🤖 Generated with Claude Code