Skip to content

test(remote-runtime): pin the 12 hand-kept error-code lists to their callers' policy - #30246

Merged
nwparker merged 1 commit into
mainfrom
nwparker/r2-s5-pin-error-lists
Oct 18, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/r2-s5-pin-error-lists

Conversation

@nwparker

@nwparker nwparker commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 12 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​651 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​650
Prod 0 0 0 0

ELI5

Orca has about a dozen small lists of error codes. Each one answers a question like "did my close reach the server?" or "is it safe to retry?". Nothing stopped someone from quietly removing a code from one of these lists, or from adding a new code that one of them silently mishandles. That is how #30146 happened: a tab you closed while a server was disconnected came back. This PR adds tests that pin each list, so any change to one becomes a visible, reviewed test change.

What Changed

Tests only. Production code is unchanged. For each of the 12 lists, a test names:

  • the codes in the list,
  • the message fragments it falls back on when Electron IPC strips the code, and
  • nearby codes it must not treat the same way.
List Test
user-close "undelivered" codes (web-runtime-session-tab-lifecycle.ts) new web-runtime-session-tab-close-undelivered-codes.test.ts, including the #30146 shape: a client-minted runtime_manually_disconnected, as an envelope and as a bare Error, keeps the close for replay
shared "recoverable" codes and 13 fragments (remote-runtime-client-error-classification.ts) exact contents and behaviour, in its existing test
web boot "host unreachable" (startup-web-host-unreachable.ts) new test
delete "reply lost" (host-worktree-removal-state.ts) new test
automation host query mapping (automation-host-cache-error.ts) new test
CLI orchestration "outcome unknown" (orchestration-mutation-recovery.ts) added to its existing test
CLI Jira "may have been applied" (jira-write.ts) new test
agent-session definitive refusal, plus its launch duplicate added to the existing tests, including a host that flattened the refusal into runtime_error
send evidence "turned away" codes added to its existing test
browser-create definitive codes (web-runtime-browser-creation-failure.ts) new test
orphan-adoption stable codes new test

Why

The round-2 plan was to fold these lists into one classifier. A design review showed that can't be done without changing behaviour: the lists encode per-caller rules, and nothing on main reliably records whether a request reached the host. The fold is deferred to a separate "dispatch evidence" project. Pinning the lists now gives that project a behavioural baseline and stops silent drift in the meantime.

Linked Issue

N/A (round-2 SSH hardening, S5 follow-up; regression guard for #30146).

Visual Proof

N/A: tests only.

Testing

  • All 12 changed test files pass (208 tests), and the touched folders pass single-worker (src/cli/handlers, src/renderer/src/startup, components/automations, store/slices/worktrees/teardown: 160 files, 1493 tests).
  • Mutation check: renaming runtime_manually_disconnected in the close list makes the new close test fail.
  • Ran the full local "static analysis and typecheck" job: clean.
  • Codex review (gpt-6.1-sol, high): clean.
  • Nothing to verify live, because no behaviour changes.

…callers' policy

Each list that decides delivered / undelivered / recoverable / definitive by code now has a
test naming its codes, the message fragments it relies on, and nearby codes it must not
treat the same. Includes the #30146 shape: a client-minted runtime_manually_disconnected
keeps a user's close for replay. Tests only; no production change.
@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

📝 Walkthrough

The change adds and updates tests across shared, renderer, and CLI code. The tests specify how selected runtime error codes affect recoverability, retryability, operation outcomes, cleanup, and recovery state.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to b820a

This change only adds tests that pin the error-code classification behavior, so it does not alter runtime behavior. Merge risk is minimal.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 12 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the main change: tests that pin 12 remote-runtime error-code lists to caller-specific policies.
Description check Passed The description explains the purpose, scope, affected test areas, rationale, linked regression context, visual impact, and testing results. It is mostly complete, although the Linked Issue section use…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the purpose, scope, affected test areas, rationale, linked regression context, visual impact, and testing results. It is mostly complete, although the Linked Issue section uses N/A and several template checklist sections are omitted.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments: 1
src/cli/handlers/jira-write.test.ts: 1

44-44: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Assert the Jira uncertainty warning.

This assertion checks jira_write_unverified but not its message. If the warning disappears while the code remains, the test still passes. Assert the fragment “The Jira change may have been applied” so the test covers the message fallback named in the PR objective.

Proposed test change
-    ).resolves.toMatchObject({ code: 'jira_write_unverified' })
+    ).resolves.toMatchObject({
+      code: 'jira_write_unverified',
+      message: expect.stringContaining('The Jira change may have been applied')
+    })

ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1b423917-1d57-4db8-a1c7-b4aab6c16376
📥 Commits

Reviewing files that changed from the base of the PR and between e6eaabb and b820a00.

📒 Files selected for processing: 12
  • src/cli/handlers/jira-write.test.ts
  • src/cli/orchestration-mutation-recovery.test.ts
  • src/renderer/src/components/automations/automation-host-cache-error.test.ts
  • src/renderer/src/lib/launch-structured-agent-session.test.ts
  • src/renderer/src/runtime/web-runtime-browser-creation-failure.test.ts
  • src/renderer/src/runtime/web-runtime-session-tab-close-undelivered-codes.test.ts
  • src/renderer/src/runtime/web-session-terminal-orphan-recovery-adoption.test.ts
  • src/renderer/src/startup/startup-web-host-unreachable.test.ts
  • src/renderer/src/store/slices/worktrees/teardown/host-worktree-removal-state.test.ts
  • src/shared/agent-session-definitive-refusal.test.ts
  • src/shared/remote-runtime-client-error-classification.test.ts
  • src/shared/structured-agent-session-send-evidence.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

@nwparker
nwparker merged commit 0d74111 into main Oct 18, 2026
36 checks passed
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.

1 participant