Skip to content

feat(agent,dashboard): require mlx-agent v0.3.10 and read its stored counts - #460

Merged
Brooooooklyn merged 7 commits into
mainfrom
feat/mlx-agent-v039
Dec 1, 2026
Merged

Brooooooklyn merged 7 commits into
mainfrom
feat/mlx-agent-v039

Conversation

@Brooooooklyn

Copy link
Copy Markdown
Contributor

Moves Portato to mlx-agent v0.3.10 and uses the counts and context facts the agent now stores.

Agent releases

  • mlx-agent-v0.3.9: measured counts for clients (stored turn end _meta.totalTokens, noReplay restart seed, summary_tokens, signals.json autoCompactThresholdPercent, tagged session prefix), scheduler persist before reply, rewind MCP re-announce, subagent billed tokens, .mlx-agent publish.
  • mlx-agent-v0.3.10: fixes two count defects in v0.3.9 found in review:
    • auto_compact_completed carries _meta.totalTokens = tokens_after, so a restart right after "Compact now" no longer seeds the pre-compaction count (which could compact the history a second time).
    • turn ends without a model answer (Stop, failure, turn cap, stationarity stop, !cmd) store the estimated total, so Stop after a large tool result no longer lowers the count.

App changes

Area Change
Minimum agent MLX_AGENT_MIN_RELEASE = mlx-agent-v0.3.10; a managed v0.3.9 is agent-too-old; harness and fixture tags
Work agent env MCP_INIT_STRATEGY=blocking (Chat keeps its env; its host already waits for mlx_web)
Context panel, cold count newest stored answered turn end = measured; not measured when a rewind marker or a finished compaction follows it; the context record fills in only for sessions without the stamp
Compaction readCompaction and the transcript entry carry summary_tokens; Summary part and "Last compacted" line use it
Threshold ThresholdReader reads <session>/signals.json autoCompactThresholdPercent first
Tests transcript cases for compaction and cancel; the fake agent stamps compactions like v0.3.10; the fake's /workflow turn end reports its real elapsed time (fixes a one-time wakeDue flake under load)
Docs docs/dashboard.md minimum, Work env, Context panel sources

Verification

  • yarn typecheck, vp check: pass.
  • vp test --run packages/dashboard packages/agent __test__/cli: 7510 passed; the only failures need the native addon (not built in the worktree).
  • Real-agent files against the v0.3.10 build: 18 files, 47 tests, 0 failed. They check on the real binary that the stored answered turn end equals the reply's count, auto_compact_completed _meta.totalTokens = tokens_after, summary_tokens = the summary's bytes/4, and signals.json threshold = 85.

🤖 Generated with Claude Code

Brooooooklyn and others added 6 commits December 1, 2026 15:42
Raise MLX_AGENT_MIN_RELEASE to mlx-agent-v0.3.9; a managed v0.3.8 is now
agent-too-old. Move the harness tag, the dev note and the agent-update
fixtures that name the current minimum. v0.3.9 writes a schedule before it
confirms it: the scheduleOnDisk comment says so and the wait stays.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Work's agent env sets MCP_INIT_STRATEGY=blocking over any inherited value:
a turn waits up to the agent's 2 s grace for MCP servers still in their
handshake, so the model reads "MCP server connected" rather than "MCP
servers currently connecting". Chat's host already waits for its one
server (mlx_web) before a prompt, so its fixed env stays as it is.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Cold count: the newest stored turn_completed's _meta.totalTokens (v0.3.9
  stamps the measured count its session/prompt reply gives) is the
  conversation's measured use while it holds: an end on the model's answer,
  on the conversation's model, nothing after it, no rewind marker after it
  (endUsed of the session detail, endCount). It wins over the context
  record, which stays the count of sessions an older agent wrote and the
  cold source of the agent's split. A live turn_completed's count moves the
  count also after the turn's reply (countedEnd).
- Compaction: auto_compact_completed's summary_tokens rides on the
  compaction entry; the Summary part takes the newest finished
  compaction's size over the folder's, and the "Last compacted" line adds
  "· summary ~n tokens".
- Threshold: autoCompactThresholdPercent of the session's signals.json
  first; the env/home/system guess stays for sessions without it.
- Tests: a tagged session_prefix counts as rules; the fake agent can stamp
  a turn end's count and a compaction's summary size; the real-agent
  compaction test checks the stamped end, summary_tokens against the
  folder's bytes / 4 summary, and signals.json; the rewind test expects
  the summary size on its mark.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
