Skip to content

feat: recover detached agent runs#8

Merged
roackb2 merged 1 commit into
codex/agent-lifecycle-browser-regressionfrom
codex/recover-detached-agent-run
Jul 12, 2026
Merged

feat: recover detached agent runs#8
roackb2 merged 1 commit into
codex/agent-lifecycle-browser-regressionfrom
codex/recover-detached-agent-run

Conversation

@roackb2

@roackb2 roackb2 commented Jul 11, 2026

Copy link
Copy Markdown
Owner

What changed

  • add a Check status recovery path when retained live replay is unavailable
  • persist the active run's base source revision alongside its sequence cursor
  • reuse one MotionDoc reconciliation policy for live terminals and durable status recovery
  • auto-apply a completed detached result only when the current deck still matches the run base; otherwise retain the result for the existing Apply agent result / Keep mine choice
  • persist nonterminal cursors only after editor event handling succeeds, and preserve the cursor while rechecking the same active run
  • replace the destructive native confirm with a focus-managed Radix AlertDialog
  • extend Playwright coverage for replay expiry, automatic recovery, manual-edit protection, and both reset-dialog choices

Why

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

  • clean npm ci
  • npm run test:agent (7 passed)
  • npx tsc --noEmit
  • npm run lint (0 errors; 11 existing warnings)
  • npm run test:agent:e2e (3 browser scenarios passed)
  • feature-enabled production build
  • independent browser check: meaningful page and agent panel, no error overlay, no captured console errors

npm audit --omit=dev remains unchanged at the existing Next/Geist PostCSS advisory (3 moderate); pinned Radix AlertDialog adds no new production finding.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@roackb2 roackb2 merged commit b79a493 into codex/agent-lifecycle-browser-regression Jul 12, 2026
1 check 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