Repository navigation
feat(corch): CORCH-09 slot injection, worktree commands, PR lookup, memlog claim seam (stacked on #544) - #545
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d857b20f5a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if ((a.status === 'done' || a.status === 'cancelled') && supId) { | ||
| try { | ||
| const r = await send(a.userId, supId, 'corch.worktree_remove', [run.repo_ident, a.itemId]) |
There was a problem hiding this comment.
Stop per-item worker sessions before releasing their worktrees
When CORCH is used with a working memlog client, each item gets its own persistent worker session, but completion only ends the CORCH run and releases the claim/worktree; nothing stops the worker. SessionBridge forwards the final assistant message without exiting, and ProcessManager deliberately retains authenticated idle runners. Those workers therefore keep occupying the supervisor's concurrency slots (reserveSessionSlot in hub/src/sessions/budget.ts and the local cap in supervisor/src/process-manager.ts). After maxConcurrent distinct items, subsequent launches are refused even though CORCH considers the earlier runs finished; merging their PRs also deletes directories underneath still-running workers. Stop the item-owned session when its run finishes, with appropriate handling for retries, before removing its worktree.
Useful? React with 👍 / 👎.
734be00 to
c85bb36
Compare
e3522b3 to
a5718c2
Compare
…emlog claim seam Supervisor: account_slot in hello only with REMO_ACCOUNT_SLOT; slot spawn env (OAuth token + CLAUDE_CONFIG_DIR, fail closed, API key scrubbed); allowlisted corch.worktree_ensure / worktree_remove / pr_lookup (sandboxed, deterministic corch/<id> worktrees, gh PR lookup, no credential in replies). Hub: real Workspace + PrLookup behind the CORCH-01 seams, memlog claim client seam (default refuses memlog_unavailable: R3.8 BLOCKED-ON-MCP, no hub->memlog transport exists), release on done/blocked, claim heartbeat from the reconciler, haltBeforeMachineSend before every corch.* frame, no-token guard. All flags stay OFF. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Redact the slot token from runner output, bind clone origin + scope the git credential helper to github.com, stop advertising corch.* commands, sandbox and branch-check worktree removal, kill stuck git/gh below the hub RPC timeout and never release a claim on timeout, unwind claims on every requeue/blocked/failure path, heartbeat pr_open claims, clean up gsd-console cancelled items. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Per-item lock and claim-owner fencing, claim release on attachSession failure, no release on worktree RPC timeout, single 480s budget per worktree_ensure, pr_lookup pinned with --repo (GH_REPO ignored), release finds the run that has the worktree, paged pr_open heartbeats, token redaction covers git credentials and object keys. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Timeout fence applies to cancel/done, removal resolves the host via the bound account, gh lookup pins github.com and a 100-item window. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…okup, record worktree host before ensure, pin launch and clean every recorded host Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…BLOCKED-ON-MCP) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
c85bb36 to
94c4b07
Compare
a5718c2 to
70a43dc
Compare
The release step added in CORCH-09 awaited before the pr.failed notification claim, on the transitioned path only. A concurrent duplicate delivery of the same event could then take the claim first, so the delivery that applied the transition answered 503 notification_pending (CI: corch-aaf e2e 'concurrent duplicate deliveries', 0 applied of 6). State and notification count stayed correct; only the answer was wrong. Moving the best-effort release after the claim restores the CORCH-08 ordering and stops the owner notification waiting on worktree cleanup. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Zero Exposure did not auto-merge this PR. Blocking reason: auto-merge blocked: not eligible -- diff classifier: hub/test/corch-no-token-guard.test.ts: addition to a fetch/CORS/CSP allow-list: // 3. the corch.* command names live only in the one sender module and the RPC allowlist, and every sender call; diff classifier: hub/test/corch-quota-binding.test.ts: potential flag/safety change: identifier-shape heuristic matched "process.env.REMO_CORCH_ENABLED" added with a truthy value and no removed counterpart to pair against; semantic effect unverified; requires review: process.env.REMO_CORCH_ENABLED = '1'; diff classifier: hub/test/e2e/corch-slot.e2e.test.ts: potential flag/safety change: identifier-shape heuristic matched "process.env.REMO_CORCH_ENABLED" added with a truthy value and no removed counterpart to pair against; semantic effect unverified; requires review: process.env.REMO_CORCH_ENABLED = '1' Reviewed commit: |
CORCH-09 slot injection, worktree commands, PR lookup, memlog claim seam
Stacked on CORCH-08 (PR #544); base
phase-corch-08-aaf-event-receiver.REQ: CORCH-R4.1, R4.2, R4.3, R4.4, R4.5 complete. CORCH-R3.8 is BLOCKED-ON-MCP: no verified hub->memlog transport exists (memlog is gateway-only MCP; the hub has no gateway credential or MCP client). The memlog claim is an injected
MemlogClientseam whose default refusesmemlog_unavailable(items wait, one ticket); the full claim lifecycle is built and proven against a fake memlog. 7e request filed tomcp-serversvia memlog_note (mem:mcp-servers:requests1794637033307-0);autofix-report mcp-serversreturned HTTP 401 invalid_key.What it does
account_slotinsupervisor.helloonly withREMO_ACCOUNT_SLOT; slot spawn env (OAuth token +CLAUDE_CONFIG_DIRrequired with the slot,ANTHROPIC_API_KEYscrubbed, deploy creds scrubbed, runner output redacted); allowlistedcorch.worktree_ensure|worktree_remove|pr_lookup(sandboxed, deterministic<root>/corch/<name>-<id>oncorch/<id>off the remote default branch, clone origin bound, host-scoped credential helper, one shared deadline, never advertised to scheduled tasks).Workspace+PrLookup(built only whenREMO_CORCH_ENABLEDis ON; defaults still refuse), claim fencing per item, release on requeue/blocked/done/cancelled, worktree removal on done/cancelled (not blocked), reconciler heartbeats live and pr_open claims,haltBeforeMachineSendbefore everycorch.*frame, gsd-console cancellations and AAF closures clean up.hub/test/corch-no-token-guard.test.ts(no token/API key in hub, halt precedes every frame) + supervisor frame test.docs/corch.md, CLAUDE.md env.Tests
supervisor
corch-slot(11),corch-worktree(15, temp git repos + fake gh); the 3 named supervisor guards green. Hubcorch-workspace(21),corch-no-token-guard(7), real-Postgrese2e/corch-slot.e2e.test.ts(10: claim -> worktree -> launch -> turn end -> lookup -> pr_open -> done release),corch-aaf-events(+1).bun run check-baseline: pass=4213 fail=0. 3 pre-existing supervisor PTY failures (pty-byte-relayetc.) also fail on the CORCH-08 base.QC
Codex (external seat responded) rounds 1-3, each QC-FAIL (9 / 7 / 4 findings), all fixed; see
.planning/phases/CORCH-09-slot-injection-worktree/QC-R1..R3.mdandQC-ADJUDICATION.md. The round-3 fixes are verified by tests but were not re-reviewed externally (3-round cap). Adjudicated by design: a no-slot supervisor still inherits an operator-setCLAUDE_CODE_OAUTH_TOKEN(existing behavior, R4.2 keeps the human path unchanged); redaction cannot catch a secret split across events or re-encoded.Flags / env (all default OFF / unset)
Supervisor-side only:
REMO_ACCOUNT_SLOT,REMO_SLOT_CLAUDE_CONFIG_DIR,CLAUDE_CODE_OAUTH_TOKEN. Desktop MSIs never set them. No new hub env;REMO_CORCH_ENABLEDstays OFF.Cutover items this adds
Slot supervisor build/image (CORCH-10), a real
MemlogClientonce an mcp-servers endpoint exists, git credential env (GH_TOKEN) on each slot.🤖 Generated with Claude Code