v0.3.9 stamps the raw count on a turn end that did not end on an answer
and no count on a compaction's end. Raise MLX_AGENT_MIN_RELEASE to
mlx-agent-v0.3.10; a managed v0.3.9 is now agent-too-old. Move the harness
tag, the dev note and the agent-update fixtures that name the minimum
(the v0.3.9 floor fixture of the candidate walk stays main's).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A stored turn end's count stops holding once an auto_compact_completed
line follows it (endUsed is null then, as after a rewind marker): the
history changed after it. The cold use is then the last stored count,
the compaction's tokens_after that v0.3.10 stamps, as an estimate, until
the next answered turn end. The context record and the trace rows
already stop holding after a finished compaction.

The fake agent stamps a compaction's tokens_after like v0.3.10. Tests pin
the compaction case, a stopped turn's stamped estimate (never measured),
the cold count after Compact now, and on the real agent the stored
compaction end's _meta.totalTokens.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… time

The fake agent ended a typed `/workflow` turn with a fixed
`elapsed_ms: 28`. The host places a turn's start at agentTimestampMs -
elapsed_ms and drops a queued run wake when that start is after the run's
end (`runWakeEnds`). When more than 28 ms passed between the run's
cancelled update and the turn_completed line (a loaded machine), the
`/workflow stop` turn read as one that started after the run's end, the
wake was dropped, and "a typed /workflow stop names you, and its wake
stays due" failed with wakeDue false. The fake now reports the time since
the prompt came, as the agent does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Dec 1, 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: 21a2cd60-cfcf-420a-83bd-7fc4b73f105d

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 Dec 1, 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-12-01T07:46:17.575949Z a89ed0b 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: a89ed0bb12

ℹ️ 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".

A `!cmd` turn ends with end_turn but stores the agent's estimate, so the
cold count takes the stored end as measured only after a model call, the
same rule the live commit uses.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Brooooooklyn
Brooooooklyn merged commit 67d9730 into main Dec 1, 2026
20 checks passed
@Brooooooklyn
Brooooooklyn deleted the feat/mlx-agent-v039 branch December 1, 2026 08:29
Brooooooklyn added a commit that referenced this pull request Dec 1, 2026
…st initializers

#458 and #460 each added a struct field; a test written against the other
branch kept the old field list, so main stopped compiling the mlx-core lib
tests and the qwen35_cuda_prefill_bench integration test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Brooooooklyn added a commit that referenced this pull request Dec 1, 2026
…e with D1 count (#461)

Live at https://portato.void.app (deployed from this tree).

## Site

| Where | Before | After |
|---|---|---|
| Landing hero | Python code chat | PDF card-statement chat + mesh
backdrop |
| Landing chat card | `merge_intervals` code block | letter-photo turn
(app's chat thread) |
| /portato hero | Python code chat | Qwen3.8-27B reads a photo of a
made-up Japanese tax letter |
| Photo tile | static picture | the app's `ImageTiles`: hover card,
viewer, Copy (small island) |
| Work example + Session tab | old mock | real woff-build PR #91
session, speeds scaled per #456 |
| Control Panel | screenshot gallery | 7-view tour of the app's
components with generated mock data (`/panel-frame`) |
| /portato header | mlx-node mark | Portato icon |

- Removed: the Python conversation, `CodeBlock`, the code-highlighting
build, `@shikijs/*`, the screenshot gallery and its shots.
- Default `SITE_URL` is now `https://portato.void.app`
(`vite.config.ts`, `void.config.ts`, `check-site.mjs`).
- README line 42 and `ChatWork.tsx`: "A file edit is shown as a diff,
and each command shows its output."

## `/download`

```
GET /download ─► OS: Sec-CH-UA-Platform, else User-Agent; arch: Sec-CH-UA-Arch / Linux UA
   ├─ mac → Portato-<v>-arm64.dmg
   ├─ windows → Portato-<v>-win32-arm64-setup.exe
   ├─ linux arm64 → Portato-<v>-linux-arm64.deb
   └─ x86 / phone / bot / failure → releases/latest
release list: GitHub API (optional GITHUB_TOKEN secret, cached 10 min)
   └─ API fails → tag from the releases/latest redirect, names as release-version.ts builds them
each GET → one D1 row in `downloads` (at, os, tag, target); no IP, no user agent
```

- Every "Download" button points at `/download`; on Windows/Linux the
label reads "Download for Windows/Linux".
- The site is now a hybrid Void deploy: every request goes through the
Worker (pages are the same prerendered files).
- Read the count: `cd website && CI=1 void db execute --remote --yes
"select os, tag, count(*) from downloads where target = 'file' group by
os, tag"`.

## Also in this PR

- **One lockfile:** `website` is a root workspace; `website/yarn.lock`
is gone (`installConfig.hoistingLimits: "workspaces"` keeps the site's
packages in `website/node_modules`). All 1,014 existing root lock
entries resolve the same; 278 packages added. The root install now runs
6 build scripts (esbuild ×3, workerd, better-sqlite3, `void prepare`).
- **main build fix:** #458 + #460 left two test initializers without a
new field (`turn_history_pin` in `paged_turn.rs`,
`prefix_breakpoint_hints` in `qwen35_cuda_prefill_bench.rs`), so Clippy,
cargo build/test and e2e fail on `main`. Both now use the value every
other test uses.

## Checks

`tsc`, `vp run build`, `check-portato-mock`, `check-numbers`,
`check-site`, `check-samples`, `vp fmt --check` on changed files: pass.
Route tested in `vp preview` and live (API blocked → fallback still
gives the file; HEAD not counted).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
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