Skip to content

feat: compose driver and PTY session observation fidelity - #353

Closed
schickling-assistant wants to merge 2 commits into
mainfrom
schickling-assistant/2026-08-26-2026-08-26-coarse-observed-state
Closed

feat: compose driver and PTY session observation fidelity#353
schickling-assistant wants to merge 2 commits into
mainfrom
schickling-assistant/2026-08-26-2026-08-26-coarse-observed-state

Conversation

@schickling-assistant

@schickling-assistant schickling-assistant commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Problem

Observed harness-state readers are fleet-wide, but rich producers exist only when an st2 native driver owns the session. A downstream 627-seat catalog launched harnesses through a different wrapper: st2 hooks verify, presence, Doctor, and catalog gates were green while zero seats produced a record and every TUI row rendered never observed.

The producer contract was an unenforced deployment property. st2 must not know about or branch on any launcher.

Goal

Every local running seat has launcher- and harness-agnostic coarse activity. Rich driver observations remain the fine layer and win when fresh.

Decisions

  • Read-time composition, no coarse record writer. PTY PR feat(agent-spec): bind admission receipts to revision #168 stamps lastOutputAtMs in the daemon output path. st2 reads canonical <pty-root>/<bus-id>.json directly and derives active (≤60s) / idle (>60s), with a 30s future-skew guard.
  • Explicit fidelity discriminator. observedState.fidelity = driver | session. Driver fidelity covers the full tuple. Session fidelity proves only state and since; blocked/input/ask remain unknown. Updated consumers use only the proved axes.
  • Fine-over-session precedence. Definite fresh driver observation wins; missing/derived-unknown driver observation falls back to session activity.
  • No launcher awareness. Canonical agent task pty_id = bus_id is runner-owned. No axe or harness name enters the projection.
  • Full VRS scope. Requirements, spec, ontology, accepted decision 0006 Amendment 1, and experiment updated with explicit user approval.

Verification

  • cargo check --all-targets — green.
  • cargo test agents:: --no-fail-fast — green.
  • cargo test observed --no-fail-fast — green (includes Doctor wire/diagnostics).
  • Two full-suite timing failures passed isolated; the all-test lane then timed out after 30m in existing watch tests (load-flaky baseline).
  • GitHub Actions Nix run #693 — green (check, 16m34s) after recovery from the documented Actions major outage.
  • nix build .#default --no-link — green: /nix/store/0d2pkfwzbx483iqb9j02fc40p42yww7i-st2-0.1.0.
  • Synthetic 627-live-seat benchmark, debug binary, 10 runs: median 394ms, max 552ms, exactly 314 active / 313 idle. No subprocesses in the read path.
  • Strict VRS: new experiment passes enforced shape; repo still has 101 pre-existing strict-shape errors in older artifacts.

Complexity

One discriminator, one optional session metadata read per local row, one precedence fold. No process, subscription, history, writer identity, fencing, heartbeat, or retention lifecycle added.

Concerns

Friction & bottlenecks

  • st2 full tests exceed 30m and wedge in existing watch/timing cases; two reported failures passed isolated.
  • Strict VRS currently has 101 baseline shape errors, so this PR can prove its new artifact passes but not make the whole tree green without unrelated migration.
  • The original design allowed consumer adoption without producer coverage; the new session fallback removes that class for local seats.

Follow-ups

References

Posted on behalf of @schickling
field value
agent_identity unknown
agent_persona generalist
agent_supervisor unavailable
agent_tool OMP
agent_tool_version 18.0.3
agent_runtime OMP 18.0.3
tooling_profile dotfiles@e4789b0

A deployed 627-seat consumer exposed the envelope's coverage hole:
readers were fleet-wide while producers existed only when an st2 driver
owned the session. Compose a launcher-agnostic session projection at read
time from PTY lastOutputAtMs, with explicit fidelity=driver|session.

Definite fresh driver state wins. Missing/unknown driver state falls back
to alive PTY output activity; session fidelity proves only state+since.
No coarse record writer, fencing, heartbeat, or launcher awareness is
introduced.

Includes the user-confirmed constitutional VRS amendment: requirements,
spec, ontology, decision 0006 Amendment 1, and measured experiment.

agent-identity: unknown
agent-persona: generalist
agent-supervisor: unavailable
agent-tool: OMP
agent-tool-version: 18.0.3
agent-runtime: OMP 18.0.3
tooling-profile: dotfiles@e4789b0
@schickling-assistant schickling-assistant added the type:feature New user-visible or system capability · Set: manual label Aug 26, 2026
@schickling-assistant
schickling-assistant marked this pull request as ready for review August 26, 2026 16:37
agent-identity: unknown
agent-persona: generalist
agent-supervisor: unavailable
agent-tool: OMP
agent-tool-version: 18.0.3
agent-runtime: OMP 18.0.3
tooling-profile: dotfiles@e4789b0
@schickling-assistant
schickling-assistant marked this pull request as draft August 27, 2026 06:32
@schickling-assistant

Copy link
Copy Markdown
Contributor Author

Post-deploy finding: PTY viewer redraw produces a false coarse active

Live real-seat reproduction on 2026-08-27 (dev3.ai-spend-janitor, semantically idle at the Codex prompt, latest user.agent.status={v:idle,reason:stop}):

  1. With no viewer interaction for >60s, st2 returned fidelity=session,state=idle; Fractal rendered ○ idle.
  2. Opening/selecting the session pane caused terminal attach/resize/redraw output and advanced lastOutputAtMs.
  3. st2 returned session active; Fractal rendered the working spinner despite no new harness work.
  4. Leaving the viewer open without interaction returned the same row to idle after the 60s window.

Conclusion: lastOutputAtMs is valid universal recent terminal output evidence, but it cannot alone make the semantic claim “harness in progress.” The existing downstream activity-fold.jq has the stronger composition: fresh braille spinner → exact user.agent.status → heuristic fallback. The PR is back to draft until the read-time fold consumes/defines semantic evidence (or exposes recent-output as a distinct non-working state) instead of mapping all recent output to active.

Posted on behalf of @schickling
field value
agent_identity unknown
agent_persona generalist
agent_supervisor unavailable
agent_tool OMP
agent_tool_version 18.0.3
agent_runtime OMP 18.0.3
tooling_profile dotfiles@e4789b0

@schickling-assistant

Copy link
Copy Markdown
Contributor Author

Superseded by live observer-effect evidence and the restored single-owner semantic activity fold in dotfiles/fractal. lastOutputAtMs remains valid transport evidence, but selecting an idle session causes redraw output and cannot support the semantic active claim. Real Codex and Claude fixtures now classify correctly through user.agent.status plus the fresh-spinner heuristic; Fractal composes that projection with rich driver records.

Evidence: #353 (comment)

Posted on behalf of @schickling
field value
agent_identity unknown
agent_persona generalist
agent_supervisor unavailable
agent_tool OMP
agent_tool_version 18.0.3
agent_runtime OMP 18.0.3
tooling_profile dotfiles@e4789b0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:feature New user-visible or system capability · Set: manual

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant