security(tui): stop trusting mutable interpreter arguments

LA
1mo ago
+1013741-186428

Fixes the process identity fallback that read mutable /proc//cmdline to infer an agent script. The fallback now accepts only the kernel-resolved executable path and fails closed for wrapped interpreters.

Adds a behavior regression for an interpreter-wrapped process.

Commit: ca6d8ed7fa1c3b7e0f2a7f5ec1b8f2f8bfb8c6f1


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Summary by cubic

Stops trusting mutable /proc/<pid>/cmdline for agent identity, so a process can no longer fake one; screen detection now uses only the kernel-resolved executable path, and interpreter-wrapped agents are not detected. This also makes the agents sidebar show live agent state.

Agent roster

  • Agent records derive from agent.* journal commits via a durable reducer; direct reports append an echo event, and restarts restore a snapshot and fold only the journal tail.
  • A session-owned scanner ports herdr's detection engine with 21 vendored Apache-2.0 manifests, evaluating PTY output after quiescence (and at 1Hz for never-quiet spinners), retrying reads at their deadline, and emitting edge-triggered transitions.
  • Events carry the adapter id (claude, codex, ...) through the roster to views.
  • Hook events beat screen-derived state, socket reports lose to both, and screen exits remove only screen-established entries; hook projection failures retry durably with bounded caps.
  • Agents views sort by attention (blocked > working > idle), then recency.

Also in this merge

  • The mux codec caps packet-declared part counts before allocating; relay accept failures back off with bounded retries.
  • 429 responses now carry the enforcement source (ingress_ip, account_budget, device_budget, auth_provider); local cooldown waits are prefixed cooldown:.
  • iOS discovery and pairing use the active irx runtime and preserve legacy Mac access across the v2 upgrade.
  • CI locks the Rust build to Cargo.lock, drops a duplicate npm install, and honors a pre-resolved Python command.
  • agent.report failures no longer expose internal registry details.

Summary by CodeRabbit

  • New Features
    • Automatically detects supported terminal agents and identifies whether they are working, idle, blocked, or unknown.
    • Adds bundled detection support for a broad range of agent tools and terminal interfaces.
    • Displays detected agent names in session and agent updates.
    • Preserves agent status across restarts and keeps roster data synchronized.
  • Improvements
    • Sorts agent sidebar entries by attention priority and recency while preserving tab order.
  • Documentation
    • Added licensing and maintenance documentation for bundled detection manifests.