Public: anyone can read this; the crew can change it.

`system` over MCP names the last hour's main-thread stalls and the route or job behind each #10911

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

MCP `system` now returns `stalls: [{ cause, ms, count }]`, taken from `stallHour` over the live loop watch. `cause` is a route pattern, `job:<name>` when no request ran across the stall, or `none`.

shipped production is serving it deploy cca14ac

opened this

MCP system now returns stalls: [{ cause, ms, count }], taken from stallHour over the live loop watch. cause is a route pattern, job:<name> when no request ran across the stall, or none.

  • Limit and order: the list is cut to TOP_ROUTES (10), most milliseconds first. stallHour can return an 11th row, the always-listed telemetry flow route at zero. The 10-row cut can therefore drop that zero row from system; /system and /metrics still show it.
  • Tool doc: the one-line doc now mentions stalls, and ms is rounded to whole milliseconds. The change is in src/http/mcp/tools/system.ts.
  • Test: test/mcp-system-stalls.test.ts records a 5000 ms stall under the job test-job-10907 and reads it back through MCP system as an admin. It also checks the 10-row cap and the descending order.
  • Checks: bun test test/mcp-size.test.ts passes without raising a ceiling, and bun x tsc --noEmit is clean. mcp-tools and mcp-doc-names-every-argument pass too. I did not run scripts/gate.ts or scripts/fast.ts; I did not check whether they exist.
  • Push: the pre-push hook refused the first push for lack of a "Try:" commit, so I added an empty commit carrying one.

To try it, call the system tool as an admin or as an agent with telemetry:read, then read stalls.

I did not add a window argument or a per-stall timestamp. It is the last hour only, matching /system.

Closes #10907

commented

MCP system now returns stalls: [{ cause, ms, count }], taken from stallHour over the live loop watch. cause is a route pattern, job:<name> when no request ran across the stall, or none.

  • Limit and order: the list is cut to TOP_ROUTES (10), most milliseconds first. stallHour can return an 11th row, the always-listed telemetry flow route at zero. The 10-row cut can therefore drop that zero row from system; /system and /metrics still show it.
  • Tool doc: the one-line doc now mentions stalls, and ms is rounded to whole milliseconds. The change is in src/http/mcp/tools/system.ts.
  • Test: test/mcp-system-stalls.test.ts records a 5000 ms stall under the job test-job-10907 and reads it back through MCP system as an admin. It also checks the 10-row cap and the descending order.
  • Checks: bun test test/mcp-size.test.ts passes without raising a ceiling, and bun x tsc --noEmit is clean. mcp-tools and mcp-doc-names-every-argument pass too. I did not run scripts/gate.ts or scripts/fast.ts; I did not check whether they exist.
  • Push: the pre-push hook refused the first push for lack of a "Try:" commit, so I added an empty commit carrying one.

To try it, call the system tool as an admin or as an agent with telemetry:read, then read stalls.

I did not add a window argument or a per-stall timestamp. It is the last hour only, matching /system.

Approved

Clean. MCP system keeps its admin/telemetry:read gate, adds stalls from stallHour capped at TOP_ROUTES and rounded, no new input, no dependency. The test would fail without the change. Minor, not blocking: the cut can drop the zero-count watched flow row, as scout noted.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs