Skip to content

Restore process-table agent identity via OSC 133-triggered foreground reads - #7189

Merged
brennanb2025 merged 1 commit into
brennanb2025/codex-icon-running-agentfrom
brennanb2025/pane-foreground-agent-tracker
Jul 3, 2026
Merged

brennanb2025 merged 1 commit into
brennanb2025/codex-icon-running-agentfrom
brennanb2025/pane-foreground-agent-tracker

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Stacked on #7059. Restores the one capability the probe removal genuinely lost — process-table identity for agents that emit neither hooks nor titles (aider/goose-class, manual launches) — without resurrecting the parallel per-tab probe pipeline that #7059 was directed to remove.

Process identity is now a producer into the shared store, read at OSC 133 command boundaries, and consumed by the same tab-icon resolver that layers hook/title/launch evidence. One identity hub; no per-tab probe state machine, no retry ladders, no per-title-frame RPCs.

How it works

  • Trigger: terminal-command-lifecycle (the existing OSC 133 parser riding on data xterm already parses — zero new stream scanning) now also surfaces 133;C (command started). That is exactly the moment a pane's foreground changes.
  • Read: on C, a new pane-foreground-agent-tracker waits a short settle (350ms), reads getForegroundProcess once (the still-alive daemon RPC with shell/helper→agent ancestry resolution), and maps it through the shared recognizeAgentProcess (covers all TUI_AGENT_CONFIG agents). If the read still sees an interpreter wrapper (node/python), one bounded re-read (1.2s) — not a retry ladder.
  • Clear: on 133;D, the tracker marks shell-foreground with no RPC at all — D itself proves the foreground command exited back to the prompt. A new C immediately clears that mark (the foreground left the prompt), closing the stale-evidence window.
  • Store: paneForegroundAgentByPaneKey (new slice) — pane-keyed { agent, shellForeground }, cleaned up at the existing pane-close and PTY-exit teardown sites.
  • Consumption: the tab resolver ranks process identity below live hook rows, above titles/launch bootstrap, and resolveLaunchedAgentExitEvidence treats the shell-foreground mark as title-independent exit evidence — a TUI that dies without restoring its title no longer keeps painting the tab. A recognized foreground process also arms exit clearing (hasObservedAgentSignal) for launched agents with no hook/title integration.

Scope guards

What this fixes (vs #7059 alone)

  • Manual aider/goose/etc. in a plain terminal tab: correct icon while running (was: no icon).
  • Orca-launched hookless agents: launch icon clears on exit via process evidence (was: stale forever).
  • Launched agents that die leaving a stuck title: exit now proven by 133;D instead of title heuristics.

Deferred

  • Sidebar rows for process-only agents (they have no state machine; today's sidebar never showed them, so no regression) — possible follow-up if we want full surface parity for hookless agents.
  • Serve-mode/headless hosts have no renderer to run the tracker; same coverage boundary as the pre-Unify tab agent identity with the agent-status pipeline #7059 probe.

Checks

  • pnpm exec vitest run over pane-foreground-agent-tracker.test.ts (8), use-tab-agent-process-signals.test.ts (7), plus the full terminal-pane/, use-tab-agent, tab-agent, diffComments suites — 1526 tests passed
  • Regression pins: read only on C (settle + single wrapper re-read), D publishes shell-foreground with zero RPCs, remote/ssh ids never read or publish, stale reads dropped on supersede, dispose cancels; resolver ranks hooks > process > title > launch; shell-foreground clears launch despite a stale agent title; shell-foreground before any agent activity does not clear.
  • pnpm run typecheck — passed
  • pnpm run lint — passed

Made with Orca 🐋

… reads

Adds a pane foreground-agent tracker that reads the foreground process
once when a command starts (OSC 133;C) and marks shell-foreground on
command finish (133;D, no RPC), publishing into a pane-keyed store slice.
The tab resolver ranks this process identity below live hook rows and
above titles, and treats the shell-foreground mark as title-independent
launched-agent exit evidence. Local panes only; remote/SSH panes are
untouched. Covers agents that emit neither hooks nor titles — the
regression left by removing the foreground probe in #7059.

Co-authored-by: Orca <help@stably.ai>
@brennanb2025
brennanb2025 merged commit b1f5419 into brennanb2025/codex-icon-running-agent Jul 3, 2026
3 checks passed
@brennanb2025
brennanb2025 deleted the brennanb2025/pane-foreground-agent-tracker branch July 3, 2026 20:45
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