fix-brokered-deliverable-preflight-worktree

Fix brokered deliverable preflight worktree binding

Metadata

Statusfailed
Assignedagent-969
Agent identityfbb2d89fe44d6b761bcb4b67748ab3d417f29df70a65f8d9403308f5bb2bab78
Created2026-08-02T21:16:00.085122069+00:00
Started2026-08-03T06:08:44.469374093+00:00
Tagslifecycle, containment, worksave
Tokens24783264 in / 30516 out
Failure reasonProvider failure detected after streaming: provider-unavailable

Description

Fix the self-hosting completion defect reproduced by design-atomic-graph-work-save: a capability-brokered worker has an authenticated retained worktree and committed deliverables there, but done::run_inner runs deliverables::preflight against the graph project root and falsely reports the deliverables missing. Commit 9774eed0 propagates brokered worktree context for finalization, but preflight still ignores it.

Keep this a narrow containment repair. Make deliverable preflight resolve against the exact authenticated/detected worktree root when task-owned completion is active, and against the graph project root only for genuine human/root completion. Do not weaken or skip preflight. Do not copy deliverables into the graph root. Reject inconsistent worktree/project/task context rather than falling back. Preserve .wg control-plane exclusions.

Add focused regression tests covering:

  • brokered task with deliverable present only in retained worktree passes preflight and proceeds through the task-owned path;
  • same deliverable absent in retained worktree is refused even if a stale copy exists at graph root;
  • ordinary human/root completion retains existing graph-root behavior;
  • authenticated context mismatch fails closed;
  • lost/replayed broker request remains idempotent if relevant to the touched path.

Use the completed design attempt as the incident trace: task design-atomic-graph-work-save, agent-966, branch commit 1e4aca27, where both declared deliverables exist and are committed but wg done refused them from the graph root. Do not modify or clean that worktree; it will be retried after this repair lands.

Non-goals: do not implement the full GraphSave/WorkSave design, change dependency semantics, reconcile the formal task's false Failed projection, modify Lean, or broaden daemon planner scope.

Validation

  • Focused commands::done tests prove all four worktree/root cases above.
  • Reproduce the incident in an isolated graph/worktree smoke: committed deliverables present only in the worker worktree pass brokered completion preflight without copying to root.
  • Missing worktree deliverable remains a hard refusal.
  • cargo fmt --check, focused tests, cargo check, and cargo clippy pass.
  • Existing tests/smoke/scenarios/exited_worker_finish_convergence.sh still passes.

Depends on

Required by

Messages 4 messages (4 unread)

  1. #1fix-brokered-deliverable-preflight-worktree2026-08-02T22:12:18.392283200+00:00read
    Completion is blocked only by the new smoke's initially-integrated script requiring WG_BIN in the long-running daemon environment. Latest pushed commits make the smoke self-resolving and it passes manually, but the graph root is pinned at initial 55d2b6cb until finalization. Please restart/reload the daemon with WG_BIN=/home/bot/.cargo/bin/wg or fast-forward the already-integrated source to 922554a9+, then I can rerun the hard gate.
  2. #2fix-brokered-deliverable-preflight-worktree2026-08-03T05:32:49.975120964+00:00read
    Acknowledged the queued bootstrap note. I integrated the prior branch's self-resolving smoke corrections into this retained branch; the corrected owned smoke now passes with the installed candidate. I will complete through the broker once the currently busy coordinator responds.
  3. #3fix-brokered-deliverable-preflight-worktree2026-08-03T05:35:03.641105790+00:00read
    Completion bootstrap remains: graph-root main still has initial 55d2b6cb smoke, while corrected self-resolving script is pushed on origin/wg/agent-968/... at ccf51d90. The live daemon has no WG_BIN in /proc env, so owned gate cannot pass until operator fast-forwards the script correction or restarts/reloads with WG_BIN=/home/bot/.cargo/bin/wg. I will not mutate main or bypass the gate.
  4. #4fix-brokered-deliverable-preflight-worktree2026-08-03T06:09:20.108823697+00:00read
    Acknowledged all queued bootstrap notes — operator restart now supplies WG_BIN; I am validating the retained corrected smoke and will retry the hard gate.

Log