Repository navigation
Conversation
…ion recovery The unknown-outcome receipt named what a failed mutation left behind with no action for it — the mutation got --retry-request advice, the residue got nothing, and the orchestration guide ends at "inspect residualResources". Terminal and worktree residue now carry their reclaim command, positioned after the retry advice since a retried mutation may adopt the same resources. Fixes stablyai#15944
📝 WalkthroughWalkthroughThe mutation recovery error now appends shell-quoted reclaim commands for residual terminal and worktree resources. The helper ignores non-array residue, unsupported resource kinds, and entries without valid identifiers. Tests cover command generation, filtering, shell quoting, empty inputs, and platform-specific command formatting. Merge Risk: ⚪ Minimal · up to The change adds conditional reclaim guidance for residual resources, with no actionable merge-blocking risk remaining after normal checks and review. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/cli/orchestration-mutation-recovery.ts (1)
26-34: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winShorten the explanatory comments.
Keep only concise, non-obvious context.
src/cli/orchestration-mutation-recovery.ts#L26-L34: reduce the nine-line rationale to one brief comment.src/cli/orchestration-mutation-recovery.test.ts#L5-L6: remove or reduce the issue-history comment.src/cli/handlers/orchestration-gate-cli.test.ts#L231-L232: remove or reduce the ordering explanation.As per coding guidelines: “Comments must be concise, non-obvious, and brief—prefer one line; do not explain obvious behavior or walk through code.”
Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 5353549d-4cee-4be7-b87b-fbb45abcbb75
📒 Files selected for processing (3)
src/cli/handlers/orchestration-gate-cli.test.tssrc/cli/orchestration-mutation-recovery.test.tssrc/cli/orchestration-mutation-recovery.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Coderabbit review on stablyai#15949: raw interpolation into a copy-paste command splits on spaces (worktree ids embed paths) and executes injected shell syntax. Ids now go through quoteShellToken, which handles both posix single-quoting and the win32 cmd.exe double-quote form.
|
Good catch — pushed: both ids (and the |
The previous push landed with mangled quote escapes in the test file; rebuild via quoteShellToken so expectations stay platform-exact.
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 36139163-9ae4-4858-868f-b573f0445c44
📒 Files selected for processing (3)
src/cli/handlers/orchestration-gate-cli.test.tssrc/cli/orchestration-mutation-recovery.test.tssrc/cli/orchestration-mutation-recovery.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/cli/orchestration-mutation-recovery.test.ts (2)
27-35: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd coverage for blank identifiers.
The test covers a missing
id, but not an emptyid. Add a case such as{ kind: 'terminal', id: '' }and verify that it produces no recovery command. If runtime inputs can contain non-string identifiers, cover those values too.
38-56: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winCover Windows double-quote escaping and both platform branches.
The input
term_ev'iltests the POSIX apostrophe escape. It does not test the Windows escape for an embedded". The conditional also runs only one branch on each host. Add a double-quote input and either run the test on both POSIX and Windows or make the platform injectable for deterministic unit coverage.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 7d763597-79b3-44a3-a53a-5db1631ecaf8
📒 Files selected for processing (1)
src/cli/orchestration-mutation-recovery.test.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.
What
orchestrationMutationRecoveryErrornow appends a reclaim command for each residual resource after the--retry-requestadvice:kind: "terminal"→If terminal <handle> is still residual after the outcome is settled: orca terminal close --terminal <handle> --json.kind: "worktree"→If worktree <id> is still residual after the outcome is settled: orca worktree rm --worktree id:<id> --force --json (verify nothing valuable was written first).Resources without an id, or of kinds there is no safe blanket advice for, are skipped rather than guessed at.
Why (issue #15944)
The unknown-outcome receipt names what a failed mutation left behind but attaches no action to it: the mutation itself gets the
--retry-requestrecovery command while the residue gets a bareJSON.stringify, and the orchestration guide's instruction ends at "inspect itsstage,effects, andresidualResources". The commands that would clear the residue exist in the CLI (terminal closesince well before v1.4.186;worktree rm) but a coordinator reading the receipt would never learn them — the guide's only mention ofterminal closeis the prohibition against substituting it forworker-release.The commands are deliberately placed after the retry advice and phrased conditionally ("if still residual after the outcome is settled"): a replayed mutation may adopt the same resources, so the residue should only be reclaimed once
--retry-request(or a deliberate fresh attempt) has settled the outcome. That also keeps the receipt consistent with the guide's release discipline.Testing
src/cli/orchestration-mutation-recovery.test.ts: terminal + worktree residue map to their exact reclaim lines; id-less / unknown-kind / non-array inputs yield no lines.orchestration-gate-cli.test.ts) now also asserts the reclaim commands appear in the printed error message, after the--retry-requestline.orchestration-mutation-recovery.tsstashed, the extended e2e assertions fail (no reclaim commands in the message); with it applied, both files pass andpnpm run typecheckis clean.Fixes #15944