Repository navigation
Conversation
…30 minutes (STA-7370) A Codex pane idles under a plain title with a restored idle terminal status. Once its hook row left the 30-minute live window, session.tabs dropped the status and the provider session with it, so phone chat showed an empty new-chat screen. Publish the same identity-only done status (agent + session) instead.
📝 Walkthrough
Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: 🔵 Low · up to
|
…Codex was typed into (STA-7370)
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟡 Minor · Exclude completed status rows from move… · runtime-mobile-agent-status-builder.ts:176-204
src/main/runtime/runtime-mobile-agent-status-builder.ts:176-204
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winExclude completed status rows from move candidates.
runningAgentsOnlystill scansagentStatusByPaneKeywithout checkingentry.state. The new fallback publishes a resumable Codex session asagentType: 'codex'withstate: 'done', so it can create a history candidate and expose “Resume in New Native Chat” after the remaining gates pass. Keep the completed row for transcript resolution, but exclude it from move candidates.Suggested fix
for (const [paneKey, entry] of Object.entries(state.agentStatusByPaneKey)) { + if (runningAgentsOnly && entry.state === 'done') continue registerCandidate(paneKey, entry) }
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
420d064f-70ef-4e34-b373-ec540fb46dbf
📒 Files selected for processing: 1
src/main/runtime/codex-stale-session-mobile-chat-identity.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
|
Closing because #31460 covers the neutral-title Codex chat-identity objective while preserving newer activity and shell-ownership rules. Current main retains the provider-session address for neutral Codex titles, including identity-only rows after live hook evidence expires. Its integration tests cover completed turns, identity-only addresses, explicit OSC 7501 Working under neutral titles, and retirement when the shell reclaims the pane. Provider identity survives without overriding valid current program activity. This PR's remaining differences force Done after rejecting live signals even when PTY activity still reports Working/Permission, and retain identity under actual shell titles. Those policies conflict with the current activity/ownership contract. Its stale-working test directly mutates internal PTY state after completion; that alone does not establish a reachable current regression. I reviewed the full two-file patch at |
ELI5
On the phone, a Codex chat that finished more than about 30 minutes ago opened as an empty "Start a chat with Codex" screen, even though the conversation was still there in the terminal. The server had stopped telling the phone which Codex conversation the pane belongs to. Now it keeps telling it.
What Changed
Before: Open a Codex pane on the phone after its last reply is over ~30 minutes old (for example after restarting the phone app). Chat view shows "Start a chat with Codex" with no history. A recent Codex chat, or any Claude chat, looks fine. Sending a new message brings the history back until it goes stale again.
After: The phone gets the Codex conversation's session ID no matter how old the last turn is, so chat view loads the history. The pane shows as finished, which is what it already showed during the first 30 minutes.
Mechanism: The phone finds a chat's history through
agentStatus.providerSessionon eachsession.tabsterminal tab. The server builds that status inbuildRuntimeMobileAgentStatus. When a pane's current title is not an agent title, that function returns no status at all unless there is a fresh hook signal, so it can't bring back a stuck spinner after the shell takes over (#1437).Codex goes idle under a plain
<task> | <cwd>title (see the capturedcodex-0-158-0-timed-turnfixture). On top of that, the runtime deliberately sets the PTY's status back toidlewhen Codex's last spinner clears after its done hook (terminal-agent-status-and-submission.ts, the Codex-onlyconfirmedStatusbranch). That combination is plain title plus a PTY status, which doesn't qualify for the existing hook-only exemption. So once the hook row aged out of the 30-minute live window, the function returned{}and the session ID went with it. The session ID is kept in the hook store with no time limit, but nothing published it. Claude isn't affected because it never goes through that Codex idle-restore path.The fix: when that branch would return nothing but the pane's hook row still has a provider session, publish the existing identity-only fallback instead. That means agent type plus session, with the state forced to
done, while skipping the live row and the PTY's working/blocked state.Why
orca serve, or the SSH host's managed server) updates. No phone change is needed.done. A staleworking/permissionPTY status under a plain title cannot become a spinner (there's a test for this). That rules out the simpler alternative of just loosening the!pty?.lastAgentStatuscheck: that would have fallen through and publishedworking.Linked Issue
Fixes #20408 (Linear STA-7370)
Visual Proof
N/A. This is a server-side status projection fix, checked with runtime tests. It was not tried on a real phone (see Testing).
Testing
New
src/main/runtime/codex-stale-session-mobile-chat-identity.test.tsruns a realAgentHookServerthat receives Codex hook POSTs (SessionStart, UserPromptSubmit, PreToolUse, Stop) and a runtime that receives Codex's captured title sequence. It then lists mobile session tabs:agentStatus), passes afterworkingunder the plain title: published asdone, neverworkingsrc/main/runtime/orca-runtime.test.ts(1434 runtime specs, including all mobile-session-tabs and agent-status specs), hook projection, builder, title-truthfulness, ordering, permission-renewal, row-selection and Codex readiness transcript tests: all pass.pnpm tc:node, oxlint, oxfmt, andcheck:code-quality:changedall pass.Not done: no manual check on a real phone against a real
orca serve/ Codex install. The repro is a test harness built from the reported symptom (session.tabs.listwithlaunchAgent: "codex"and noagentStatus).I manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
Agent skill upstream boundary
Notes
Cross-platform: no platform-specific code. SSH: the builder runs on whichever host executes the terminal (local runtime or the SSH host's managed server), so SSH panes get the same fix once that host updates. Folder workspaces: not touched by the change. Performance: no new lookups. It reuses the hook row this function already read.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)