Skip to content

feat(dashboard,core,server): keep new conversations listed, Context window, GitHub links, sent pictures - #451

Merged
Brooooooklyn merged 4 commits into
mainfrom
fix/chat-new-session-list
Dec 1, 2026
Merged

Brooooooklyn merged 4 commits into
mainfrom
fix/chat-new-session-list

Conversation

@Brooooooklyn

Copy link
Copy Markdown
Contributor

Summary

Started as a fix: a new Chat/Work conversation vanished from the list after leaving and returning to the Chat page while its first turn waited for the model load. The PR now also carries the Control Panel work built on the same pages.

list      host ChatHostState.unlisted (ChatService.firstTurns) ─► client merge + hold (pages/chat/unlisted.ts)
context   answer end / context record / trace join ─► measured count
          engine promptParts ─► trace row + size file ─► exact parts (no ~)
github    gh token (host only) ─► GraphQL / REST ─► redact ─► refs answer {auth, login, refs} ─► page store ─► links + hover cards
pictures  live:<uuid> (host, 64 MiB) / p<promptIndex> (disk) ─► thumbnails, hover card, viewer, Copy
  • Conversation list: a new conversation stays listed while its first turn waits, also after a page switch and through a failed list reload.
  • Context window panel: a measured count (answer end, a per-conversation context record in ~/.mlx-node/chat/context/, or a trace join), the agent folder's parts, and the engine's exact parts when its size file lines up. ~ shows only on estimates.
  • Engine (mlx-core): counts each prompt by kind at the native render and returns promptParts on ChatResult and the final stream chunk. The parts sum to promptTokens. Families that are not counted (gemma4, k2_horizon, qianfan_ocr, hy_v4_flash, qwen4_exp) report none.
  • Server: keeps the eight kinds on ok trace rows and links rows to the agent session and turn. It writes ~/.mlx-node/metrics/context/<session>.json with numbers and ids only, mode 0600, at most 1,000 files, and not when metrics are off. The dashboard schema moves to v16.
  • GitHub links: links with hover cards. The token never reaches a log, an error, an answer, the page or the agent. GitHub text is redacted before any cut. A different account resets the page store.
  • Sent pictures: thumbnails with a hover card, a viewer and Copy.
  • Other:
    • model switch marks
    • a Work-only "Add folder" row
    • web_fetch offset, to read a long page 12,000 characters at a time
  • Perf:
    • the host resends an unchanged state at most every 5 s, and idle time labels update
    • a row click selects at once, and the thread follows two frames later
    • no old thread is kept after a switch

Review

A Codex adversarial review ran in two parts. The diff is over 1 MB, so the dashboard tests were left out. It found 11 issues:

  • 8 are fixed, each with a test.
  • 3 are rejected:
    • extra template renders: measured at about 1 ms per turn
    • the live picture byte budget: works as designed and existing tests cover it
    • web_fetch offsets on a page that changes between calls: the design relies on the provider cache

Test plan

  • yarn typecheck
  • vp lint --type-aware --type-check on the changed packages
  • vp fmt
  • vp test packages/dashboard __test__/server packages/desktop: 401 files, 10,023 tests pass, after the rebase on main
  • cargo test -p mlx-core --lib prompt_parts, cargo clippy, cargo fmt
  • Live engine check on qwen3-0.6b: promptParts sums to promptTokens (178 = 178), sync and stream
  • Schema v16 migration on copies of v14 and v15 databases
  • UI pass at 1440 and 390 px, light and dark

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d7763b91-020e-4d3b-949b-5a3f12b254eb

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • 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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-30T15:38:21.752135Z afb256c PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: afb256c957

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Brooooooklyn and others added 4 commits December 1, 2026 10:07
The engine counts each prompt by kind (system, tools, user, thinking,
text, tool calls, tool results, images) at its one render site and
returns them as `promptParts` on ChatResult and the stream's final
chunk; the parts sum to `promptTokens`. Families whose render is not
counted report none.

The server keeps the eight kinds on each ok trace row, links rows to
the agent's session and turn (`client_session`, `client_call`,
`client_turn`), and writes a per-session size file under
~/.mlx-node/metrics/context/ (numbers and ids only, 0600, at most
1,000 files, skipped when metrics are off).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…b links, sent pictures

- Chat/Work list: a new conversation stays listed while its first turn
  waits for the model load, also after leaving and returning to the
  page and through a failed list reload.
- Context window panel: a measured count (answer ends, a per-
  conversation context record, a trace join), the agent folder's parts,
  and the engine's exact parts when its size file lines up; `~` only
  on estimates.
- GitHub ref links with hover cards; the token never reaches a log,
  an answer, the page or the agent, and GitHub text is redacted
  before any cut; another account resets the page store.
- Sent-image thumbnails with a hover card, a viewer and Copy.
- Model switch marks, Work "Add folder", web_fetch `offset` to read a
  long page in parts.
- Perf: host state push floor and idle clock labels, a row click
  selects at once and the thread follows two frames later, no thread
  kept after a switch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…of its own

An empty message (an empty tool result, an empty assistant turn) gets no
anchor in the counted render, so its markup went to a neighbour and the
parts still summed. Now the per-message list is dropped when such a
message sits between neighbours of its own role (the kinds stay exact),
and no parts are returned in any other case.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
qwen3_moe landed on main without the counted render, so its turns gave
no prompt parts. It renders through the same Jinja template as qwen3.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Brooooooklyn
Brooooooklyn force-pushed the fix/chat-new-session-list branch from 15b8991 to ed4f773 Compare December 1, 2026 02:27
@Brooooooklyn
Brooooooklyn merged commit ec1bb8b into main Dec 1, 2026
22 checks passed
@Brooooooklyn
Brooooooklyn deleted the fix/chat-new-session-list branch December 1, 2026 03:08
Brooooooklyn added a commit that referenced this pull request Dec 1, 2026
Follow-up to #456. The squash merge missed one line: the test-only
`SuppressedOpenPagedBackend::finalize_turn` in `paged_turn.rs` builds a
`ChatResult` without the `prompt_parts` field added by #451, so `cargo
test --lib -p mlx-core` fails to compile on `main`.

One line: `prompt_parts: None`. Checked with `cargo clippy --all-targets
-D warnings` (clean).
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