Skip to content

fix: handle already-absent Orca worktrees during forced teardown - #7927

Closed
WTF-Am-ID wants to merge 3 commits into
kunchenguid:mainfrom
WTF-Am-ID:fm/up-fm-7543
Closed

WTF-Am-ID wants to merge 3 commits into
kunchenguid:mainfrom
WTF-Am-ID:fm/up-fm-7543

Conversation

@WTF-Am-ID

@WTF-Am-ID WTF-Am-ID commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Closes #7543

Forced teardown now reports an already-absent Orca worktree and completes cleanup only when --force is explicit and the recorded path is absent. Structured Orca errors survive both zero and nonzero process exits. Other removal failures retain their diagnostics and retry records, including after startup replay.

The regression fixture emits its JSON response before exiting. Tests cover zero-exit and nonzero-exit selector_not_found, refusal without force, existing paths, other errors, textual lookalikes, and retained records after replay.

Focused validation passed for the correction in ffb4f712efff895dc681b4b885ae30fb87abaaad: bash bin/fm-test-run.sh tests/fm-backend-orca.test.sh tests/fm-teardown-endpoint-safety.test.sh and the required lint/compiler checks. No live Orca workspace or pool operation was used. GitHub CI is validating this head.

Review was single-family (Codex), with no cross-model review, by the owner's temporary choice.

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 1 issue found → auto-fixed ✅
  • 🚨 bin/fm-teardown.sh:3870 - The new refusal branch prints "preserving task records for retry" and exits, leaving the close marker written at bin/fm-teardown.sh:3775. For example, forced removal returning runtime_unavailable retains metadata initially, but the next normal startup calls fm_backlog_close_marker_replay, which deletes that metadata and closes the backlog item without retrying Orca (bin/fm-backlog-transition-lib.sh:1180,1221). This contradicts the required "metadata/backlog cleanup occurs only on the accepted case." Retire the pending close through the existing marker helper before returning a removal refusal. The same incorrect retention expectation appears at tests/fm-backend-orca.test.sh:1058, docs/orca-backend.md:71, and docs/verification/runtime-backends.md:2191. Extend the behavioral check through startup replay to verify rejected removals retain their records.

🔧 Fix applied.
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 6 of 6 scenarios driven live against the product
Scenario Result Live Evidence
Forced cleanup accepts structured selector_not_found only when the recorded path is absent, reports already absent, and completes record cleanup. ✅ pass live tests/fm-backend-orca.test.sh: forced-absent case, executed through bin/fm-test-run.sh
Cleanup without force refuses an absent selector and preserves task and backlog records after startup replay. ✅ pass live tests/fm-backend-orca.test.sh: unforced-absent and unforced-scout cases
Forced cleanup refuses when the recorded path remains a directory, file, or dangling symlink. ✅ pass live tests/fm-backend-orca.test.sh: forced-existing, forced-file, and forced-symlink cases
Other Orca errors retain their diagnostic and retry records after startup replay. ✅ pass live tests/fm-backend-orca.test.sh: other-error and zero-exit-error cases
Textual selector_not_found lookalikes cannot authorize cleanup. ✅ pass live tests/fm-backend-orca.test.sh: malformed-error and message-only cases
Endpoint safety checks continue to protect unrelated endpoints and refuse cleanup when the Orca CLI cannot attempt closure. ✅ pass live tests/fm-teardown-endpoint-safety.test.sh, executed through bin/fm-test-run.sh
  • bash bin/fm-test-run.sh tests/fm-backend-orca.test.sh tests/fm-teardown-endpoint-safety.test.sh exited 0 without skips.
  • BASH_ENV=~/.no-mistakes-upstream-codex/evidence/01M61JJANY7ZW7QQQ1A41GCPT9/capture-product-output.sh bash bin/fm-test-run.sh tests/fm-backend-orca.test.sh exited 0.
  • git status --short --untracked-files=all confirmed no worktree changes or transient files.
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the previous cleanup failure is fixed, and no new actionable issues were found.

Reviews (2) · Last reviewed commit: "no-mistakes(ci): Fixed ci-1 at the share..." · Reviewed by Greptile

Comment thread bin/fm-teardown.sh Resolved
…structured errors on zero-exit failures. Added regression coverage and confirmed it failed before the fix. Both permitted behavior suites and required lint/compiler checks passed. This is a tier 1 fix at the shared boundary. Changes remain uncommitted for the outer executor to commit and push
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @WTF-Am-ID, this follows the fix shape from #7543 closely.

I read the diff against latest main (821409b9):

  • fm_backend_orca_run_json now surfaces Orca's JSON error on a failing call instead of dropping it.
  • Teardown accepts structured selector_not_found as "already absent" only with explicit --force and an absent recorded path (no dangling symlink either). Every other removal failure prints the Orca diagnostic, retires the pending close marker, and keeps the task records for retry, so startup replay can't quietly clean up behind a refusal.
  • The path-match check now runs before the backlog close, which is the safer order.
  • I found no other open PR for fm-teardown --force exits silently for an Orca task whose worktree is already gone #7543. fix(bin): verify Orca worktree ownership before teardown #4838 is adjacent (a recorded path gone while Orca still knows the worktree) but doesn't fix this.

One ask, whenever you have a moment: the evidence so far is the fake-Orca suites. The body says no live Orca workspace was used. Could you live-test against a real Orca install, for example a disposable task whose worktree is removed before a --force teardown, plus one non-forced refusal, and post the transcript? Re-raising through git push no-mistakes with that evidence works too. This one is waiting on you for that. CI is still queued.

VISION: aligns. "One captain, one interface": no silent exits. "Unlanded work is never torn down": refusals keep records. "The fleet outlives any vendor": the Orca adapter reports its own errors. "Scripts own the mechanics."
contract-class: restore. --force teardown is already specified to finish record and backlog cleanup, and it silently stopped instead.

@WTF-Am-ID

Copy link
Copy Markdown
Contributor Author

Closing this one: we don't run Orca, so we can't provide the live Orca evidence requested. The fix and tests stay on this branch if anyone who uses Orca wants to pick it up or reopen.

@WTF-Am-ID WTF-Am-ID closed this Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fm-teardown --force exits silently for an Orca task whose worktree is already gone

2 participants