Skip to content

feat(chat): show the session's work time, transcript size and goal in the header (#2017) - #2909

Merged
devswha merged 3 commits into
mainfrom
feat/chat-session-stats
Nov 5, 2026
Merged

devswha merged 3 commits into
mainfrom
feat/chat-session-stats

Conversation

@devswha

@devswha devswha commented Nov 5, 2026

Copy link
Copy Markdown
Owner

Fixes #2017

What

The selected chat's session totals, read-only and per pane, updated as turns arrive:

  • Worked time: the sum of the agent turns' own recorded durations (each turn's first to last activity, the same span its "Worked for" shows). It is not wall time since the session began, so idle time between turns does not count. The chat pages its turns, so until it has loaded back to the beginning the line says Worked at least ….
  • Transcript size: transcript_bytes, a new optional field on the newest GET /api/pane/conversation page. It is the size of the file that page was read from (a Codex rollout, or a Claude/pi/omp/omo/gjc/agy session file), taken from the stat the read already does. Older pages and stores that are not one file (OpenCode, Devin, Hermes, dsh) leave it out, and the menu says Transcript size unknown.
  • Goal: the goal the latest omo goal call (create_goal/update_goal/get_goal) left in the loaded turns, cleared by a later {"goal": null} (reuses lib/goals.ts).

Where:

  • Header, from 769px: after the crumb, in the crumb's face: Worked 1h 22m · 12 MB, plus a Target glyph with the goal's status. It is its own flex item after the crumb, so it wraps out of sight before the crumb does (checked at 800/960/1100: the title and crumb are unchanged). It gives the line to the Reconnecting/Connected word. Its tooltip has the full text.
  • More menu header, at every width: under the path, the totals and Goal: objective · status · time. A phone's header line belongs to the title, so this is where a phone reads them (the issue's "or the pane's ⋯ menu when the header is full").

Design reference: the Codex desktop app shows a thread's active goal next to its title. Ovis puts it on the crumb line because the header is one line (DESIGN.md, Header context).

No new storage, no polling: the size comes with the read the chat already makes, and the times and goal come from turns it already holds.

Not included

  • Codex goals. Codex keeps them in its own state store (goals_1.sqlite, thread_goals), not in the rollout. Reading a versioned internal database is a maintenance cost, and the issue leaves that decision open. This PR ships the metrics plus omo goals only.

Screenshots (demo fixtures; the conversation answer was enriched in the page with turn times, a size and an omo goal call)

dark light
1280 header
1280 More
390 (header unchanged)
390 More sheet

Before:

Tests

  • server/conversation.test.ts: the newest page's transcript_bytes equals the file's size and follows an append; an older page has none. It failed before the change (undefined).
  • src/lib/sessionStats.test.ts: it sums the recorded spans and skips unknown or backwards ones; it reports no work time before any span; it passes on completeness and size; the goal is the latest across turns and is cleared by a later null. It failed before the change (module missing).

Validation

  • bun run check fast: pass (workflow syntax, generated types/themes, typecheck, build, unit tests 11665 pass / 0 fail).
  • Demo-app browser captures at 390 (touch, 2x) and 1280, light and dark, plus 800/960/1100 header wrap measurements (throwaway script, not committed).
  • Skipped: bun run check integration browser / full (CI runs them).

This changes an HTTP response (one additional optional field), so it waits for a real review.

