fix: lock terminal stale restore contract - #659
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughBackend validation enforces that missing PTY resources return 404 NotFoundError on delete. E2e test validates that restoring legacy persisted terminal state with stale runtime PTY IDs creates fresh PTYs, prevents old resource requests, and migrates persistence to version 2 without embedding runtime handles. ChangesStale Terminal Restore and Missing-PTY Contract
🎯 2 (Simple) | ⏱️ ~12 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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.
Code Review
This pull request introduces an E2E test to verify that restoring legacy terminal state correctly initializes a fresh runtime PTY. It also updates the PTY deletion route to explicitly check for existence and return a 404 error, supported by a new unit test. Feedback suggests optimizing the deletion logic by removing the redundant existence check before removal and using a more generic error message to avoid information leakage.
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Root cause / goal: - The latest public stable release v2026.5.15 predates the stale persisted session and terminal recovery fixes from #649/#659. - Installed users can still reopen stale pinned sessions or terminal PTY state, causing repeated reconnect attempts and noticeable desktop jank. Change boundary: - Bump the desktop package version to 2026.5.17 so the existing fixes can be built and published as a hotfix release. - No runtime behavior changes are introduced by this release PR itself. Verification: - Local app unit suite: 1146 pass / 0 fail. - OpenCode PTY route tests: 5 pass / 0 fail. - Terminal stale restore E2E: 1 passed. - Web smoke: 22 passed / 1 skipped. - Electron build, runtime import guard, raw smoke, problem report smoke, macOS arm64 dir packaging, and packaged smoke all passed locally. - PR CI, CodeQL, desktop smoke, E2E artifacts, dependency review, lint, typecheck, and unit shards passed. Release follow-up: - Run the production desktop release workflows for macOS arm64/x64 and Windows x64. - Publish v2026.5.17 only after all expected assets and updater metadata are present. Refs #647. Refs #648.
Summary
DELETE /pty/:idmissing-target behavior to404 NotFoundError.pty_old, reloads, and verifies restore uses a durabletab_...without hitting/pty/pty_old.Why
#648 split terminal identity into durable UI tabs and memory-only runtime PTY handles. PR1 added the storage schema, and PR2 wired the runtime lifecycle. PR3 closes the remaining contract gap: missing delete semantics must be explicit, and stale persisted terminal state must not send old runtime ids back to backend PTY routes.
Related Issue
Closes #648.
Human Review Status
Pending. A human should make the final merge decision after reviewing the final diff and verification evidence.
Review Focus
DELETE /pty/:idnow matches the existing GET / PUT / connect missing-target contract.Risk Notes
terminal-reconnect.spec.tsstill fails locally at the known Ghostty input path: the command is typed, but the expected token does not render before the reconnect assertion. This is unchanged from PR2 and is not caused by this diff.How To Verify
Screenshots or Recordings
N/A. This PR changes runtime recovery contracts and regression coverage, not visible UI layout or copy.
Checklist
dev, and my PR title and commit messages use Conventional Commits in EnglishSummary by CodeRabbit
Release Notes
Bug Fixes
New Features
Tests