Skip to content
v0.14 - Agent Backends

v0.14 - Agent Backends

Backends for the Inspector and Reasoning panes beyond the generic CLI backend, then the observability surface built on the event socket: what a terminal-hosted omp tells us about itself that gPTY does not yet show.

v0.14.0 - Agent Backends

Done Area Item
⬜ AGENT A turn that fails mid-protocol never says what the omp child printed - found 2026-10-31 while closing v0.7.1’s logging item, which moved backend stderr to debug because program output is not log material. OmpProcess::describe_failure appends the bounded StderrTail to a start-up failure, but a turn that fails after the handshake emits AiEvent::Error with the protocol error alone (omp.rs, run_omp_session’s if let Err(error) = result), so the provider error the child wrote to stderr is visible neither in the pane nor in the console. The respawn path makes it worse: a new OmpProcess replaces the old one, so the dying child’s tail - the one that explains the crash - is dropped with it. Fix: freeze the tail per turn (a slice run_omp_session takes before a respawn discards the process) and append it to the turn’s error message when non-empty, in the format describe_failure already uses; test with a fake omp that greets ready, prints an escape-wrapped line to stderr on prompt and exits, asserting the pane’s error carries the stripped text.
⬜ AGENT Inspector / Reasoning follow-ups - host-tools bridge and OpenAI-compatible HTTP still planned. Provider-specific CLI adapters follow the v0.5.2 generic CliBackend lane: documented hooks/extensions only, never token reuse or TUI scraping.

v0.14.1 - Agent Observability

