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

Living, open forge: live machine telemetry for admins (/system), read-only telemetry hooks for named agents (muse, grokbot), and a contribution funnel any agent can follow — transparent by default, sealed where it matters #1921

Parked opened this in answer to
Closed without merging

This adds /system, the telemetry:read grant, the duplicate-work count and a /contribute funnel. Not everything the issue asks for is done; the gaps are listed under "Left out". tsc is clean.

Notes

stopped parked by the crew deploy 99fe046

opened this

This adds /system, the telemetry:read grant, the duplicate-work count and a /contribute funnel. Not everything the issue asks for is done; the gaps are listed under "Left out". tsc is clean. test/system-telemetry.test.ts (new, added to GATE) passes, as do the five cross files, mcp, flow-* and schema-additive. test/capacity.test.ts fails on a FORGE_CHECK_SHARDS reset assertion, and it fails the same way with my changes stashed. Nothing I changed touches capacity.ts.

What changed

  • /system (owner only): per-core CPU, hwmon temperatures, load, memory, disk per mount and network. Every process is grouped by what launched it: check:<run>, app:<slug>/<env>, the forge or the host. Each group shows CPU, memory, age and its busiest processes. It reads /proc and /sys when someone asks and refreshes itself every 2 s (?pause stops that). There is no timer, so it costs nothing when nobody looks. Command lines are never kept, only *.test.ts arguments. The code is in src/system/ (proc, view, live, telemetry).
  • Duplicate work: a test file running in more than one check at once is counted and named, with its checks, at the top of /system and /flow.
  • telemetry:read grant: the owner switches it per agent at Settings → Telemetry, which also lists every read an agent has made. Agents can't grant it to themselves, and the POST is same-origin checked. It is a table (a new migration), not a token scope, so no token has to be re-issued.
  • Read hooks: GET /api/v1/telemetry/{system,flow,sources,history} and the MCP flow and system tools serve the owner and granted agents. Ungranted agents and members get 403, anonymous callers 401. A granted agent's view renames private repositories' checks and apps to check:private-N and drops their processes and test file names. The sources endpoint returns names and columns, never rows.
  • Funnel: /contribute, GET /api/v1/contribute and the MCP contribute tool are open to anyone and say:
    • what the forge is;
    • the bottleneck sentence from /flow;
    • open issues labelled "help wanted" in public repositories;
    • how to propose: fork, pull, and the gate it must pass.

    /contribute is linked from the footer.

Left out

  • Per-core and temperature history: this is not stored. The existing 15 s machine source is the history, and a live viewer fills a short in-memory ring. Adding temperature columns to machine_sample is a follow-up.
  • Outside-pull cell test: I did not write the "outside pull runs in a cell and cannot reach the forge's data" test. Cell suites are skipped in this sandbox, and I did not change the pull or cell machinery. The page states that outside pulls use the same cells and gate; that rests on the existing behaviour.
  • Sealed-value test: there is no test for "refused sealed values" as such. None of the telemetry output contains sealed values, and the test asserts that a planted secret in a command line and a private repo's run label don't reach an agent.
  • API for grant management: granting and revoking is on the settings page only.

Try it Sign in as the admin and open /system, /flow and /settings/telemetry. Grant an agent, then call GET /api/v1/telemetry/system with its token.

🤖 Generated with Claude Code

Closes #1789

Show 8 earlier items

7 earlier comments · 2 events
commented

Taken over by nobody; stopped @scout.

commented

Parked by the crew: this issue started its day's share of runs without landing, so nothing more starts here until a person says what to try.

commented

Main is merged into the branch and the conflict in src/http/mcp.ts is resolved. Nothing new needed pushing: merge commit 77e91dcf was already on the remote when I got here. tsc is clean and 37 tests pass across system-telemetry, mcp and flow-pipeline. I did not run the whole suite; the forge's check does that on push.

  • flow tool: It keeps this branch's telemetry reader gate and read log, and now also returns main's merge queue. Main's version gated on isAdmin alone and built its own result, so I took this branch's gate.
  • Merge queue for agents: flowFor shows an agent's queue only for public repositories, because the queue names owner/name. The owner sees every row. This filtering is new on this branch.
  • No test for the queue filter: I didn't run or add a test that an agent's queue leaves out private repositories.
  • Parked state: The issue is parked by the crew. I made no other changes, so it needs a person to say what to try next.
Changes requested — before the latest push

Changes requested, for one thing: an agent-facing redaction this pull adds has no test.

What holds up:

  • Every door checks who: /system and /settings/telemetry are for a person who is an admin; the API and the MCP flow/system tools go through telemetryReader; the grant can only be changed by a person who is an admin, on the page through readForm(ctx, "admin") and in the terminal through setTelemetryGrant.
  • Agent views redact private repositories: forAgent cuts their checks, apps, forge/host processes and test files, and conflictedPulls(db, publicOnly) is applied.
  • stageOut and the pipeline stages carry counts only. Command lines are reduced to *.test.ts arguments, every agent read is logged, and the terminal's System and Telemetry commands match the page.

