Repository navigation
feat: add meta.timing to every daemon response - #57
Draft
cryptotavares wants to merge 1 commit into
Draft
cryptotavares wants to merge 1 commit into
cryptotavares wants to merge 1 commit into
Conversation
Every /tool/*, /launch and /cleanup response body now ends with
`meta: { timing: { queueMs, toolMs, observationMs, totalMs } }`, on
success and on errors (404, 400 validation, platform gate, 500 tool throw,
500 from the error middleware for malformed JSON). The request start is
taken before the body parser, so totalMs covers request in to response out.
The mm CLI keeps `meta` as the last key of its JSON output. String results
are printed as before, without meta.
Add scripts/bench.mjs (not shipped) to run mm commands N times against a
live session and print median/p95 of wall clock, bytes and meta.timing.
cryptotavares
added this pull request to stack #63
October 23, 2026 20:59
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Every speed or size claim in the mm CLI v2 work needs a measurement. Today only wall clock from outside the CLI can be measured, and it mixes yarn/node start-up, queue wait, the tool, observation collection and serialization. The server already computes a duration for the knowledge step (
src/server/create-server.ts:377), but does not return it./tool/*,/launchand/cleanupresponse body now ends withmeta: { timing: { queueMs, toolMs, observationMs, totalMs } }. This applies to success and error bodies: 404 unknown tool, 503, 400 validation, platform gate, 500 tool throw, and 500 from the express error middleware (malformed JSON).queueMs: enqueue → task start.toolMs: the tool call.observationMs: observation collection (0 when skipped).totalMs: request in → response out. The start time is recorded beforeexpress.json, so body parsing is included.totalMs ≥ queueMs + toolMs + observationMs. NewRequestTimerinsrc/server/response-timing.tsuses the monotonicperformance.now().ToolResponseMeta,ToolResponseTiming(src/types/http.ts).metais printed as the last key of the JSON output. String results print unchanged, withoutmeta. Arrays and primitives are wrapped as{ result, meta }. Error exits do not printmetayet; structured CLI errors come in a later ticket.scripts/bench.mjs(not shipped): runsmmcommands N times against a live session and prints TSV with the median and p95 of wall clock, bytes and eachmeta.timingfield.Part of the mm CLI v2 effort: ticket
P1-01(Phase 1).Base: main (bottom of the stack).
Note:
run_stepsalready has per-stepsteps[].metainsideresult. The newmetais top-level, next tookandresult, so they do not collide.Breaking changes
None. The field is additive.
Consumer impact
test/e2e/playwright/llm-workflow/tests/llm-workflow/Proof
Tested with a yalc build of this branch in the Extension (e2e test build 13.56.0, headless Chrome) and Mobile (dev client 8.19.0, iOS sim + Android emulator). Full proof:
proof/p1-01/PROOF.mdin the mm-cli-v2 workspace.meta.timingon JSON outputs (smoke, 3 platforms)meta.timingon HTTP 404 / 400 / 500 (malformed JSON)get-statebytes, Extension (pure cost ofmeta)bench.mjs --runs 5on Extension and iOSThe new numbers already show where time goes (bench p50, live session). This is the baseline for the observation tickets:
cdp Runtime.evaluate 1+1get-statedescribe-screencdp Runtime.evaluate 1+1describe-screenTranscripts
Unit tests
New tests:
src/server/response-timing.test.ts;meta.timingblock insrc/server/create-server.test.ts(success, tool vs observation split, no session, queue wait, tool throw, validation, unknown tool, platform gate, malformed JSON measured from arrival);metablock insrc/cli/mm.test.ts.