Repository navigation
Fix live agent resume checkpoints after daemon loss - #5633
Conversation
|
Ready to review this PR? Stage has broken it down into 4 individual chapters for you: Chapters generated by Stage for commit 9753a33 on Jun 17, 2026 9:10pm UTC. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between 8a6c3f7de3e916a529aaf485d469c566a437c511 and 9753a33. 📒 Files selected for processing (15)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (13)
📝 WalkthroughWalkthroughThe PR introduces a new 🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (1 warning, 2 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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: 4
🧹 Nitpick comments (1)
src/renderer/src/store/slices/agent-status.ts (1)
277-292: ⚡ Quick winDocument why
recoveryRecordMatchesonly compares identity fields.The selected field subset is intentional but non-obvious; a short “why” comment here will prevent accidental expansion that reintroduces write churn.
As per coding guidelines, “When writing or modifying code driven by a design doc or non-obvious constraint, add a comment explaining why the code behaves the way it does.”
Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 6cc0e7f2-61c9-4683-8aaf-0ea368062780
📥 Commits
Reviewing files that changed from the base of the PR and between 18d3545 and 8a6c3f7de3e916a529aaf485d469c566a437c511.
📒 Files selected for processing (15)
src/renderer/src/components/right-sidebar/source-control-primary-create-pr-intent-action.tssrc/renderer/src/components/right-sidebar/source-control-pull-policy-error-notice.tsxsrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/renderer/src/lib/resume-sleeping-agent-session.test.tssrc/renderer/src/lib/resume-sleeping-agent-session.tssrc/renderer/src/lib/session-write-subscriber.test.tssrc/renderer/src/store/slices/agent-status-quit-capture.test.tssrc/renderer/src/store/slices/agent-status.tssrc/shared/agent-session-resume.tssrc/shared/workspace-session-schema.test.tssrc/shared/workspace-session-schema.ts
| "d8a4c0e369": "Authenticate before creating a {{value0}}.", | ||
| "e9b5d1f470": "Check out a branch before creating a {{value0}}.", | ||
| "f0c6e2a581": "This branch is not ready for a {{value0}} yet.", | ||
| "h3i4j5k607": "Checking whether this branch can create a {{value0}}…" |
There was a problem hiding this comment.
Replace the non-SHA catalog key on Line 8722.
"h3i4j5k607" breaks the catalog’s SHA1-style auto-key pattern used in this locale section and is likely to drift from other locale files after sync.
Based on learnings, locale entries in src/renderer/src/i18n/locales/*.json should use SHA1-derived auto-keys and be maintained via pnpm run sync:localization-catalog.
Source: Learnings
| "d8a4c0e369": "Authenticate before creating a {{value0}}.", | ||
| "e9b5d1f470": "Check out a branch before creating a {{value0}}.", | ||
| "f0c6e2a581": "This branch is not ready for a {{value0}} yet.", | ||
| "h3i4j5k607": "Checking whether this branch can create a {{value0}}…" |
There was a problem hiding this comment.
Use a valid catalog key format for the new entry.
At Line 8722, h3i4j5k607 breaks the repo’s auto-key convention and is likely to drift from other locale catalogs. Regenerate this key via the localization sync flow so all locale files share the same identifier.
Based on learnings: new locale entries are auto-keyed from SHA1(file path + source text) and catalog parity is maintained via pnpm run sync:localization-catalog.
Source: Learnings
| const liveRecoveryWorktreeId = | ||
| entry.state === 'done' | ||
| ? null | ||
| : (entry.worktreeId ?? findAgentPaneWorktreeId(s, entry.paneKey)) | ||
| const liveRecoveryRecord = liveRecoveryWorktreeId | ||
| ? sleepingRecordFromEntry({ | ||
| state: s, | ||
| entry, | ||
| worktreeId: liveRecoveryWorktreeId, | ||
| capturedAt: updatedAt, | ||
| origin: 'live' | ||
| }) | ||
| : null | ||
| let nextSleepingAgentSessions = s.sleepingAgentSessionsByPaneKey | ||
| if (liveRecoveryRecord) { | ||
| if (!recoveryRecordMatches(existingSleepingRecord, liveRecoveryRecord)) { | ||
| nextSleepingAgentSessions = { | ||
| ...s.sleepingAgentSessionsByPaneKey, | ||
| [paneKey]: liveRecoveryRecord | ||
| } | ||
| } | ||
| } else if (existingSleepingRecord) { | ||
| nextSleepingAgentSessions = { ...s.sleepingAgentSessionsByPaneKey } | ||
| delete nextSleepingAgentSessions[paneKey] | ||
| } |
There was a problem hiding this comment.
Avoid dropping an existing checkpoint on non-terminal gaps.
This branch deletes existingSleepingRecord whenever liveRecoveryRecord is null. That includes non-terminal cases (e.g., transiently missing worktreeId/providerSession), which can erase an already durable recovery record before the next metadata tick.
💡 Proposed fix
- } else if (existingSleepingRecord) {
+ } else if (existingSleepingRecord && entry.state === 'done') {
nextSleepingAgentSessions = { ...s.sleepingAgentSessionsByPaneKey }
delete nextSleepingAgentSessions[paneKey]
}8a6c3f7 to
9753a33
Compare
Summary
Fixes #5626.
Verification