What a terminal-hosted omp publishes about itself, and what gPTY still does not show. Surveyed 2026-11-06 against OMP 18.17.0: 53 public extension events (omp://hooks.md, ~/.omp/.../@oh-my-pi/pi-coding-agent/dist/types/extensibility/extensions/types.d.ts), the versioned RPC surface (omp://rpc.md), and the on-disk session artefacts (JSONL, stats.db, history.db, agent.db). The extension forwards nine event names today; the rows below take the rest of the cheap tap - numbers and lifecycle, never message text - add the two read-only session views, and add one channel back into the TUI. Hosting an omp session in a pane instead is recorded under Future. Three rows below widen the same surface past agents that publish nothing gPTY can authenticate: a manifest-driven Tier 3 for harnesses with no integration, a state subscription for consumers outside the app, and one attention queue for the user.

Done Area Item
⬜ AGENT A turn blocked on an approval or a question still reads as working - AgentState::NeedsAttention exists (crates/gpty-core/src/agent_state.rs) and the Tier 1 path can dispatch it, but nothing emits it: the @gpty/omp-events allowlist forwards session/agent/turn/tool lifecycle only, and omp_events.rs whitelists exactly those nine names plus state.declared, so a turn parked on an approval prompt or on OMP’s ask tool keeps the badge at working for as long as the user takes to notice. OMP publishes both: tool_approval_requested{sessionId,toolCallId,toolName,reason?,approvalMode} and tool_approval_resolved{...,approved} are notification events, and a model-issued question arrives as tool_execution_start with toolName === "ask" (omp://hooks.md, omp://tools/ask.md). Fix: subscribe to the two approval events and to tool_execution_start filtered on ask, forward omp.attention.required{reason:"approval"|"question", tool_name, approval_mode} and omp.attention.cleared, whitelist both in omp_events.rs (bounded tool_name, mode as a small enum), and dispatch NeedsAttention through the existing tracker. An approval resolving must not fabricate Working - it returns the tracker to whatever the last lifecycle event says. Tests: extension test asserting the two forward plus the ask filter, Rust translation tests for the bounds, GUT precedence test (Tier 1 NeedsAttention outranks a Tier 2 idle and clears back to it).
⬜ AGENT A harness with no gPTY integration shows no agent state at all - Tier 1 is the authenticated ompEvent socket, and Tier 2 needs the program itself to emit gpty_state or OSC 7501 (v0.14.2), so every other agent gPTY lists as a guest (claude code, codex, opencode, gemini-cli) reaches only Tier 3: a fixed generic regex/idle/exit heuristic (crates/gpty-core/src/agent_state.rs:1-20) that knows none of their prompts, so a pane parked on “do you want to proceed” reads as idle or working and never needs-attention. Fix: a manifest-driven Tier 3 - one engine, one TOML per agent (region regex and presence rules over the last N screen lines, plus osc_title and osc_progress), manifests shipped for those four harnesses, a user override directory and a reload verb so a new harness is data rather than a release, tuned conservative because a false negative costs nothing and a false positive costs a badge flash. It stays display-only under the Tier 2 guarantee - badge and nothing else, no concepts, actions, layouts or IPC - because screen text and titles are spoofable. Tests: recorded screen fixtures per manifest, a spoof fixture proving a pasted screen changes only the badge, and precedence tests against Tiers 1 and 2. A harness that adopts the generic OSC 7501 channel (v0.14.2) bypasses this lane entirely; the manifests are only for the ones that emit neither.
⬜ AGENT Nothing streams workspace, pane and agent state to a consumer - the control socket is request/response, and the event socket carries omp events under a capability scope (crates/gpty-gdext/src/omp_events.rs), so a consumer outside the app - an orchestrator pane, a status bar, a test harness - has to poll paneStatus and list-panes and diff the results, missing every state that changes and reverts between polls. Fix: a subscribe verb on the control socket streaming typed state changes (pane created, closed, renamed, agent state, badge and unread counters) with a monotonic sequence id and a since cursor over a bounded replay window, capability-scoped like the event socket and additive by construction: no existing method changes, MCP untouched, an older client keeps polling. A consumer that falls behind the window is disconnected with a typed error instead of silently skipping events. Tests: two clients observe one sequence, a reconnect with since replays without gaps inside the window, a denied capability is refused, and a slow consumer is disconnected rather than losing events.
⬜ AGENT Everything waiting on the user is scattered across panes and workspaces - the badge answers “what is this pane doing”, a toast answers “what just happened”, and the v0.9 unread markers answer “what did I miss here”, so with a full grid the user scans it to find the one blocked pane, and a pane on another workspace is invisible. Fix: an Inbox overlay (the existing OverlayPanel keyboard contract) driven by a pure, testable queue model fed by badge and unread state: needs-attention, failed, finished-but-unread, and unread output, oldest-first with jump-to-oldest and next, cleared on activation, Enter focusing the pane and doing nothing on its behalf. Accessibility follows the badge rule - a distinct shape and a word per state, never colour alone. Answering an agent’s approval from the Inbox is orchestration and stays out of core per the architecture boundary; if it ever lands, agent-supplied text is data - fenced, never an instruction - and only the human can answer. Tests: pure-model ordering, dedupe and clear-on-activation, overlay focus return, and an assertion that activation never dispatches an action. A 7501 record’s title/msg (v0.14.2) is the line the queue shows for an agent pane.
⬜ AGENT A pane never shows what its turn cost or how full its context is - both numbers ride seams gPTY already listens on: message_end carries message.usage.{input,output,cacheRead,cacheWrite,totalTokens} and message.usage.cost.total, and ctx.getContextUsage() returns {tokens, contextWindow, percent} (omp://hooks.md notification events; RPC’s get_session_stats is the same data). The extension forwards neither, so a workspace running three omp panes cannot see which one is at 92% of its window, nor what the last hour cost. Fix: on message_end/turn_end, forward a numbers-only omp.usage.turn{cost_micros, input_tokens, output_tokens, cache_read_tokens, context_tokens, context_window, context_percent} - integers only, no message text, so nothing here is program content - whitelist it in omp_events.rs, accumulate per terminal in GDScript (counters are monotonic within a session; session.bound resets them), and render a cost and a context segment in status_bar.gd plus the pane tooltip. Tests: GUT accumulation across turns, reset on rebind, and 0/100 % boundary formatting.
⬜ AGENT A retry storm, a fallback, or a disabled credential looks like a hang - auto_retry_start{attempt,maxAttempts,delayMs,errorMessage}, auto_retry_end{success,attempt,finalError}, retry_fallback_applied{from,to,role}, retry_fallback_succeeded, credential_disabled{provider,disabledCause}, auto_compaction_start{reason,action} and the terminal session_exit{reason,kind} are all notification events; none is forwarded, so a provider 429 with six backoff attempts renders as an agent that stopped talking, and a compaction that eats the window is invisible. Fix: forward them as omp.retry.*, omp.compaction.*, omp.credential.disabled and omp.session.exit (attempt/delay as integers, provider as a capped slug), map auto_retry_start to Working with a source notice, credential_disabled and an errored session_exit to Failed with the cause in the notice, and a clean session_exit to Completed. errorMessage/disabledCause are provider text: they ride the notice and never a log line (AGENTS logging rules), and they would be the first allowlist entries that are provider-authored text, so docs/content/docs/agents/security.md’s observability paragraph is amended in the same commit - bounded, display-only, never persisted. Tests: Rust translation bounds, GUT notice text per mapping.
⬜ AGENT An omp pane keeps the shell’s title, not the session’s - OMP names every session (auto-title, /rename, title_change) and persists it three ways: the fixed 256-byte title record at line 1 of the JSONL, history.db’s session_titles, and the session header’s title/titleSource. gPTY titles the tile from the shell’s OSC 0/2, so four OMP panes read as the same shell path and the user cannot tell which session is which. Fix: forward omp.session.titled{title} - the extension learns the id from ctx.sessionManager.getSessionId() and the directory from ctx.cwd, so the file is ~/.omp/agent/sessions/<encoded-cwd>/<iso>_<session id>.jsonl and its line-1 title record can be read once per binding (cache it; never re-glob per turn) - the extension reads that file locally and forwards only the bounded title, never the path or any other record. An auto-title is a model summary of the user’s own prompt, so the title allowlist entry is added to docs/content/docs/agents/security.md in the same commit (bounded, display-only) - then let TerminalPane apply an agent-supplied title that wins over OSC while the session is bound, is dropped on session.shutdown, and is never written to layout/profile/workspace JSON - the same user-owned-state rule the Reasoning source id follows. Tests: GUT precedence (shell OSC vs bound agent title vs user rename) and the drop-on-shutdown path.
⬜ AGENT Nothing lists the user’s OMP sessions, their cost, or reopens one - “sessions” are files plus three indexes, all readable without touching OMP’s state: ~/.omp/agent/sessions/<encoded-cwd>/<iso>_<uuid>.jsonl, history.db (session_titles, session_recaps, history+FTS5 prompt search), and stats.db (session_rollup{session_file,requests,total_tokens,cost_total,models,tool_calls} over ~100k messages and ~97k tool_calls rows that omp stats already parsed). gPTY knows none of it, so ten agents run today cannot be found, compared or reopened from the GUI. Fix: a read-only sessions pane for the workspace directory - title, age, lifecycle status (the tail marker), requests, tokens, cost, models - read from stats.db/history.db, with the JSONL only for the title fallback, plus prompt-history search over history_fts and exactly two actions, both documented CLI: resume in a new terminal via omp --resume=<id> through the existing spawn path, and export via omp --export. The agent dir is resolved once from PI_CODING_AGENT_DIR/--profile, and every path is gated to <agent dir>/sessions/** and those DBs opened read-only - never a user-supplied path, because these files hold full prompts. omp session lease --json marks a session a running omp still owns. Tests: Rust reader unit tests over fixture rows (title fallback, status mapping, cost aggregation, a locked DB during a live write).
⬜ AGENT A finished session can only be read in the terminal it ran in - the JSONL is a complete structured transcript: assistant text and thinking blocks, toolCall blocks with arguments, toolResult messages with content/details.isError, compaction{tokensBefore,tokensAfter,summary}, branch_summary, reset_boundary, model_change, mode_change, all linked by id/parentId. The Reasoning pane keeps only the live turn’s thinking and nothing on disk, so reviewing what an agent did after it exits means reopening the TUI - omp render proves the reconstruction is faithful, and omp --export proves it is readable. Fix: a read-only Markdown projection of one selected session - walk id/parentId from the header, draw compaction and reset as dividers, render tool calls as collapsed one-line cards that expand to the result, keep thinking behind a toggle - reusing markdown_view.gd and the sessions pane’s gate, chunked under the same 1 MiB text_read guard per chunk rather than on the file. Display only: never logged, never indexed into the wiki or a history DB. Tests: Rust projection tests over fixtures (tree order, dividers, a missing parent, a truncated tail line from a killed omp), GUT render of a 5 MB fixture with the time recorded.
⬜ AGENT Subscription limits are invisible until a request fails - omp usage --json reports every authenticated account’s windows ({provider, limits:[{label, window:{id,resetsAt}, amount:{usedFraction,remainingFraction,used,limit}, status}]}), and OMP persists snapshots to agent.db’s usage_history(provider,account_key,limit_id,used_fraction,status,resets_at); a user running three agents against one 5-hour window finds out at the 429. Fix: a status-bar chip (“62% · resets 14:20”) fed from usage_history with no network, plus a manual refresh that runs omp usage --json and merges the fresher snapshot behind a settings toggle (the command calls provider APIs). The DB schema is internal, so a failed read degrades to “unavailable”, never an error dialog. Display only - no gating, no scheduling, no orchestration - and email/accountId are dropped at parse time so no account identity reaches a widget or a log. Tests: Rust parse test over a fixture report and a fixture row, GUT chip formatting at the warning threshold.
⬜ AGENT Nothing inside an omp TUI says which gPTY pane it is running in - the one channel in the other direction. @gpty/omp-events is loaded inside the user’s TUI process and already holds all four GPTY_EVENT_* values at spawn (socket, GPTY_TERMINAL_SESSION_ID, capability, protocol), so it knows its pane; ctx.ui is the only insertion point into that pane’s screen, because gPTY cannot paint over an alternate-screen TUI. ctx.ui.setStatus(key, text) is a keyed status-line entry (OMP’s own authoring doc uses it for a token counter), so setStatus("gpty", "T3 · mosaic · linked") coexists with OMP’s entries; setWidget({widgetLines, widgetPlacement}) costs vertical space a 12-row tile does not have, and setTitle collides with the OSC 0/2 path the session-title row above reads back. Value is the one class of fact a TUI cannot show - which workspace/pane this session belongs to, and whether the event socket is live (“linked” vs “events off”) - because the evidence lives in other panes. Constraints: display only, ui.* calls and never pi.sendMessage/sendUserMessage (that would put text into the model’s context and cross from display into orchestration), and ctx.hasUI is false under --mode rpc|json|print. Unverified: whether an entry survives session_switch, and how widgetPlacement behaves in a short tile - probe with extensions/gpty-omp-events/tools/send-event.mjs before designing around either. Ordered below the seven because it is chrome, not information about the user’s work. Tests: extension test asserting the status text is derived from the injected ids and cleared on session_shutdown; GUT only if a gPTY-side setting gates it.

v0.14.2 - Program Status (OSC 7501)

The Program Status Protocol is a generic, pty-native way for any program to say what it is doing — idle, working, done, blocked with a kind, or failed — and why, with a message, a progress percentage, and a tree of records under ids. It is the first agent-state channel gPTY can share with programs and harnesses it does not integrate with, and it rides the pty that already crosses SSH and containers, so it needs no socket or manifest; like gpty_state, it is spoofable by design and may only paint display state. On Windows it needs the v0.13 ConPTY passthrough row, because ConPTY re-renders the stream and drops unknown OSCs.

The implementation spec for these rows - the wire parsing, the limits, the record model, the exact JSON and FFI shapes, the UI constants and the test list - is a local working note at TEMP/osc-7501-program-status.md in the repository root. It is gitignored (the TEMP* entry in .gitignore) and never shipped; it exists so a row can be picked up without re-running the research.

Done Area Item
⬜ TERM Program status reports (OSC 7501) are parsed, bounded and projected onto the badge - the Program Status Protocol (spec rev 0.4, superlogical.com/rex/docs/build/program-status) is the generic terminal answer to “what is this program doing”: idle/working/done/blocked/error/clear, a kind with blocked, a progress, an app slug, a base64 title/msg, and a tree of records under hierarchical ids. Both parsers drop it today: the line parser interprets only gpty_state (crates/gpty-core/src/parser.rs:239) and alacritty’s vte Performer ignores every OSC number it does not know, so no program can reach the badge with the protocol. Fix: a new crates/gpty-core/src/program_status.rs (grammar, record store, projection; no vte dependency) plus one osc_dispatch branch and a program_status field on TermGrid beside the tracker (crates/gpty-core/src/term.rs:192). Enforce the spec’s limits before touching a record - 4096-byte sequence, 16-byte key, 32-byte app, 128-byte id with 32 per segment and 8 levels, 2732/2048 msg encoded/decoded, 256/192 title, 64 records with least-recently-updated eviction; skip a malformed pair but discard the whole report on a limits break, undecodable base64, or a control character in decoded text. Each report replaces its record completely; clear removes a subtree or everything; RIS (ESC c) clears every record while DECSTR does not; OSC 133 A and child exit drop working/blocked/idle and keep done/error; gate application on capture only, never on alt-screen or the post-resize window, because agent TUIs live on the alt screen; strip bidi/invisible formatting from msg/title before display. Project attention-first blocked > error > working > done > idle onto AgentState at Tier 2, and ignore gpty_state for that terminal from its first 7501 report until RIS. This is the second OSC the parser interprets, so the row carries the security review docs/content/docs/agents/security.md:41 requires: display only, no report field ever written back or logged, limits checked first. Tests in the note (discard-vs-skip rules, id grammar, base64 caps, lifetimes, LRU, projection, a 4096/4097-byte boundary) plus the existing gpty_state tests unchanged.
⬜ TERM A program that asks whether gPTY speaks OSC 7501 gets no answer - the spec says a supporting terminal MUST reply to OSC 7501;? with ? and MAY list its states and kinds; a reply without them means exactly the five states and three kinds. Nothing answers today, so a probing program treats gPTY as unsupported and shows no status at all even though the parser work lands. Fix: OSC 7501;? queues \x1b]7501;?:states=idle,working,done,blocked,error:kinds=permission,question,auth\x1b\\ (byte-exact, pinned in the note), coalesced to one reply per feed and one per 100 ms per terminal. The line parser has no PTY writer, so the reply must ride the existing emulator-reply queue (crates/gpty-core/src/term.rs:167): the parser collects it, the engine queues it, and the existing tail drain writes it with the rest of the DSR/mode replies (crates/gpty-core/src/engine.rs:1034); a new TermGrid.queue_reply bounds the queue at 32. Tests: BEL and ST forms, one query in a multi-report feed, the reply bytes and rate limit at parser+grid level; no report field is ever written back.
⬜ TERM Primary device attributes go unanswered, so the protocol’s fallback probe waits out its timeout - the spec’s detection recipe tells a program to send primary device attributes (CSI c) right after the 7501 query and treat a DA reply that arrives first as “protocol unsupported”, so a program that cannot read replies still gets a bounded answer. vte 0.15’s Performer has no c arm and alacritty does not answer DA1, so nothing comes back and a probing program spends its full timeout before falling back - the terminal is the one part of the recipe that is missing. Fix: answer a bare CSI c (and CSI 0 c) with \x1b[?1;2c (VT100 with advanced video) from LineParser::csi_dispatch through the same bounded reply queue as the 7501 query. Tests: one raw-grid feed of CSI c yields exactly one reply; the existing CSI handling is untouched. Contingency in the note: if a future alacritty starts answering DA1, the one-reply test fails and the parser’s arm is deleted, so the terminal never double-answers.
⬜ IPC paneStatus says the state but not what the program says it is doing - StatusDocument (crates/gpty-core/src/engine.rs:135) carries agent_state and agent_state_tier only, so a script or an orchestrator can see needs-attention but not which kind, how far a job got, or the program’s one-line reason; a GUI must scrape the titlebar for it. Fix: a nested program_status object with {revision, state, kind, progress, app, title, msg, records, blocked}, where state is the primary record’s state (not the merged tier result), msg is the full decoded value (2048-byte protocol limit), and counts are per-terminal; unstarted_status_json returns the empty view so a pane’s first frame still parses. Add get_program_status beside get_agent_state (crates/gpty-gdext/src/lib.rs:489) for the 4 Hz pane poll, with the message capped at 160 bytes for display and the display JSON cached until a mutation; get_agent_state stays the one string the dispatcher compares. Tests: the engine’s unstarted/started document tests, the workspace status contract, and the wiki ipc.md field list.
⬜ GUI A blocked pane’s title bar never says what it is waiting for - the badge shows one of four silhouettes and a fixed label, so a blocked pane cannot say whether it needs permission, an answer, or a sign-in, and a working job cannot show 40 percent even though OSC 7501 supplies both. Fix: the badge gains set_detail and a pure detail_text - kind words for needs-attention (“Needs permission”, “Needs an answer”, “Needs sign-in”), then app, then title, then the one-line msg, truncated at 200 chars and used as both tooltip and accessible name - and a new StateStrip (godot/scenes/ui/state_strip.gd) draws a 2 px determinate bar on the titlebar’s bottom edge (ACCENT working, WARNING blocked, hidden without a progress). TerminalPane reads get_program_status in its existing 250 ms poll (godot/scenes/terminal/terminal_pane.gd:1048), applies detail only when the primary record’s state equals the displayed badge state (a Tier 1 state must never be captioned with a stale message), and exposes agent_state()/program_detail() on PaneBody for the workspace surfaces. A compact 16×16 badge mode serves the sidebar. Tests: detail composition, kind labels, truncation, compact geometry, strip visibility and width, accessibility names.
⬜ GUI A pane waiting on the user is invisible once it is not the active pane - the only agent-state indicator is the tile’s titlebar badge, so a blocked or failed pane in a hidden workspace, or one whose titlebar is turned off, is found only by scanning every tile; v0.14.1’s Inbox row assumes a queue that does not exist yet and v0.9.5’s notification row assumes a marker. Fix: the sidebar pane row gains a compact StateDot at child index 1 (the label button stays 0, actions move to 2/3/4 and the confirm to 5, with the index-sensitive _apply_row_pending/_update_pane_row updated); workspace rows gain a StatusChip at index 1 (warning glyph plus blocked count, visible only when blocked, full sentence in the tooltip and accessible name); the status bar gains the active pane’s state — msg detail plus the workspace summary (1 blocked · 2 working · 1 done); the app titlebar and the OS window title gain the cross-workspace suffix (N need attention, else N failed). Workspace._process scans every workspace’s tiles on a 0.25 s accumulator (godot/scenes/terminal/workspace.gd:2661), reads the cached agent_state() with no FFI, and dedupes on a joined signature; Sidebar.update_agent_status updates dots and chips in place. Contrast adds WARNING/SUCCESS on SIDEBAR to UiPalette.CONTRAST_PAIRS (godot/scenes/ui/ui_palette.gd:68) with a 16×16 SURFACE_RAISED pill as the pre-decided fallback if either fails. Tests: sidebar row indices and chip visibility, status-bar detail/summary, a two-workspace aggregation, the window-title suffix, and a capture state showing all four surfaces.
⬜ DOCS The agent-state page describes one declaration channel where there are now two - docs/content/wiki/gpty/agent-state.md lists Tier 2 as the private gpty_state OSC only and docs/content/wiki/gpty/ipc.md’s paneStatus paragraph names the old nine fields, so a program author reading the wiki cannot discover the generic channel and an API consumer cannot find program_status. Fix: the wiki gains the OSC 7501 Tier 2 channel (states, kind, progress, records and ids, lifetimes, projection and the attention-first display rule, why the pty is the generic path and why it is still spoofable), the paneStatus field list and the get_program_status display cap, and docs/content/docs/agents/security.md:41 plus the parser.rs comment name the reviewed second OSC and its no-writeback/no-log rule; AGENTS.md’s data-flow block gains the line from a pane program’s OSC 7501 to the badge and sidebar. Acceptance: ./scripts/docs-check and python3 scripts/build-wiki --check.