Repository navigation
Conversation
|
Rebase status: HARD (draft, not pushed) — conflicts with latest |
Rebase status (2026-07-22)Attempted restack onto current Leaving draft until base PRs (#8872 close-intent, #9415 unknown-busy) land, then restack. Not closing — work is still intended, just blocked on a clean base. |
5efce1e to
049d174
Compare
Restack onto rebased #9434 tipCherry-picked the two unique commits onto the rebased
New head: Conflicts in |
049d174 to
6a5eaef
Compare
Restack noteRebased onto rebased #9434 tip (force-with-lease). Stack base commits match #9434.
Tests: foreground-process-resolution + TerminalTabLeadingIcon — 12 passed. Depends on #9434 landing first (or merge as stacked head including #9434 commits). |
6a5eaef to
a24adc3
Compare
Restack + review guide (community, awaiting maintainer)Draft. Restacked onto rebased #9434 tip (force-with-lease). Stack base matches #9434. +2 unique commits (11 total including #9415+#9434). Unique vs main
Stack / depends
Tests (local)
Community author cannot merge. Leave draft until base of stack is reviewed. |
55ab9a6 to
c683e3b
Compare
2b1e29a to
ff906f8
Compare
…-status gate A confirmed foreground that is neither a shell nor a recognized agent (wrapper/fork agent binaries) previously counted as "shell only", which suppressed fresh hook state and reported the pane idle. Only a confirmed real shell (or an unavailable confirmation, matching the fail-closed catch path) may now suppress explicit hook status.
…L + revalidation Hook 'working' statuses were the only wake evidence, so wrapper-launched or manually-run recognized agents (resolved by the existing foreground scans) let the machine sleep mid-run. The runtime now reports each completed scan's recognized-agent-or-null result; AgentAwakeService holds wake eligibility per PTY while that evidence is fresh (5 min TTL), renews it at expiry via a cache-only revalidation callback (never a new scan, 2h hard cap), and drops it on a null report or PTY stop. Arbitrary non-shell processes never grant wake. No new scans or cadences are added.
…rocess identity Wrapper-launched claude (a shell function exec'ing the real binary) emits Claude activity titles without the literal 'claude' token, so the row builder and worktree ring rejected the pane as unattributable — invisible while working. The paneForegroundAgent slice already resolves the recognized foreground process; surface it as identity attribution: - Slice entries now carry observedAt (stamped centrally) and the publishing PTY; resolveFreshPaneForegroundAgent gates consumers on a 30s TTL plus pane/tab PTY liveness so stale evidence after agent exit cannot fake a working state. The completion coordinator's existing inspections re-arm the observation (no new scans, no new cadence). - resolveTitleDerivedAgentType/resolveAgentTypeFromTerminalTitle accept the process agent so a token-less Claude title yields a Claude row and an attributable working ring. State still comes from title activity or hooks; process identity alone never invents 'working'. Hook rows keep precedence. - worktree-agent-activity-summary narrows the slice per worktree with stable references; card status, agent rows, and section activity consume it.
…to PTY, expire attribution on wall clock Review fixes for the busy/visibility PR: - agent-awake-foreground-evidence: enforce the 2h reportedAt cap unconditionally in pruneAndCount and align boundary comparisons with nextExpiry, so a stale timer firing at the cap (or exactly at the TTL) can no longer keep the power-save blocker held forever with no timer rescheduled. New test drives revalidation-renewed evidence to the cap and asserts the blocker stops with no timer left. - onForegroundAgentInspected now carries the PTY the inspection ran against; pty-connection only accepts it while the pane still owns that PTY, and refreshPaneForegroundAgentObservation stamps it on created entries and rebinds (identity-only) evidence held for a previous PTY instead of keeping it fresh across a respawn. - new usePaneForegroundAgentEvidenceExpiryTick schedules a one-shot re-render at the earliest evidence expiry for the worktree ring and agent rows, so a past-TTL working ring/row drops without unrelated store churn. - restore the Claude-glyph regression fixture alongside the braille variant (it.each) in worktree-title-derived-agent-rows.test. - update terminal-pane-detach-agent-identity.test for the central observedAt stamping introduced by this branch (was failing).
Known launch agents skip runtime foreground probes, so feed existing renderer inspections into runtime identity and wake evidence. Keep the review-driven rationale comments concise.
UNION rebase kept PR's ptyId stamping on setPaneForegroundAgent publishes; two main-era expectations lagged. Align them with the PR field and nearby tests. Cosmetic indent fix on the revoke path.
…ble image
Foreground-process recognition collapsed unrecognized live processes to
the shell fallback, so an argv0-renamed real binary or a native fork at a
non-standard path (e.g. ~/.local/bin/grok) was never identified.
Add a lazy executable-image evidence pass that runs ONLY for still-
unrecognized non-shell foreground ('+') candidates: resolve the real
executable (Linux /proc/PID/exe, macOS lsof -d txt, Windows the already-
captured CIM ExecutablePath) and re-run agent recognition on its basename.
Per-PID cached behind a short TTL; no extra ps scan, so both ps-scan-volume
guards stay green. Interpreter forks resolve to node/python and stay
unrecognized (script CLIs remain covered by argv/entrypoint recognition).
On SSH, orca-runtime had no way to confirm a foreground read, so it trusted a possibly-stale relay getForegroundProcess result (an idle-looking shell that still fronts a live agent). Add pty.confirmForegroundProcess: the relay handler forces a fresh post-boundary process-table scan (new fresh option threaded through getForegroundProcessName), and SshPtyProvider.confirmForegroundProcess requests it. Old-relay tolerant: a missing method (JSON-RPC -32601) is feature-detected and latched, degrading to today's trusting getForegroundProcess read instead of erroring.
…cognition Executable-image evidence recognized a renamed binary by its basename alone (recognizeAgentProcess on the resolved path), bypassing the command-line recognizer's guards: the headless one-shot filter and the generic `orca` vs `orca claude-teams` subcommand rule. A renamed `claude --print` or a bare `orca` was therefore mislabeled as an interactive agent. Recognize the resolved image WITH the process's original arguments: substitute the real executable as argv0 and re-run recognizeAgentProcessFromCommandLine so those guards still apply. Applies to the POSIX (local + relay) and Windows ExecutablePath paths. Also corrects the per-PID cache comment: a recycled/exec'd PID can be briefly mislabeled (stale path is re-recognized), not merely missed. Adds headless, generic-orca, and genuine-claude-teams recognition tests plus a Windows generic-orca ExecutablePath negative test.
Adversarial review found two defects in executable-image recognition:
- recognizeAgentFromExecutableImage stripped the original argv0 by the
first whitespace, which breaks a quoted path with an internal space
(Windows "C:\Program Files\...\x.exe"): the dangling quote swallowed
following tokens, burying --print (headless one-shot mislabeled as an
interactive agent) or claude-teams (genuine orca launch failed
recognition). Strip argv0 quote-aware instead.
- The per-PID executable-path cache was never evicted; every distinct
non-shell foreground command accumulated an entry forever in a
long-lived daemon. Sweep expired entries once the map crosses a soft
cap so it stays bounded to the active TTL window.
Tests: quoted spaced-path headless/interactive/orca-claude-teams cases,
bounded-cache eviction, and the default Linux readlink('/proc/PID/exe')
reader (success + null-on-failure).
Introduce ForegroundProcessResolution { engine, rawProcessName, isShell }
so an unrecognized live foreground is no longer collapsed to a bare shell.
The deployed-relay wire contract stays string|null; consumers rebuild the
structure locally via resolveForegroundProcess (degrade old-relay strings).
Thread it only along the renderer path: the pane-foreground-agent tracker
publishes rawProcessName on the command-path entry for a live, non-shell,
unrecognized foreground (recognized agents publish their engine; shells need
no raw name). The store slice gains an optional rawProcessName and a new
resolveFreshPaneForegroundRawProcess that reuses stablyai#9415's TTL/PTY freshness
gate (extracted into one shared helper — existing resolveFreshPaneForegroundAgent
behavior unchanged).
…gents
useTabAgent now returns TabAgentIdentity (TuiAgent | { kind: 'unknown-live';
label } | null). After every recognized layer resolves null, the precedence
chain falls through to a neutral live identity when the pane's fresh
(TTL/PTY-gated, local-only) foreground reports a non-shell rawProcessName AND
the title shows agent activity (spinner/working via detectAgentStatusFromTitle).
The title-activity gate is what separates a fork agent from a full-screen text
editor: vim/htop set static titles that classify to no activity, so they never
gain agent presence.
TerminalTabLeadingIcon and the SortableTab drag overlay render it with the
neutral lucide Terminal glyph and the raw process name as tooltip — never a
vendor logo. No sidebar row, no worktree ring, no busy/keep-awake change (those
read the recognized-agent field, null here), no persistence.
ff906f8 to
97fd37e
Compare
|
Closing as part of fork PR backlog cleanup. This draft is long-conflicted (DIRTY) against current |
Structured foreground result + neutral unknown-alive presence
Part of #9414. Stacked on the
structured-foreground-resolutionbranch — reviewthe commits after its tip (base:
orca/structured-foreground-resolution).Problem
When a pane's foreground process is a live coding agent that Orca does not
recognize — a renamed or forked binary (a personal
claudefork, a wrappernamed
my-agent, etc.) — the tab-icon resolver collapsed it to a bare shell.The scan result reaching the renderer was "recognized
TuiAgentornull", soan unrecognized-but-alive foreground was indistinguishable from an empty prompt.
The pane looked idle even while the fork agent was actively working.
The parent branch (server-side recognition of renamed binaries) deliberately
deferred two pieces that only make sense together — the type ships with its
consumer, so neither is speculative plumbing:
the recognized-or-null engine, and
Design (the two parts, shipped together)
1. Structured foreground result. New concretely-named shared module
src/shared/foreground-process-resolution.tsexportsForegroundProcessResolution { engine: TuiAgent | null; rawProcessName: string | null; isShell: boolean }andresolveForegroundProcess(name). The deployed-relaywire contract stays
string | null(parent-branch decision); every consumer thatonly has the legacy string rebuilds the structure locally via
resolveForegroundProcess— i.e.{ engine: recognize(...), rawProcessName, isShell: isShellProcess(...) }. The path is threaded only where the consumerneeds it:
pane-foreground-agent-tracker.tspublishesrawProcessNameon the one entrythe consumer reads — the command-path publish for a live, non-shell,
unrecognized foreground. Recognized agents still publish their engine; shells
carry no raw name (the consumer rejects them). No daemon cache rework.
pane-foreground-agentstore slice: entries gain an optionalrawProcessName, and a newresolveFreshPaneForegroundRawProcessreusesfix(agents): keep-awake + sidebar attribution from foreground process evidence #9415's exact TTL + PTY-binding freshness gate (extracted into one shared
helper, so the existing
resolveFreshPaneForegroundAgentbehavior is byte-for-byte unchanged).
2. Neutral unknown-alive presence.
use-tab-agent.tsgains an additivereturn type
TabAgentIdentity = TuiAgent | { kind: 'unknown-live'; label: string } | null. After every existing recognized layer resolves null, the precedencechain falls through to an unknown-live identity only when the pane's fresh
(TTL/PTY-gated, local-only) foreground reports a non-shell
rawProcessNameand the title shows agent activity (spinner/working/needs-input via the
existing
detectAgentStatusFromTitleclassification). The label is the rawprocess name — never a fake
TuiAgent, never a vendor name.The vim/htop boundary. The title-activity requirement is exactly what
separates a fork agent from a full-screen text editor: vim and htop set static
titles that classify to no activity, so they never gain agent presence. This
is stated in a why-comment and tested at both the resolver and hook levels.
3. UI.
TerminalTabLeadingIconand the SortableTab drag overlay(
TabDragPreview) render the unknown-live identity with an existing neutralglyph — the lucide
Terminalicon (the same generic terminal/process glyph thedrag ghost already uses for plain terminals), with the raw process name as its
tooltip. Recognized agents render exactly as before.
Non-goals (unchanged from #9415/parent)
recognized-agent field (
resolveFreshPaneForegroundAgent), which stays nullfor unknown-live evidence.
an unknown-live entry has
agent: null, so it never holds the machine awake.never written into workspace session persistence.
Cross-platform / SSH / WSL
Unknown-live is strictly local: remote/SSH/WSL panes produce no foreground
process evidence (the tracker excludes non-trackable PTYs), and the hook
short-circuits
isRemoteLike, so remote tabs degrade to their existingtitle/hook identity with no behavior change.
Tests
foreground-process-resolution.test.ts— old-relay string degradation(recognized / unrecognized non-shell / shell / null).
pane-foreground-agent.test.ts— entries carryrawProcessName;resolveFreshPaneForegroundRawProcessfresh/stale/PTY-mismatch/shell/enginegates; existing
resolveFreshPaneForegroundAgenttests stay green untouched.pane-foreground-agent-tracker.test.ts— the persistent-unknown-process publishnow carries the raw name (unknown-live source).
use-tab-agent-process-signals.test.ts— resolver: working title → unknown-live,no activity → null (vim), engine wins; hook: non-shell raw name + working title
→ unknown-live, vim static title → null, shell raw name → null, stale evidence
→ null.
TerminalTabLeadingIcon.test.tsx— unknown-live renders the neutral glyph +raw-name tooltip; recognized provider still wins.
Targeted vitest + typecheck (node/cli/web) + oxlint on touched files all green.
ELI5
When a terminal is running an agent binary Orca does not recognize by name, the tab no longer pretends it is a bare shell. Unknown-but-alive agents get a neutral presence so status and icons stay honest.