Repository navigation
fix(mobile): preserve Claude chat after renaming its pane - #31358
Conversation
Distinguish a manual title override from a later shell OSC title, keeping transcript identity and live hook selection while preserving exit retirement. Co-authored-by: Wooseong Kim <[email protected]>
📝 Walkthrough
Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: 🔵 Low · up to
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
c4fdd6cf-6c58-4cad-8b85-2dc9f0114b31
📒 Files selected for processing: 3
src/main/runtime/orca-runtime-hook-agent-status-projection.test.tssrc/main/runtime/runtime-mobile-agent-status-builder.test.tssrc/main/runtime/runtime-mobile-agent-status-builder.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.
| const titleOmitsAgent = ptyTitle !== null && ptyTitleClassification !== 'agent' | ||
| const oscTitle = pty?.lastOscTitle ?? leaf?.lastOscTitle ?? null | ||
| // Why: a manual rename is not the shell reclaiming the pane, so the hook session stays addressable (#20626). | ||
| const manualTitleOverridesAgentOsc = | ||
| titleOmitsAgent && ptyTitle !== oscTitle && classifyAgentTitle(oscTitle) === 'agent' | ||
| const nonAgentTitle = titleOmitsAgent && !manualTitleOverridesAgentOsc |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
# Find writers of pty.title / leaf.paneTitle to confirm only rename or OSC paths set them.
rg -nP --type=ts -C3 '\b(title|paneTitle)\s*=' src/main/runtime --glob '!**/*.test.ts' | head -150
rg -nP --type=ts -C3 'getLatestAgentCandidateTitle' src/main/runtime --glob '!**/*.test.ts'Repository: stablyai/orca
Length of output: 26087
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- builder ---'
nl -ba src/main/runtime/runtime-mobile-agent-status-builder.ts | sed -n '1,125p'
printf '%s\n' '--- title projection ---'
nl -ba src/main/runtime/runtime-worktree-status-projection.ts | sed -n '1,250p'
printf '%s\n' '--- pty title writers and helper references ---'
rg -n -F --glob '*.ts' -e 'pty.title =' -e 'leaf.paneTitle =' -e 'setPtyManagementTitleFromObservedTitle' -e 'lastOscTitle =' -e 'paneTitle =' src/main/runtime
printf '%s\n' '--- rename references ---'
rg -n -F --glob '*.ts' -e 'terminal rename' -e 'renameTerminal' -e 'renamePty' -e 'rename' src/main/runtime/terminal src/main/runtime | head -240Repository: stablyai/orca
Length of output: 41988
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- manual rename implementation ---'
nl -ba src/main/runtime/workspaces/workspace-removal-target.ts | sed -n '215,285p'
printf '%s\n' '--- identity restore/title state ---'
nl -ba src/main/runtime/terminal/identity/pty-worktree-record.ts | sed -n '80,215p'
printf '%s\n' '--- OSC observation ---'
nl -ba src/main/runtime/terminal/output/terminal-title-observation.ts | sed -n '90,225p'
printf '%s\n' '--- hydration ---'
nl -ba src/main/runtime/terminal/output/headless-terminal-hydration.ts | sed -n '120,175p'
printf '%s\n' '--- launch title path ---'
nl -ba src/main/runtime/terminal/launch/terminal-create.ts | sed -n '215,265p'
printf '%s\n' '--- observation sequence and title fields ---'
rg -n -F --glob '*.ts' -e 'nextTitleObservationSequence' -e 'titleUpdatedAt' -e 'lastOscTitleAt' src/main/runtime/terminal src/main/runtime/workspaces | head -240Repository: stablyai/orca
Length of output: 27163
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- recordPtyWorktree declaration ---'
rg -n -F --glob '*.ts' 'recordPtyWorktree' src/main/runtime
printf '%s\n' '--- callers and state.title construction ---'
rg -n -F --glob '*.ts' -e 'title: ' -e 'title =' -e 'recordPtyWorktree(' src/main/runtime | grep -E 'recordPtyWorktree|title' | head -300
printf '%s\n' '--- owning declaration context ---'
nl -ba src/main/runtime/terminal/identity/pty-worktree-record.ts | sed -n '1,135p'Repository: stablyai/orca
Length of output: 41923
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- controller inventory caller ---'
nl -ba src/main/runtime/terminal/lifecycle/pty-controller-inventory-refresh.ts | sed -n '185,225p'
printf '%s\n' '--- output ingestion caller ---'
nl -ba src/main/runtime/terminal/output/pty-output-ingestion.ts | sed -n '160,195p'
printf '%s\n' '--- lifecycle registration caller ---'
nl -ba src/main/runtime/terminal/lifecycle/pty-registration.ts | sed -n '80,115p'
printf '%s\n' '--- terminal create dedup caller ---'
nl -ba src/main/runtime/terminal/launch/terminal-create-deduplication.ts | sed -n '90,120p'
printf '%s\n' '--- inventory title semantics ---'
rg -n -F --glob '*.ts' -e 'listProcesses' -e 'title: session.title' -e 'session.title' src/main/runtime/terminal src/main/runtime | head -180Repository: stablyai/orca
Length of output: 29620
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- PTY process contract ---'
rg -n -F --glob '*.ts' -e 'export type PtyProcessInfo' -e 'interface PtyProcessInfo' -e 'type PtyProcessInfo' src shared
printf '%s\n' '--- process contract context ---'
rg -n -F --glob '*.ts' 'PtyProcessInfo' src/main/runtime | head -80
printf '%s\n' '--- deduplication function ---'
nl -ba src/main/runtime/terminal/launch/terminal-create-deduplication.ts | sed -n '1,145p'
printf '%s\n' '--- controllerTitle consumers ---'
rg -n -F --glob '*.ts' 'controllerTitle' src/main/runtimeRepository: stablyai/orca
Length of output: 303
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- PTY process contract ---'
nl -ba src/main/providers/pty-process-info.ts | sed -n '1,100p'
printf '%s\n' '--- deduplication function ---'
nl -ba src/main/runtime/terminal/launch/terminal-create-deduplication.ts | sed -n '1,145p'
printf '%s\n' '--- controllerTitle consumers ---'
rg -n -F --glob '*.ts' 'controllerTitle' src/main/runtime || test "$?" -eq 1Repository: stablyai/orca
Length of output: 10059
Track manual-rename provenance separately.
reconcileRemoteTerminalCreate passes the provider's session.title to recordPtyWorktree. For an existing PTY, that overwrites pty.title without changing lastOscTitle. If session.title is a shell title after an agent OSC title, manualTitleOverridesAgentOsc becomes true even though no manual rename occurred. The builder can then retain stale agent status instead of applying non-agent-title suppression.
Use an explicit manual-rename marker, or keep adoption titles out of this comparison, and add a regression test for this sequence.
Problem
Renaming a Claude terminal pane to a normal label makes mobile chat lose its transcript address, even though the same agent and conversation are still running.
ELI5
Changing a pane's name should work like changing a folder label: its conversation stays inside. Orca now checks the title the running program last reported before deciding the shell has taken the pane back.
Changes
Validation
agentStatusdisappears.Release review. Captures visually reviewed.Community credit
Adapted from #22865 by @innocarpe (Wooseong Kim), credited with
Co-authored-by: Wooseong Kim <[email protected]>in the implementation commit. This revision also applies the same distinction to live and restored hook rows.Fixes #20626
Native proof
Before: renaming the live pane drops conversation identity and returns to terminal view.
(screenshot removed: contained real product data)
After: the same manual title retains the conversation and readable transcript.
(screenshot removed: contained real product data)