Commit Graph
1 Commits
Author SHA1 Message Date
Brennan Benson 526120687d feat(agent-status): add an order-independent title evidence parser (#16148)
* feat(agent-status): add an order-independent title evidence parser

The chain this will replace is a first-match-wins scan of substring predicates, so its answer
is decided by list position rather than by how strong the evidence is. Four real recorded Grok
panes read as Codex today because Codex is checked first and their task text mentions it.
Reordering cannot fix that: whichever branch is hoisted, some other pair breaks.

collectAgentTitleEvidence collects every signal first and ranks by class afterwards:

  vendor marker  — a sigil or control sequence the agent itself emits; task text cannot forge it
  anchored name  — a name where a grammar reserves the position for identity (Orca's `- <agent>`
                   owner suffix, or the whole undecorated remainder)
  free-text name — a name anywhere else

Anchored beats vendor marker, so `✳ agy` is Antigravity rather than Claude. Free text never
beats either, and never becomes identity on its own even as the only name present — an absent
icon is recoverable, a confidently wrong one is not. Conflicts within a class resolve to null.

No consumer imports this yet. Swapping getAgentLabel in place would move ~20 call sites at
once; each migrates behind the resolver, with its own evidence.

Measured against the live recorded-title corpus (747 distinct titles), 598 agree with the
current chain and 149 differ:

  144  claude -> null   spinner-only titles. Braille and quarter-circle frames are emitted by
                        many agents, so they prove the pane is busy and nothing about who it
                        is. These are answered by stronger signals once the resolver lands,
                        which is why the parser is not wired up on its own.
    4  codex  -> grok   the misattributed Grok panes, fixed.
    1  codex  -> null   a spinner-prefixed Claude pane whose task text names Codex.

Three parser defects were found and fixed by reviewing that delta rather than reasoning about
it: the OpenCode envelope was treated as a vetoable marker instead of an owning grammar, free
text was allowed to veto a vendor marker (which blinded 13 real Claude titles), and the owner
suffix matched the tail of a hyphenated worktree name (`review-14600-codex`).

* fix(agent-status): harden title evidence collection

* fix(agent-status): limit emitted display evidence

* fix(agent-status): anchor explicit title evidence

* test(agent-status): cover anchored token filtering

* fix(agent-status): complete explicit marker evidence

* fix(agent-status): recognize reserved owner ids

* fix(agent-status): reject cwd path titles

* fix(agent-status): avoid bare-name identity guesses

* fix(agent-status): require spinner for working labels

* fix(agent-status): honor opted-out synthetic profiles

* fix(agent-status): harden wrapper evidence boundaries
2026-08-24 13:12:10 -07:00