… the header (#2017)

The header's crumb line, from 769px, now says how long the selected chat's
agent has worked (the sum of its turns' recorded durations; 'at least'
until the chat has loaded back to the beginning), the transcript file's
size, and the omo goal's status. The More menu's header repeats them in
full, with the goal's objective, at every width.

The newest conversation page carries transcript_bytes, the size of the
file it was read from (a Codex rollout, a Claude/pi/omp/omo/gjc session
file); stores that are not one file leave it out and the menu says the
size is unknown. A Codex goal, kept in Codex's own state store, is not
read.
@coderabbitai

coderabbitai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 10 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 15e4344 and 1935358.

Files selected for processing: 14

  • DESIGN.md
  • changelog.d/chat-session-totals.md
  • server/conversation-shared.ts
  • server/conversation.test.ts
  • server/conversation.ts
  • shared/protocol.ts
  • src/App.tsx
  • src/components/ChatView.tsx
  • src/lib/i18n.ja.ts
  • src/lib/i18n.ko.ts
  • src/lib/i18n.zh.ts
  • src/lib/sessionStats.test.ts
  • src/lib/sessionStats.ts
  • src/styles.css
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

…at least when a span is unknown

Two views of one pane (both halves of a split on the same tab) each
publish their own totals; one leaving no longer clears the other's.
A settled agent turn without a recorded span makes the sum 'at least'
instead of an exact total.
@devswha

devswha commented Nov 5, 2026

Copy link
Copy Markdown
Owner Author

Review round 1 (omo + Codex Terra xhigh at 825742f), fixed in e4da547:

  • MEDIUM, reproduced (omo): two views of one pane (both split halves on the same tab) shared one store entry, so closing one cleared the header's totals while the other still showed the chat. Each view now publishes under its own token and the entry goes only when the last view leaves. Test: useSessionStats > keeps a pane's totals while another view of the same pane still shows them (fails before the fix).
  • LOW (Codex): a settled agent turn with no recorded span was skipped silently and the total still read as exact. It now reads Worked at least …; the running last turn, which may not have written its end yet, does not count. Test added (fails before the fix).

Not changed:

  • MEDIUM, not reproduced as a defect (Codex, omo): the goal comes from the loaded turns, so a goal whose last call is older than the newest page (16 MB) shows nothing until earlier messages load. Reporting it as "unknown" would put a goal line on every non-omo chat. A server-side latest-goal field is the proper fix if it turns out to matter; the PR body already says the goal is read from loaded turns.
  • MEDIUM (Codex): a single turn longer than the newest page is split across pages and the gap between the fragments is not counted. This needs one turn over 16 MB; noted, not changed.

Validation after the fix: bun run check fast pass on the merged head (contains main at 15e4344).

@devswha

devswha commented Nov 5, 2026

Copy link
Copy Markdown
Owner Author

Re-review (omo + Codex Terra xhigh) at 1935358: CLEAR, no HIGH or MEDIUM. LOW notes left as they are:

  • A finished last agent turn with no recorded timestamps is treated as running, so the total can read as exact. Transcript readers set end_ts whenever a timestamp exists, so this needs a store with no timestamps at all.
  • The goal comes from loaded turns only (as documented). A server-side latest-goal field on the newest page would show it without paging back.
  • With one pane in both split halves, the header shows the half that updated last. Both numbers are lower bounds of the same session.
  • Stores whose pages carry no cursor always read "Worked at least …".
  • transcriptBytes is not reset with abandoned on a pane switch. Nothing wrong reaches the screen, because the totals are hidden until the next read sets it.

@devswha

devswha commented Nov 5, 2026

Copy link
Copy Markdown
Owner Author

Local merge gate (owner-approved): reviewed head (omo CLEAR, threads resolved) with bun run check fast passing; held until the account PR #2867 landed and it still merges cleanly. Merged without waiting for GitHub CI.

@devswha
devswha merged commit ad4941f into main Nov 5, 2026
20 of 23 checks passed
@devswha
devswha deleted the feat/chat-session-stats branch November 5, 2026 08:27
devswha added a commit that referenced this pull request Nov 5, 2026
…econnect regression (#2937)

## Summary

`scripts/reconnect-header-demo-regression.ts` fails on main (reproduced
on `ea3b07fa`):

```
error: innerText: Error: strict mode violation: locator('.context-sub') resolved to 2 elements:
    1) <div class="context-sub">…</div>
    2) <div class="context-sub context-session" title="Worked 1m · Transcript size unknown">…</div>
```

#2909 added the session line (`.context-sub.context-session`) under the
pane title, so the regression's crumb locator now matches two elements.
The product is right: the session line is a second row that `App.tsx`
already hides while the connection word (`Reconnecting…` / `Connected`)
has the crumb's place. Only the test's locator was too broad, so this PR
narrows it to the crumb: `.context-sub:not(.context-session)`.

No product code changes.

## Validation

- `bun scripts/reconnect-header-demo-regression.ts`: failed before
(strict mode violation above), passes after: `PASS 390`, `PASS 412`,
`PASS 1280`.
- `bun run check fast`: passed (workflow syntax, generated types/themes,
typecheck, build, unit tests: 11869 pass, 0 fail, 46 skip)
- Skipped: `bun run check full` (test-only change to a single browser
script; CI's Integration and browser job runs it).
devswha added a commit that referenced this pull request Nov 5, 2026
…#3077)

Part of #1170

## What

OmO's chat now shows two things only its TUI showed, read only from what
OmO records in its session file:

1. **Goal continues** (proposal 1). OmO starts a turn to continue an
active goal with a `goal-continuation` custom message (`display:
false`). The chat used to show that turn like any other assistant turn.
It now gets a quiet divider in the user's seat, like a compaction or a
runtime notice: `Goal continues · <time>`. Opening the divider shows the
goal's objective, taken from the message's `<untrusted_objective>` block
and unescaped as OmO writes it.
2. **The goal waits on background work** (proposal 3). OmO writes
`goal-cache-warmup` `{phase: "scheduled", dueAtMs, wakeSources}` when
the goal waits on background work, and `resumed` when it goes on. While
a `scheduled` wait is the last thing in the conversation, the chat ends
with one line: `⌛ Goal waits on 1 task, 1 monitor, and 2 terminals ·
continues around 07:20`. The counts come from `wakeSources`:
`senpi-task` is tasks, `terminal-monitors` monitors,
`terminal-background-sessions` terminals, `omo-dag` DAG runs,
`senpi-codemode` code cells; OmO's wake queue is left out. With no
counts the line says "background work".
- The server drops the line when `resumed` arrives, when an
`engine-turn-start` record shows OmO starting any turn (a wake, a
monitor event, the continuation), or when any later record adds a turn.
A newer `scheduled` replaces it, so the conversation never holds more
than one.
- The client hides the line one minute after its due time, so an OmO
that exited mid-wait cannot leave it on screen for good.

Proposal 2 (keep the goal visible across turns) already shipped in
#2909: the header and the More menu show the latest goal. Proposal 4
(the live ▰ progress bar) needs OmO to expose goal state, so it is not
part of this PR.

### Where

- `server/transcript-records.ts`: `omoGoalContinuation` and
`omoGoalWait`, and the omp/OmO parser keeps a goal's wait only as its
last turn (`state.wait`), the same record by record in previews and in
one-shot parses.
- `shared/protocol.ts`: a new `goal_wait` conversation part (`due_at`,
`waiting_on`). The continuation reuses `notice` with `source:
"goal-continuation"`.
- `src/components/ChatView.tsx` and `.css`: the "Goal continues" label
and the wait line.
- `src/lib/panePresentation.ts`: a trailing wait does not hide the
answer before it, so the finish still counts as seen.
`src/lib/chatMinimap.ts`: a wait gets no minimap tick.
- Korean, Japanese and Chinese strings.

### Design reference

This follows OmO's own TUI: its `goal continues` line and its
background-work marker. The look reuses the chat's own quiet
compaction/notice divider. Like the Codex app's thread goal, the goal's
state appears where the conversation is read, not in a separate panel.

No new setting: the lines show transcript facts on OmO panes, as the
"Background task ended" cards already do. Nothing changes on other
agents.

## Screenshots

Demo fixtures (the cli-tools pane) with a continuation and a wait added,
the continuation opened:

| | light | dark |
|---|---|---|
| 390 | <img
src="https://raw.githubusercontent.com/devswha/ovis/a79ff46bbd99067b191149cc64a04b6ece07c737/goal-en-390-light.png"
width="260"> | <img
src="https://raw.githubusercontent.com/devswha/ovis/a79ff46bbd99067b191149cc64a04b6ece07c737/goal-en-390-dark.png"
width="260"> |
| 1280 | <img
src="https://raw.githubusercontent.com/devswha/ovis/a79ff46bbd99067b191149cc64a04b6ece07c737/goal-en-1280-light.png"
width="420"> | <img
src="https://raw.githubusercontent.com/devswha/ovis/a79ff46bbd99067b191149cc64a04b6ece07c737/goal-en-1280-dark.png"
width="420"> |
| 390 Korean | <img
src="https://raw.githubusercontent.com/devswha/ovis/a79ff46bbd99067b191149cc64a04b6ece07c737/goal-ko-390-light.png"
width="260"> | <img
src="https://raw.githubusercontent.com/devswha/ovis/a79ff46bbd99067b191149cc64a04b6ece07c737/goal-ko-390-dark.png"
width="260"> |

## Validation

- Failing first on origin/main: `server/conversation.test.ts` "OmO goal
continuation and waits" (2 tests), `server/omp-incremental.test.ts` "a
goal's wait is withdrawn the same way record by record…",
`src/lib/goals.test.ts` (new helpers),
`src/lib/panePresentation.test.ts` (the finish counts as seen after a
trailing wait; fails without the `panePresentation.ts` change).
- A real OmO session file (a lane run on 2026-10-28) parses to 67 "Goal
continues" dividers, and none of its scheduled waits are left over at
the end.
- `bun scripts/chat-working-line-demo-regression.ts`: PASS (8 checks).
- `bun run check fast`: ok (typecheck, build, unit tests 12420 pass / 0
fail).
- Not run: the full integration and browser suites (CI runs them).
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.

Chat: show the session's active goal, total work time and transcript size

1 participant