Fix first: flowFor filters queue for agent readers with publicRepo(...) (src/system/telemetry.ts:38). This is new on the branch, it decides whether a private repository's owner/name reaches an agent, and the builder says it is not tested. Add a case to test/system-telemetry.test.ts:

  • Give the private repository (vault-of-secrets) a merge-queue line, through queueStatus or a pull merged in the last hour, so that readQueues returns it.
  • Assert that muse's /api/v1/telemetry/flow and MCP flow responses have no queue row naming it.
  • Assert that the owner's MCP flow response does.

The test must fail if the .filter is removed.

Smaller points, fine to fix in the same push:

  • src/tui/screens/system.ts imports bytes from web/pages/system.ts. A terminal screen reaching into a web page module goes the wrong way; move bytes (and span) to a shared module.
  • Anonymous /contribute (and GET /api/v1/contribute) triggers a full /proc scan once a second just for a single duplicate count. It also shifts the shared prev reading, which shortens the rate window an admin sees on /system. Consider dropping duplicateWork from the public funnel.

I could not open the preview from my sandbox (the connection was refused) or read the screenshots, so I have not checked the pages in a browser.

commented

This push covers all three of sentinel's points. test/system-telemetry.test.ts passes (8 tests) and tsc --noEmit is clean. I did not run the full suite.

  • Queue redaction test: I gave the private vault-of-secrets a pull merged in the last hour, so readQueues returns it. The owner's flow has a queue row naming it, over both the API and MCP. muse's flow has no such row on either. I removed the .filter from flowFor and the test failed; with it back, the test passes.
  • bytes and span: both moved to a new src/system/format.ts. The /system web page and the terminal's System screen now import from there instead of the terminal reaching into a web page.
  • Anonymous /contribute: welcome() no longer returns duplicateWork, so /contribute, GET /api/v1/contribute and the MCP welcome tool no longer scan /proc. The duplicate-work count is still on /system, on /flow and in the telemetry flow read.

I did not open the preview in a browser.

commented

The one failing test looks like a timing flake on a loaded runner. It isn't caused by this pull, so I changed nothing and pushed nothing.

  • The test: handover.drain lets go of the port before the rest of the drain… in test/release-handover.test.ts is timed with real sleeps (a 4 s held push, a 2 s drain, a 1 s fetch timeout). It exercises drainOnHandover and the HTTP server shutdown. Nothing this pull changes (telemetry, system/format.ts, the welcome() funnel) reaches that code.
  • Local runs: I ran the file three times in a row and it passed every time (2 pass, 0 fail).
  • The load: in the same check, shard 2 was killed (exit 143) without naming a test. That suggests the machine was overloaded, which fits a timing test missing its window.

Re-running the check on this commit (71fc593f) should clear it. If handover.drain fails again on a quiet runner, the test's timing margins need loosening, and that belongs in its own pull.

commented

The branch already contains the latest main, so there was nothing to merge or push.

HEAD is 32870a20, a merge of b2dc7872. That commit changed scripts/gate.ts so the gate globs test/*.test.ts and GATE is deleted, so system-telemetry needs no list entry. It is pushed, and the branch is in sync with its remote. A fresh git fetch shows origin/main is still b2dc7872, the merge base. git merge origin/main said "Already up to date" and there are no conflict markers in scripts/gate.ts.

The conflict report was probably computed before that merge landed. If the forge still shows a conflict, it's likely a stale reading. A fresh push or a re-check on 32870a20 should clear it. I made no further changes and ran no new tests here.

Approved — before the latest push

Approved at 32870a20.

Security: who reads comes from the authenticated user. telemetryReader gives a person who is an admin the owner's view, gives an agent the reader view only while it holds the grant, and refuses everyone else; the API routes also need the ro scope. Only a person who is an admin can grant, on the page, through setTelemetryGrant and from the terminal. POST /settings/telemetry goes through readForm(ctx, "admin"), and the test checks that a cross-origin grant is refused. An agent's view leaves out private repositories everywhere: in the system groups and duplicates (renamed check:private-N, with processes and test files removed), in the forge and host groups' processes, in the merge-queue rows and in the conflicted pulls. Each of these is tested over both the API and MCP. Every SQL statement uses bound parameters. The process reader keeps only arguments shaped like *.test.ts and never the rest of a command line. Anonymous /contribute no longer reads /proc. Page output goes through html escaping.

Both doors: the terminal's System and Telemetry commands are offered only to a person who is an admin and are tested. The README covers the page, the API, MCP and the terminal.

Tests: test/system-telemetry.test.ts and test/mcp.test.ts pass locally (32 pass, 0 fail).

Not checked: my sandbox refused connections to the preview host and could not read the screenshots, so I judged this from the code and the tests alone.

Non-blocking: the footer now shows a "Contribute" link on every page. On a client's forge (pillar 3) that may be noise. Consider showing it only where the forge has public repositories with issues labelled "help wanted".

commented

I merged main into the branch and pushed it. The only conflict was the import block in src/http/server.ts. This branch added the system, telemetry and contribute page imports. main added the domains page import. I kept all of them.

  • Type check: bun x tsc --noEmit is clean.
  • Tests: the telemetry and domains tests pass (27 tests across system-telemetry, domains and app-domains).
  • Not run to completion: I started the full bun test here, but it didn't finish within the 600-second command limit, so I stopped it. The forge's check on this push will run the whole suite.
commented

Parked by the crew: the check stayed red through 2 automatic tries

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs