Skip to content

feat(gateway): session observer digests over the utility model - #112216

Merged
steipete merged 3 commits into
mainfrom
steipete/session-status-monitor-05b622
Jul 21, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/session-status-monitor-05b622

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Agentic session transcripts are walls of tool noise: there is no glanceable, trustworthy answer to "what is the agent doing and how is it going" — while a run is live, or when returning to an idle session. The sidebar's heuristic narration line transcribes activity ("running vitest") but cannot judge trajectory ("third run of the same file, still failing — it may be circling").

This PR lands the server foundation of the session-observer program: a gateway service that watches observed sessions' agent-event streams and uses the agent's utility model to produce structured trajectory digests. The Control UI HUD card, sidebar subtitle integration, and settings surface build on this in the follow-up PR.

Why This Change Was Made

One narrator, server-side: a digest authored in the gateway reaches every client (web, macOS, mobile) through one session.observer event plus a compact GatewaySessionRow.observerDigest projection, instead of per-client stream re-derivation. Judgment (progressing / grinding / stuck / waiting-on-user / wrapping-up / done / failed) requires a model; the existing utility-model concept (agents.defaults.utilityModel, provider-declared defaults) already owns exactly this class of short internal task.

Design decisions of note:

  • Observation is gated on someone actually watching: only sessions with live session-message subscribers are observed, capped at 6 concurrent, with narrator-style thresholds (>=4 notes, >=12s, <=40 digests/run, 2-failure auto-disable, 10s/300-token bounded calls). Utility model only — never a silent fallback to the primary model.
  • Privacy: tool results and command output text never reach the model (command notes are title/status/exit-code metadata only, matching the progress narrator's shipped posture); assistant prose is assembled from deltas and stripped/redacted only as assembled text (per-fragment redaction cannot match split secrets), with fail-closed handling for still-streaming internal runtime-context blocks; heartbeat runs are excluded entirely.
  • Durability: the latest digest persists on the session entry (statusNote-precedent path, revision-guarded, write-throttled) so idle rows keep the final judgment; every terminal path that cannot run the model synthesizes a model-free terminal correction, and run rollover/reset races are guarded atomically inside the store updater.
  • Accepted tradeoff (named): the feature defaults on, like progress narration — read-scope watchers are operator-owned surfaces and the auto-derived utility model stays on the session's own provider with auth-profile carryover. gateway.controlUi.sessionObserver: false disables it gateway-wide; agents.defaults.utilityModel: "" disables all utility-model tasks.

User Impact

No visible UI change yet. Control UI clients subscribed to a session begin receiving session.observer digest events, and session rows carry a compact observerDigest (headline, health, updatedAt, revision) for idle-state surfaces. One new config key (gateway.controlUi.sessionObserver, default true) documented in docs/web/control-ui.md.

Evidence

  • Focused suites green: session-observer (48 tests), session-utils projection, server-methods-list, config validation — 180+ tests via node scripts/run-vitest.mjs.
  • Protocol regenerated in-PR: pnpm protocol:gen, gen:swift, gen:kotlin (Swift/Kotlin models included).
  • Full check-changed gate delegated to Blacksmith Testbox: run tbx_01ky1ewy19cgjmjy0n68pja0dj, exit 0 (typecheck, lint, import-cycles, boundaries, native guards).
  • Ten structured autoreview rounds (gpt-5.6-sol, high): 13 accepted findings fixed across privacy (command-output/metadata-only, split-delta assembled redaction, open runtime-context fail-close), terminal-staleness (synthesized terminal digests, rollover/reset/disposal guards, honest persistence acceptance), and bounded bookkeeping; 1 finding (default-on posture) consciously rejected as the documented product decision above.

@steipete
steipete marked this pull request as ready for review July 21, 2026 08:06
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: android App: android app: web-ui App: web-ui gateway Gateway runtime scripts Repository scripts size: XL maintainer Maintainer-authored PR labels Jul 21, 2026
@clawsweeper

clawsweeper Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: feat(gateway): session observer digests over the utility model This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@clawsweeper

clawsweeper Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: feat(gateway): session observer digests over the utility model This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@steipete
steipete merged commit 89fe452 into main Jul 21, 2026
125 checks passed
@steipete
steipete deleted the steipete/session-status-monitor-05b622 branch July 21, 2026 11:04
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 22, 2026
…law#112216)

* feat(gateway): session observer digests over the utility model

* fix(gateway): split session-observer modules and satisfy ci gates

* fix(gateway): observer reads session entries without materializing agent state
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: android App: android app: web-ui App: web-ui docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR scripts Repository scripts size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant