feat: recover detached agent runs#8
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5ce6b7098e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // Replaying this retained run from sequence zero preserves its sequence | ||
| // policy; the next Heddle slice will use binding.afterSequence directly. | ||
| activeSequenceRef.current = binding.afterSequence; | ||
| activeSourceRevisionRef.current = binding.baseSourceRevision; |
There was a problem hiding this comment.
Guard base revision by the restored run id
When a stored binding is stale and the session endpoint reports a different active run, this restores the old run's baseSourceRevision onto state.activeRun.runId. In that scenario (for example a duplicated tab sharing the session starts another run), if live replay later expires, checkRunStatus will compare the current deck to the stale hash and can auto-apply the new run's latestMotionDoc instead of forcing review. Please only carry binding.baseSourceRevision forward when binding.runId === state.activeRun.runId; otherwise clear it like the polling path does for run-id changes.
Useful? React with 👍 / 👎.
b79a493
into
codex/agent-lifecycle-browser-regression
What changed
confirmwith a focus-managed Radix AlertDialogWhy
A replay-expired run was reported honestly, but the editor remained wedged until a page reload and could not safely reconcile the eventual durable result. This makes that state recoverable without duplicating Heddle's run service or sacrificing SlideX's source-revision/undo boundary.
The base source revision is product state, so it stays in SlideX's project/run binding. Heddle continues to own event cursor correctness, replay, and terminal semantics.
Dependency and rollout
Validation
npm cinpm run test:agent(7 passed)npx tsc --noEmitnpm run lint(0 errors; 11 existing warnings)npm run test:agent:e2e(3 browser scenarios passed)npm audit --omit=devremains unchanged at the existing Next/Geist PostCSS advisory (3 moderate); pinned Radix AlertDialog adds no new production finding.