Repository navigation
feat(placement): auto-place top-level launches and make CLI starts retry durably - #69
Conversation
…try durably t3_thread_launch gains placement:"auto" for work that needs nothing of this checkout (no attachments, Scratch, existing worktree, or worktree not started from origin). It needs clientRequestId and an exact modelSelection, uses the same shared placement and authenticated-peer evidence as delegate_task, and binds the chosen environment before anything starts. A launch there goes out through the same link-session-bound send as remote delegation, now shared, so a lost answer, reconnect or restart reaches the same thread there or refuses; it never launches elsewhere. A named environmentId wins: routed tools drop placement whenever an environment is named, here or there. t3 thread start gains --request-id. The CLI signs in afresh each run, and the server names a launch after the caller's session and key, so a key alone could never find a lost launch. With a request id, the session the launch is sent with is kept in the server's own secret store until the launch is known; a fresh run with the same id sends the same launch, which the server replays, and once known it records the thread and gives the session up. --auto passes placement:"auto" and needs --provider, --model and --request-id. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CHECKPOINTCHECKPOINT: CLO-866 layer 3. Top-level
|
RESULTRESULT: CLO-866 layer 3 is ready for its one independent review. It is not merged.
|
Independent R1 — changes requiredReviewed head: The one independent source review found three material defects in the newly enabled behavior. Exact-head ARC 44250539276 is green; its current tests do not cover these boundaries. Hold merge for F1–F3. F1 — P1: resolve the project's runtime default before automatic placement. F2 — P1: a retained request ID can bypass its original placement and duplicate work. F3 — P2: remote --auto --wait drops the selected destination. The review also checked that the shared remote-send extraction preserves PR68's accepted incarnation guard, caller-scoped forwarding and recorded-child recovery. Atomic secret-store first-writer publication and reuse of the retained session are sound. The documented 30-day retained-token limit is not a separate finding. Deferred web/mobile/schedule/Tots work is explicitly outside this PR and was not counted as a defect. Scope: complete nine-file diff, relevant launch/auth/forwarding dependencies, changed tests, existing mode contract, current PR provenance and actual CI. No source edits, paid tests or live-host reproductions by the reviewer. This is an automated independent R1, not human approval. The same retained reviewer will verify only the original findings after a bounded repair; retain the repair ledger/history and stop according to its existing budget rather than resetting it. |
…ough every retry Review round 1 on top-level launch placement. - F1: an outside caller's launch resolves the project's default runtime mode, and the project's worktree default, before placement, so admission and the launch there use the mode it would start with here, not the client's ceiling. - F2: a key already placed in a linked environment reaches that environment whatever a retry asks (no placement, or a workspace only this checkout has), before any local check or launch; a launch already made here still replays here. Linked callers skip placement: their work was placed on their side. - F3: a launch placed elsewhere returns its environmentId, the CLI keeps it in its result and durable record, and --wait follows the thread there, also from a recorded result in a fresh run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Retained R1 verification — original F1–F3 closedVerified repaired head
No original finding remains open in the inspected repair. The unchanged explicit-environment routing remains within the already accepted explicit-pin semantics. Attempt history is retained: author reports F3 attempt1 passed; F1/F2 attempt1 failed on a shared defect, followed by passing repairs. The reviewer did not rerun or independently certify the reported 365 tests or fix-reversion experiments. Exact guard receipts, final current PR body/provenance and successful ARC at this head remain root's merge checks. No source changes, tests, live-host calls or publication by the independent reviewer. |
RESULTRESULT: PR69 review round 1 repair, findings F1–F3, on the same PR. It is ready for verification of the original findings only. It is not merged.
|
Universal native thread placement (CLO-866), layer 3: top-level
t3_thread_launch, which external MCP clients and the CLI use, now reaches the shared placement/admission path. CLI starts get a durable retry identity. Builds on PR68 (a40cf0ad).Head:
b904c19f64830016187ba02facbc5f33e842de2f. Base:release/native-0.1.10ata40cf0ad4aa769e3355646149e38ecaef35d5f0f. There are two commits:c2a1cc7a(the slice) andb904c19f(review round 1 repair).Problem
t3 thread startsigns in with a fresh short-lived MCP session on every run, and supplies no request key. The server names a launch after the caller's session namespace (client:<sessionId>) and key. So a CLI run whose answer was lost could only be repeated as a new launch. Adding a key alone would not help, because the namespace changes with every run.Change
t3_thread_launchplacement: "auto", used withoutenvironmentId:existing_worktree, and a worktree not started from origin stay here (local state).clientRequestIdand an exactmodelSelection. There is no default substitution.RemoteDelegation.placeasdelegate_task, with only authenticated peer evidence: forwardedorchestrator_capabilities, the peer's own project list for this repository, and link access at or above the caller's effective runtime mode. This environment's evidence comes from its own provider registry, project enablement andHostResources.command:mcp:<ns>:placement:thread-launch:<key>, before anything starts. It is never re-decided.expectedIncarnationsend, child marker, refusal on a replaced link, never rebinding a key) is extracted into onelaunchTherethat serves bothdelegate_taskand the newRemoteDelegation.launch. Delegate command IDs and messages are unchanged.environmentId. The CLI keeps it in its result and durable record, and--waitfollows the thread there through environment-scoped tools, including when a fresh run recovers a recorded result.McpToolAccess.routednow dropsplacementwheneverenvironmentIdis named, so a pinned launch runs exactly there (or here) and is never re-placed by the named environment.t3 thread start --request-id <id>:{sessionId, token}in the server's own secret store (ServerSecretStore.create, which is atomic first-writer) before launching, undercli-thread-start-<sha256(id)>.t3 thread list. It never signs in afresh to launch again.--autopassesplacement: "auto"and needs--provider,--modeland--request-id.apps/server/src/cli/thread.test.ts.Review round 1 (independent R1 on
c2a1cc7a) and repair--auto --waitdropped the destination.full-accessinstead ofapproval-required.--waitlooked for the thread on the local server.placement: undefined, which is invalid MCP JSON, so it was rewritten to omit the field. Only those two rewritten runs count as F2's baseline.~/.local/state/closura/repairs/):clo-866-pr69-r1-F1.json, sha256598f2e18…: attempt 1 failed, attempt 2 passed.clo-866-pr69-r1-F2.json, sha2568660ad64…: attempt 1 failed, attempt 2 passed.clo-866-pr69-r1-F3.json, sha25645d1234c…: attempt 1 passed.RemoteDelegationdouble died there. Attempt 2 makes linked callers skip placement.expected 'full-access' to be 'approval-required'.Thread thread-1 was not found here.Verification (local, bounded runner)
b904c19f:RemoteDelegation, CLI thread,PeerForwarding,linkOrigin, project handlers,McpToolAccess,McpHttpServer,OrchestratorMcpService,ThreadLaunchService,ProviderDimensions. That is 10 files and 365 tests.c2a1cc7a:McpToolAccess, its race test, project handlers,OrchestratorMcpService,RemoteDelegation, CLI thread,PeerForwarding): 7 files, 245 tests.no-eligible-environment.claude-box/claude-sonnet-4-6andfull-access/default.environmentIdwithplacement: "auto"launches exactly there, although the box is full.routedplacement strip makes this test fail.Command.runWithwith its own sign-in and services. The server is modeled as naming launches by session and key, and the real secret store persists on disk.thread-1, with exactly one launch, then revokes the kept session.thread-1without launching.expected 2 to equal 1, a duplicate launch.RemoteDelegation: 44 tests before the new case).c2a1cc7a: ARC run 44250539276 succeeded, with 10 files and 257 tests.b904c19f: ARC run 44253525404 succeeded, with all steps passing, including 10 test files and 260 tests on the runner.Known limits
--request-idwhose answer is lost keeps a full-access MCP session token in the server's secret store (0600, the same store as peer-link tokens) until a run with that ID completes, or the 30-day TTL expires. A request ID whose session expired refuses rather than relaunching, and its record stays until removed by hand.--request-idthe CLI behaves as before (no retry identity).placementdescriptions were not checked withevals/(paid model runs).--no-verifyfor the same pre-existing knip/host-Node reasons as PR68. Format, lint, typecheck and tests were run manually as above.Provenance
claude-opus-5-5(Claude Opus 5.5)🤖 Generated with Claude Code