Repository navigation
test(runtime): cover remote terminal retirement across paired viewers - #10053
Conversation
📝 WalkthroughWalkthroughAdds an E2E unit test for remote terminal tab retirement after host PTY exit. The test verifies retirement publication versions, empty terminal tabs, workspace cleanup, viewer reconciliation, and prevention of stale publication resurrection. The reliability gate now includes the test command and file, assertion references, topology coverage labels, execution evidence, updated red-green results, and documented live-environment gaps. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
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: 2
🧹 Nitpick comments (1)
tests/e2e/remote-terminal-tab-retirement.unit.test.ts (1)
194-207: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winNon-obvious stale/replay sequence would benefit from a short explanatory comment.
This block exercises a subtle invariant (an exact-current-replay of the already-applied retirement publication is allowed, but the older live publication stays rejected even after
acceptReplayedWebSessionTabsSnapshot). A one-line "why" comment would help future readers avoid mistaking the repeatedtoBe(false)checks for redundancy.Based on coding guidelines: "Add concise, ideally one-line comments only for non-obvious code, explaining why rather than how."
Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 852d5c7b-bed4-4f0e-9684-c1b0e5d3ce96
📒 Files selected for processing (2)
config/reliability-gates.jsonctests/e2e/remote-terminal-tab-retirement.unit.test.ts
| terminalLayoutsByTabId: { | ||
| [TAB_ID]: { | ||
| root: { type: 'leaf', leafId: LEAF_ID }, | ||
| activeLeafId: LEAF_ID, | ||
| expandedLeafId: null, | ||
| ptyIdsByLeafId: { [LEAF_ID]: PTY_ID } | ||
| } | ||
| }, | ||
| sleepingAgentSessionsByPaneKey: { [`${TAB_ID}:${LEAF_ID}`]: {} as never } | ||
| } | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Retirement isn't asserted to clear sleepingAgentSessionsByPaneKey.
The fixture seeds sleepingAgentSessionsByPaneKey[${TAB_ID}:${LEAF_ID}] for the exact pane being retired, but no assertion after onPtyExit verifies this entry is removed. Since the test's stated purpose is durable retirement of the surface, a stale sleeping-agent-session entry for a permanently retired pane would go undetected.
🐛 Suggested additional assertion
expect(session.tabsByWorktree[WORKTREE_ID]).toEqual([])
expect(session.terminalLayoutsByTabId[TAB_ID]).toBeUndefined()
+ expect(session.sleepingAgentSessionsByPaneKey[`${TAB_ID}:${LEAF_ID}`]).toBeUndefined()Also applies to: 191-192
| const runtime = new OrcaRuntimeService({ | ||
| getWorkspaceSession: () => session, | ||
| setWorkspaceSession: (next) => { | ||
| session = next | ||
| }, | ||
| flushOrThrow | ||
| } as never) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify OrcaRuntimeService's constructor parameter shape matches the fixture.
ast-grep run --pattern 'class OrcaRuntimeService {
constructor($_) {
$$$
}
}' --lang typescript src/main/runtime/orca-runtime.tsRepository: stablyai/orca
Length of output: 151
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf 'Files matching orca-runtime/orca runtime:\n'
fd -i 'orca.*runtime|runtime.*orca|orca' . | sed -n '1,120p'
printf '\nTest file snippets:\n'
if [ -f tests/e2e/remote-terminal-tab-retirement.unit.test.ts ]; then
wc -l tests/e2e/remote-terminal-tab-retirement.unit.test.ts
sed -n '1,230p' tests/e2e/remote-terminal-tab-retirement.unit.test.ts | cat -n
fi
printf '\nSearch OrcaRuntimeService references:\n'
rg -n "OrcaRuntimeService|constructor\\(" -S . --glob '!node_modules' --glob '!dist' --glob '!build' | sed -n '1,200p'Repository: stablyai/orca
Length of output: 50370
Avoid as never on the OrcaRuntimeService test double.
as never disables TypeScript checking of this dependency object, so typo’d property names or mismatched callbacks in the test fixture would compile despite bypassing the real constructor contract. Use a safer typed cast, for example as unknown as ConstructorParameters<typeof OrcaRuntimeService>[0].
Summary
Findings
Current main already contains the durable host-side lifecycle fix from #9687 and related reconnect/ownership work. PR #9053 fails this harness because its stale-headless pruning retains the pinned persisted surface, so #9053 should be closed or superseded rather than adopted.
Related: #9352 and STA-2115.
Validation
pnpm typecheckpnpm check:reliability-gatespnpm check:max-lines-ratchetgit diff --checkRemaining gaps