Skip to content

LOCAL: revert the fork's agent-resume changes (optional revert) - #33

Closed
kiwidream wants to merge 1 commit into
swaplabs/mainfrom
fork/remove-resume-chain
Closed

kiwidream wants to merge 1 commit into
swaplabs/mainfrom
fork/remove-resume-chain

Conversation

@kiwidream

@kiwidream kiwidream commented Oct 1, 2026 •

Copy link
Copy Markdown
Files Added Deleted Net
Test 46 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​71 $\color{#cf222e}{\Huge{\mathbf{−}}}$​5503 $\color{#cf222e}{\Huge{\mathbf{−}}}$​5432
Prod 88 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​228 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3067 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2839

Optional revert. This removes a feature on purpose. Merge it only if we agree the fork's agent-resume work costs more stability than it buys.

ELI5

The fork added its own way of bringing agent sessions back after a restart or a lost terminal. It has been making terminals less stable. This PR takes all of that out, so on this point the fork behaves exactly like upstream Orca again.

What Changed

Before: after a host restart, the fork tried to start each pane's agent session again by itself. If it found more than one session that could belong to a pane, it showed a "Which session should this terminal resume?" prompt. A paired host also restarted a pane's agent when the pane's terminal was lost. Along the way, the fork changed how agent hook events, sleeping session records and session ownership are kept and routed.

After: none of that exists. Restoring agent sessions works exactly as it does upstream, and the session prompt is gone.

This undoes six fork PRs: #1 (keep a pane's resume record), #5 (connection-id host routing for those records), #6 (auto-resume after a host restart, with the session prompt), #9 (resume owner type and the prompt's strings), #11 (start resume only on keystrokes) and #30 (host-side resume after terminal loss).

How:

  • Every file that only those PRs touched now matches upstream d2dbe2c385, the upstream commit this branch was last synced to: 80 files restored and 48 files the resume work added deleted.
  • The six locale files are the only overlap with other fork work. There, only the AgentResumeChooser strings are removed. The updater, release-source and titlebar strings stay.
  • Nothing outside the resume work changes. After this PR, every remaining difference from upstream comes from a LOCAL: updater/CI/titlebar commit, or from the unreachable-host (fix(repos): a project on an unreachable host can still leave Orca #3), remote-worker nesting (fix(sidebar): nest a delegated remote worker under its coordinator #4) and mobile test commits.

Why

The resume work has been the fork's main source of terminal instability, and it is the biggest merge burden in the daily upstream syncs. The open sync (#32) is blocked on exactly this code: upstream stablyai#23947 changes server-cleanup.ts and the relay's agent-hook-server.ts in ways that clash with the fork's resume rules. This PR puts both files back to upstream.

I restored files to upstream instead of running git revert on each merge. Later upstream syncs rewrote the code around the resume changes, so plain reverts conflict (#11's revert already conflicts in direct-ssh-retry-status.ts). Restoring the upstream file gives exactly "no fork changes here". It is also easy to check: every changed file is either identical to upstream d2dbe2c385 or one of the six locale files.

Mixed versions: an older fork relay may still send the "user ended this Claude session" notice. A host built from this branch rejects it when it validates the payload and never applies it, which is how that notice was designed to fail.

Linked Issue

None. This is a fork-only change with no upstream issue.

Visual Proof

N/A. No new UI. The only visible change is that the resume prompt stops appearing. It only showed after a host restart with more than one candidate session, so no before/after was captured.

Testing

Linux only (minidev).

  • pnpm tc projects (node, web, cli): pass. tsconfig.e2e.json still reports type errors, but only in files that are byte-identical to upstream. It is not part of pnpm tc.

  • Unit tests: every changed test file plus every test that imports a changed file, 603 files: 602 passed, 1 skipped (7379 tests passed, 11 skipped).

  • verify:localization-catalogs, verify:localization-extraction, verify:localization-coverage, verify:rpc-params-catalog, check:max-lines-ratchet, check:dead-classes: pass.

  • oxlint and oxfmt --check on every changed file: clean.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

No new tests. The removed tests covered removed code, and the restored files bring back upstream's own tests.

AI Disclosure

Prepared with Claude Code (Claude Opus 5.5).

Review

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Removes the fork's agent-resume work: fork PRs #1, #5, #6, #9, #11 and
#30. Every file only those PRs touched is restored to upstream
d2dbe2c, the upstream commit this branch was last synced to, and
the files they added are deleted. In the six locale files, which also
carry other fork strings, only the AgentResumeChooser block is removed.

Files are restored rather than each merge reverted because later
upstream syncs rewrote the code around the resume changes, so plain
reverts conflict.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kiwidream kiwidream added the optional revert Removes fork work on purpose; merge only if we decide to drop it label Oct 1, 2026
@tenki-reviewer

tenki-reviewer Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Review complete. No blocking issues — approved ✅; 1 nitpick below.

🧹 Nitpicks (1) — 🟢 1 low
  • 🟢 Wire pruneSleepingAgentSessions to a production caller (agent-status-recovery-actions.ts:141) — pruneSleepingAgentSessions is added to the slice contract and implemented in agent-status-recovery-actions.ts:141, but no production code dispatches it — only the new unit test does.

This PR reverts the fork's agent-resume-after-terminal-loss changes, cleanly removing the resume chooser, relay user-ended-session signaling, and related state plumbing across 134 files.

Reviewed commit: e6fe271

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-01T15:43:06.607625Z e6fe271 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: e6fe271b4f

ℹ️ 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".

Comment on lines 101 to +104
existing &&
existing.tabs.length > 0 &&
options.force !== true &&
options.onlyRuntimeOwnedTerminals !== true &&
!completesRuntimeOnlySnapshot
options.onlyRuntimeOwnedTerminals !== true

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Do not skip full hydration after a runtime-only snapshot

When a fresh headless host first handles a list or subscribe request, the runtime-only hydrate can create a nonempty snapshot containing only serve/SSH-owned tabs. This condition then makes the subsequent full hydrate return early, so other persisted client-created panes never appear; activating one fails with tab_not_found and may cause the client to retire the pane. The removed runtimeOnlyHydratedWorktreeIds distinction is still required even without agent auto-resume so the first request's ordering does not determine which persisted tabs survive restoration.

Useful? React with 👍 / 👎.

const previousIncarnationId = authoritativePtyIncarnationId
rebindRemoteTerminalHandle(update.terminalHandle, update.incarnationId)
announceProcessReplacement(previousIncarnationId, update.incarnationId)
rebindRemoteTerminalHandle(update.terminalHandle)

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 Reset terminal modes when rebinding to a new process incarnation

When a remote host replaces a lost PTY process, this path keeps the existing xterm instance but now discards the published incarnation ID and rebinds without notifying the output callbacks. Modes armed by the dead TUI—such as mouse reporting, focus reporting, and bracketed paste—therefore remain active in the replacement shell, causing ordinary input and mouse activity to arrive as escape sequences. Process replacement remains a generic transport recovery path after agent auto-resume is removed, so preserve the incarnation comparison and mode reset while still allowing a re-minted handle for the same process to retain its modes.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

optional revert Removes fork work on purpose; merge only if we decide to drop it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant