Repository navigation
fix(remote-delegation): a reply from a linked environment on another version still completes its task - #540
scuttletoby wants to merge 3 commits into
Conversation
List only. Announces the three lines the follow-up pull request adds to RemoteDelegation.ts: an import of fork/remoteReplyRead.ts, the wrapped forwarding, and lastReply reading through it. A task delegated to a linked environment on another version then still delivers its reply. Part of #386. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…version still completes its task A task delegated to a linked environment that runs an older T3 build never completed here. Its thread read decodes the whole thread, and a field this version requires in the thread's details (a linked pull request's watch state) is missing there, so every read failed as "did not match this version" and the follower retried forever: the parent was never told. lastReply now reads through fork/remoteReplyRead.ts. When the full read fails as an answer this version cannot decode, it reads the same page again without the thread's details, which a reply never needs. Runs and items keep their own schemas, so a reply is never guessed; if that read fails too, the first error stands as before. Moves the three announced RemoteDelegation.ts lines to the seam's added list. Part of #386. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review (independent, Opus)Head reviewed: Verdict: 1 blocking finding. The fix itself is sound. CI is red because of a fork test this PR breaks; it is a one-line fix. Findings, most severe first1. BLOCKING:
2. NIT: the error match is wider than the bug (every
3. NIT: with linked environments turned off here, an older peer's task still fails.
What I checked and found sound
|
The three RemoteDelegation.ts lines main announced (#538) move to "added", as this change adds them; the person-only settings test lists fork/remoteReplyRead.ts as a client of another environment's tool. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fix round 1
Local runs ( |
Part of #386. This is part 2. Part 1 was #412: the follow survives an interrupted delegating call.
The bug
A task delegated to a linked environment that runs an older T3 build never completes here, so its parent is never told.
Here is why. When the remote run ends, the follower reads the task's thread there with
t3_thread_readto get its reply. This version decodes that answer strictly, and the whole thread is decoded, including the thread's details. Upstream PR 34895 made two fields of a linked pull request required:watchingandwatchStartedAt. An older build does not send them. So any thread there with a linked PR fails the read with "The linked environment's answer did not match this version. Update both environments." The follower treats that as retryable and retries forever. The task staysrunninghere, and the result never arrives.The fix (design choice)
The change is in
apps/server/src/fork/remoteReplyRead.ts. It adds 3 seam lines toRemoteDelegation.ts, announced in #538.lastReplyreads through a small wrapper. It first does the full read, as before. If that fails asorchestration_error(an answer this version cannot decode), it does the samet3_thread_readagain throughPeerForwarding.call. This time the answer is decoded as the thread-read result withoutthread: just runs, items and paging.callrefuses because linked environments are off here.Options I did not take:
t3_thread_read/t3_thread_listagainst older peers. But it changes lines in a pending upstream contracts file, which the fork may not grow. That is for upstream.State question
start(), and they read their reply the same way.runningbecause of this complete on the next start that has this build. Their result is the child's last reply, which may be old by then.Tests
apps/server/src/fork/remoteReplyRead.test.tsruns a realRemoteDelegation.layerfollow against a mocked peer:failedafter the retry schedule) and passes with the fix.RemoteDelegation.test.ts, the #412 tests and these all pass (51/51).vp run check:changedpasses.Upstream fit
PeerForwarding.callwith a tool's success schema, theOrchestratorMcpThreadReadResultschema (mapped withStruct.omit), and the existing retry schedule andfollowGaveUp. It adds 3 seam lines inRemoteDelegation.tsand no change to upstream lines.watching/watchStartedAt, as upstream does for other fields that older linked environments lack. If upstream does that, this module and its 3 seam lines can be dropped.General vs project
This is general. Any two linked machines on different builds hit it. It has no setting and nothing project-specific.
Merge order
Merge #538, the list-only seam announce, first. Until then this PR's seam check fails by design, since it is judged by the list in the base. This branch contains #538's commit, so after #538 merges it shows only the fix.
Not covered here (rest of #386)
t3_thread_read/t3_thread_listagainst an older peer still fail. That needs the contract change above, upstream. Updating the older machine also fixes it.t3_background_waitbefore ending a turn.🤖 Generated with Claude Code