Skip to content

feat(session-view): render finished Code Mode scripts and <background-result> notices - #252

Merged
Hona merged 1 commit into
devfrom
ws4/background-notices
Nov 20, 2026
Merged

Hona merged 1 commit into
devfrom
ws4/background-notices

Conversation

@Hona

@Hona Hona commented Nov 20, 2026

Copy link
Copy Markdown
Member

Summary

Completes the background-work timeline notice pipeline (ports anomalyco/opencode#64741 and #64971):

  • crates/opencode-kit/src/model/notice.rs: Wires parse_background_result into synthetic notice decoding so both unified <background-result kind="..."> blocks (#64971) and legacy <shell>, <subagent>, <codemode>, <image>, and <video> blocks parse cleanly even with sparse metadata. Unknown <background-result kind="..."> notice kinds fall back cleanly to NoticeKind::Job or NoticeKind::Text — never crashing or dropping messages.
  • crates/opencode-kit/src/model/preview.rs: Keeps tag 8 backward-compatible for existing boot previews and adds tags 9 (Code Mode script outcome) and 10 (required failed job notice); older builds safely decode unknown tags as None and load from the server.
  • crates/opencode-runtime/src/detail.rs: Marks failed background job notices (including failed Code Mode scripts) as required (Placement::Separate) even when Notices are hidden, matching timelineNoticeRequired.
  • crates/session-view/src/turn_errors.rs: Renders finished, failed, and cancelled Code Mode scripts ("Script finished · cm_…") with outcome marks and ink (p.cancelled uses yellow-900 in light and state-fg-warning in dark, matching official outcomeNoticeColor).
  • apps/desktop: Animates waiting Code Mode script notices arriving in the inbox (waiting_finish) and adds finished/failed/cancelled script notices to Timeline/Event marks.

Screenshots

Expanded <background-result> notices (dark 1x — finished/failed/cancelled Code Mode scripts, subagent report, unknown future_agent notice, video job notice):

Expanded <background-result> notices (light 1x — verifying p.cancelled yellow-900 parity):

Live opencode-ref @ e51247f626 dev server rendering a real <background-result kind="codemode"> synthetic notice:

Verification

  • pwsh scripts/guardrails.ps1: 5/5 passed.
  • cargo check --workspace and pwsh scripts/web.ps1 -Check: passed (web clock: 997 files in 46 crates).
  • cargo clippy -p opencode-kit -p opencode-runtime -p session-view -p opencode-desktop: 0 warnings in all WS-4 files.
  • Live & fixture verification:
    • Modern fixture (light & dark, 1x & 1.5x): finished/failed/cancelled Code Mode script notices, <background-result kind="subagent">, <background-result kind="video">, and unknown <background-result kind="future_agent"> (empty metadata, no description) all render cleanly with 0 stale-region warnings.
    • Live opencode-ref @ e51247f626 dev server: real POST /api/session/:id/synthetic <background-result kind="codemode"> notice renders cleanly with 0 error toasts and 0 stale-region warnings.
    • Older OpenCode servers (harness/older-server.ts v2.2.6 and v2.3.0 profiles): 0 error toasts, shells & subagents still show, legacy <shell> & <subagent> notices still render, 404 cached per connection.
    • Saved-data boot preview upgrade/downgrade round-trip on scratch profile (new write -> new reopen -> old baseline downgrade): all 3 launches exited 0, zero damaged-storage notices, session loaded cleanly.

…-result> notices

Complete the notice pipeline for background work (ports
anomalyco/opencode#64741 and #64971):

- crates/opencode-kit/src/model/notice.rs: wire parse_background_result into
  synthetic notice parsing so both unified <background-result kind="...">
  blocks (#64971) and legacy <shell>, <subagent>, <codemode>, <image>, and
  <video> blocks decode cleanly even with sparse metadata. Unknown notice
  kinds fall back to NoticeKind::Job or NoticeKind::Text and are never
  dropped or crashed on.
- crates/opencode-kit/src/model/preview.rs: preserve tag 8 backward
  compatibility for existing previews and add tags 9/10 for script and
  required failed job notices (older builds safely decode unknown tags as
  None and fall back to the server).
- crates/opencode-runtime/src/detail.rs: treat failed background job notices
  (including failed Code Mode scripts) as required (Placement::Separate) even
  when Notices are hidden, matching timelineNoticeRequired.
- crates/session-view/src/turn_errors.rs: render finished, failed, and
  cancelled background Code Mode scripts ("Script finished · cm_...") with
  outcome marks and ink (using p.cancelled for light/dark yellow parity).
- apps/desktop: animate waiting Code Mode script notices arriving in the
  inbox and add finished/failed/cancelled script notices to Event marks.
@Hona
Hona merged commit 2f05b91 into dev Nov 20, 2026
@Hona
Hona deleted the ws4/background-notices branch November 20, 2026 07:59
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

PR test build retired — merged into dev. Install or auto-update OpenCode (Rune) from https://anoma.ly/release/opencode/desktop-rune/dev/macos-arm64-dmg.

Hona added a commit that referenced this pull request Nov 20, 2026
…ing (#266)

- Fold verified fleet PRs #247, #251, #252, #253, #254, #255, #256, #257,
  #258, #260, #261, #262, #263, #264, and #265 (Rune #1290 PRE-11 / #1296)
  into docs/upstream-sync/ledger.{json,md}
- Audit upstream anomalyco/opencode through 92d35f8e18 (+9 commits past
  bf683129fa), adding UP-107..UP-113 and assigning UP-106/UP-108/UP-111 to
  BROWSER-UI
- Update scripts/upstream-sync-check.ts to skip pure *.fixture.* test files
  and route browser UI/history vs extensions commits to BROWSER-UI and WS-9
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