Skip to content

feat(fresh-agent): render opencode-pty notifications as agent text (display-only) - #806

Merged
danshapiro merged 5 commits into
mainfrom
the-usual/pty-notification-display-role
Sep 19, 2026
Merged

danshapiro merged 5 commits into
mainfrom
the-usual/pty-notification-display-role

Conversation

@danshapiro

Copy link
Copy Markdown
Owner

What

opencode-pty plugin notification messages (the machine-injected <pty_exited> / <pty_waited> / <pty_wait_timeout> blocks that arrive as genuine user-role turns) now render everywhere in the fresh-agent UI as agent text: agent label and bubble styling, markdown rendering, folded into adjacent agent turns as continuations, no minimap tick or hover preview, and agent-parity toolbar affordances. The minimap rail now shows only real human prompts.

Display-only by construction: a single shared pure classifier (reclassifyPtyNotificationTurns in shared/fresh-agent-turns.ts) is composed first inside the existing displayTurns memo in FreshAgentTranscript.tsx — the same choke point that already rewrites synthetic tool-result user turns for display. The wire snapshot contract ("exactly what the model sees"), store turns, the rollback stepper's raw user-role step counts (sum-to-rollback.undoneDepth pin), and freshAgentSnapshotHasUserTurn are all untouched; a guard test pins the stepper raw rule.

Changes

  • shared/fresh-agent-turns.ts — additive classifier (leading-tag detection, first-text-item-then-summary extraction, identity-preserving for non-matches, never mutates input)
  • src/components/fresh-agent/FreshAgentTranscript.tsx — one import + the memo composition (2 lines)
  • test/unit/shared/fresh-agent-turns.test.ts — 6 classifier unit tests
  • test/unit/client/components/fresh-agent/FreshAgentTranscript.test.tsx — 5 display pins (label/bubble, markdown path, continuation fold, toolbar parity, rollback raw-rule guard)
  • test/e2e-browser/specs/fresh-agent-pty-notification-display.spec.ts — new cloud-legal e2e: freshopencode pane seeded with a realistic <pty_exited> conversation; asserts agent article, no You, exactly one minimap tick

Verification

  • TDD red→green at every level (unit RED 4-fail/guard-pass; e2e RED→GREEN with explicit attribution criteria)
  • Impacted set: 431/431 unit tests; typecheck:client clean; lint clean on touched files
  • e2e green on the cloud backend at the committed HEAD (1 passed, 7.1s, server self-identifies the commit)
  • Full-suite gate at HEAD: client + source-runtime green; electron + electron-runtime lanes green at HEAD; rust red with exactly the 11 pre-existing base failures (session-handoff/ownership area — user-authorized exception recorded in the plan's Global Constraints; this PR touches no Rust code, and the failure list matches the base receipts name-for-name)
  • Reviews: task reviews PASS/APPROVED (both), whole-branch review PASS/APPROVED, independent delta review PASSED with zero findings (different model family, validated tag detection against the opencode-pty plugin's upstream source)

Includes the implementation plan (docs/plans/2026-09-18-pty-notification-display-role.md) with the recorded user-authorized red-base exception.

@danshapiro
danshapiro merged commit 2421c02 into main Sep 19, 2026
7 checks passed
@danshapiro
danshapiro deleted the the-usual/pty-notification-display-role branch September 19, 2026 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant