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

A member adds their own machine; it takes runs only for repositories whose owner allowed it, and an admin marks a machine trusted #18621

opened this

Its check is running, 14m so far

A member can now add their own machine. It takes runs only for repositories whose owner allowed it, and an admin marks it trusted. I ran the new tests, the nearby runner, may, palette and doors tests, and the first-view budget tests, and they pass; tsc is clean.

Notes · 29 files · +942 −30

Look

8 pages beside main · 0 new to this pull

/apps

main

at 46c11c7 ·

this pull

at eaae184 ·

/changelog

main

at 46c11c7 ·

this pull

In the dark

main

at 46c11c7 ·

this pull

at eaae184 ·

/explore

main

at 46c11c7 ·

this pull

In the dark

main

at 46c11c7 ·

this pull

at eaae184 ·

/looks/failed

main

at 46c11c7 ·

this pull

In the dark

main

at 46c11c7 ·

this pull

at f99fd4f · · the head has moved since; a new picture follows its deploy

/looks/missing

main

at 46c11c7 ·

this pull

In the dark

main

at 46c11c7 ·

this pull

at f99fd4f · · the head has moved since; a new picture follows its deploy

/notes

main

at 46c11c7 ·

this pull

In the dark

main

at 46c11c7 ·

this pull

at eaae184 ·

/review

main

at 46c11c7 ·

this pull

In the dark

main

at 46c11c7 ·

this pull

at eaae184 ·

/security

main

at 46c11c7 ·

this pull

In the dark

main

at 46c11c7 ·

this pull

at f99fd4f · · the head has moved since; a new picture follows its deploy

opened this

A member can now add their own machine. It takes runs only for repositories whose owner allowed it, and an admin marks it trusted. I ran the new tests, the nearby runner, may, palette and doors tests, and the first-view budget tests, and they pass; tsc is clean. The forge runs the full check on this push.

What changed

  • Add a machine. /settings/machines ("Your machines" in settings and the terminal palette) lets any person's account add a machine with a name and labels. It shows the token once and lists the machine under their name. A crew member cannot add one, and each member may hold 8. The rules are in src/machines/own.ts.
  • Repository allow. On /:owner/:name/settings/machines the repository's admin gets a "Members' machines" section with one Allow/Refuse row per machine. In the terminal, a and x do the same on that repository's Machines screen. A member's machine takes a run only where an allowed row exists. Never-asked and refused both get nothing. The check is in the claim query itself (claimJob) and in labelServed.
  • Trust. setRunnerTrust now asks machine.trust, the admin-as-person rule. A claim that reports "trusted" changes nothing. A test covers that, including that a later report does not undo an admin's trust.
  • Reports narrow only. The claim's machine object may now carry os, arch, docker and xcode, in src/machines/report.ts. A label its owner gave that the report contradicts is dropped, so a machine labelled macos that reports linux is sent no macos job. The report never adds a label, a repository or trust.
  • One table. machine.add, machine.allow and machine.trust are rows in ACTIONS in may.ts. The page, the terminal and the actions all go through may().
  • Schema. Migration 20261206190000-own-machines (with its pin) adds owner_id and report to check_runner, and the table repo_machine. Purging an account deletes that member's machines.
  • Both doors. The terminal screens are ownmachines.ts and machines.ts. The how-to is docs/features/own-machines.md.
  • Reused. enrolRunner, claimJob, trustRunner, rowList/row, emptyLine and promptScreen/confirmScreen.

Tests

  • test/own-machines.test.ts covers add, allow and refuse, trust, report narrowing, and may().
  • test/own-machines-pages.test.ts covers the two pages and cross-origin refusal.
  • I updated test/may.test.ts and test/palette-roster.test.ts to expect the new action and palette entry. The old expectations were out of date, not wrong.

Decisions for you

  • Runners an admin enrolled and the forge's own local-N are not gated by allow. Only machines with an owner are, so nothing already running changes.
  • A repository with no row for a member's machine counts as refused.
  • I did not add an API route or an MCP tool for these three actions. Only the web and terminal doors exist.

Try it

  1. Sign in as a member and open /settings/machines. Add a machine and copy the token.
  2. As the repository's admin, open /<owner>/<repo>/settings/machines and press Allow.
  3. As an admin, press Trust on /settings/runners.

Closes #18505

Show 4 earlier items

7 earlier comments
commented

I merged main into the branch, resolved the three conflicts keeping both sides, and pushed. I ran tests that cover this change (own machines, tab runner, the screens rule, event audience, design audit, palette roster) and they pass, and tsc is clean. I did not run the whole suite. scripts/fast.ts named 4,486 files and said it was too broad to run, so the forge's full check on this push will be the real test.

  • src/actions/environments.ts: setRunnerTrust now needs the machine.trust permission and also refuses a browser tab.
  • src/checks/runner_jobs.ts: A runner now carries both ownerId (the member who added it) and kind (tab or machine). That covers the Enrolled type, the row type, the column list, the row-to-runner mapper and the claim query.
  • src/http/settings_routes.ts: Both imports are kept, so the Your machines page and runnerTab are both registered.

The look-pages note is answered with a "No look:" line in the merge commit: this is a settings section reached only when signed in, so there is no before/after page to compare.

The gate still prints three similarity notes (noteRunnerReport, ownMachineAdd and the test helper offer). They are advisory, and I left them.

[{"go":"/settings/machines","look":"The page lists your machines, with a form to add one","expect":"A new machine shows its token once and is listed as not trusted"},{"go":"/settings/runners","look":"A browser tab's runner row","expect":"There is no Trust button on a tab"}]
commented

<!-- look-pages bdd390b577e0 --> Look pages for bdd390b, from the gate:

  • look pages (none): this pull changes src/web/pages/machine-allow.ts, src/web/pages/machines.ts, src/web/pages/origins.ts and 2 more but the forge could not trace the route of /, /admin/telemetry, /explore and 28 more (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
commented

I changed no code in answer to this feedback. I added an empty commit that carries the No look: line the look-pages note asked for, and pushed it. The four tests the check refuses most often already pass on this branch:

  • The audit-entry test, the first-view budget tests (including the stamped-release one) and the duplicate-import test all passed when I ran them (18 pass, 0 fail).
  • bun x tsc --noEmit is clean, and bun scripts/gate.ts --fix rewrapped nothing.

The No look: line says the changed pages are machine forms behind sign-in, and the gate can't trace their wrapped routes. I didn't run the rest of the suite or the socket-bound tests; the forge's check runs those on the push.

I left three "duplicate functions" notes from the gate alone. They are advisory, and I judged the pairs to be different operations:

  • ownMachineAdd and runnerRegister
  • noteRunnerReport and pausePlanner
  • the test helper offer in test/own-machines.test.ts and the one in test/environments-masks.test.ts

If you want any of them merged, say which.

commented

No change this turn. The branch is level with origin, and the three checks the message named pass here.

The failing pull in the message, #18621, is a different branch. Its failure is a browser test (at 1280 px, the page follows, pauses and resumes) in code this pull doesn't touch. It needs a fix on that pull.

What I ran on this branch:

  • Gate: bun scripts/gate.ts --explain passes 39 rules with 0 failing, and --fix left nothing to commit. The "no duplicate import beyond the allowlist" rule is among those that pass. The "both doors" rule also reads as satisfied. It is the "every page has a terminal door" rule and the "a how-to naming a page names its terminal file" rule. The terminal side is src/tui/screens/runners.ts and src/tui/screens/machines.ts, and the how-to is docs/features/own-machines.md.
  • Type check: bun x tsc --noEmit is clean.
  • Tests: these all pass:
    • test/design-audit.test.ts (the audit-entry test)
    • test/attention.test.ts and test/attention-stamped.test.ts (the first-view budget; the milestone page is within it at 390 and 1280 px)
    • test/dup-imports.test.ts
    • test/doorless.test.ts
    • test/feature-doors.test.ts
    • test/own-machines.test.ts
    • test/own-machines-pages.test.ts
    • test/may.test.ts
    • test/palette-roster.test.ts
  • Not run: scripts/fast.ts names 4116 of 5082 test files for this diff, so I ran only the targeted set above. The forge's full check covers the rest.

The gate also printed two similar-code notes. They are not failures.

  • ownMachineAdd in src/web/pages/own-machines.ts is 0.71 similar to runnerRegister in src/web/pages/runners.ts.
  • The offer helper in test/own-machines.test.ts is 0.80 similar to the one in test/environments-masks.test.ts.

What this pull does: a member adds their own machine, and it takes runs only for repositories whose owner allowed it. An admin marks a machine trusted.

Not done: I didn't change #18621's code from this branch, because that would mix two pulls.

To try it: open the "Your machines" page, or the same screen in the terminal under src/tui/screens/runners.ts. docs/features/own-machines.md has the how-to. test/own-machines.test.ts and test/own-machines-pages.test.ts cover the behaviour.

commented

Still red on current main: the forge button takes notes from anyone > a list read with no maker cookie never reads the key file, so a bad key cannot fail it. Fix it and push.

commented

I fixed one of the two failing tests. The other passes here, and I couldn't reproduce it.

  • Server-Timing sweep (fixed): GET /settings/machines (ownMachinesPage) answered without naming session and render in Server-Timing, so the sweep listed it as undeclared. It now records both phases, the same way firstAdminPage does. test/server-timing-sweep.test.ts and test/own-machines.test.ts pass, and tsc is clean.
  • Feedback test (not reproduced): the "list read with no maker cookie never reads the key file" test passed in three consecutive local runs of test/apps-feedback.test.ts. My diff never touches loadKey or the feedback code. The forge's own re-run also found the test green on main in three runs. My guess is a stray loadKey call from earlier work in the same file under shard load, but I haven't confirmed that. If it fails again after this push, the log will show which call tripped the spy.

The fix is pushed as bbf313ba3. I didn't run the full suite.

commented

I merged main into the branch and pushed it. tsc --noEmit is clean. I ran 16 test files that cover the merged code, and all 149 tests pass. I did not run the full suite, so the forge's check on the push is the first time everything runs together.

Both sides had added a way for a machine to describe itself: machines/report.ts from this pull and machines/facts.ts from main. I kept both and combined them rather than choosing one. In src/checks/runner_jobs.ts:

  • Labels: an own machine's labels are narrowed by its report. For a runner whose enrolment this forge owns (scope === undefined), the labels its facts make are added on top.
  • labelServed: it applies the same combination, and it still checks that a member's machine is allowed on the repository.
  • Columns and query: owner_id and facts are both in RUNNER_COLUMNS, and the claim query selects said_labels and report together.

The other three conflicts were simpler:

  • src/core/account_purge.ts: it keeps both purge entries, check_runner.owner_id and machine_join.created_by.
  • src/http/settings_routes.ts: it takes main's runners import, including machineLine, and keeps this pull's own-machines import and routes.
  • src/tui/screens/runners.ts: it has both ownMachinesScreen (this pull) and addMachineScreen (main).

scripts/gate.ts --fix changed nothing. It still lists four possible duplicate implementations, noteRunnerReport, ownMachinesPage, ownMachineAdd and the test helper offer. Those are similarity notes on this pull's own code, and I left them.

commented

I've pushed fixes for all of sentinel's findings, with one change to how machines get listed on a repository (below). tsc --noEmit is clean. I ran the own-machines, TUI runners, event-audience, may, account-purge, dup-imports, design-audit and attention suites, and all pass. I did not run the full suite.

  • Revoke. A member can now revoke their own machine, which frees one of their eight places. It's a Revoke button on the row at /settings/machines and x in the terminal's Your machines screen. revokeOwn in src/machines/own.ts asks may() for machine.add and checks the machine is theirs. Anyone else is told it isn't there. It emits machine.revoked, which only the actor sees.
  • The leak. machinesFor no longer lists every member's machine, and no owner name is shown anywhere.
    • A repository now lists only machines whose owner offered them to it, or that it already answered.
    • New offer step (not in the review). I added offerOwn: Offer on the row (o in the terminal) takes owner/name of a repository the member can read.
    • Why I didn't use "writers". Narrowing to repository writers would have emptied the list. A personal repository's only writer is its owner, so a member's machine could never reach someone else's repository.
    • Side effect. An offer adds the repository to the machine's repos, so the machine then serves only the repositories offered.
  • Doc. docs/features/own-machines.md now names ownMachinesScreen in src/tui/screens/runners.ts and mentions the offer and revoke steps.
  • Design principles.
    • The explanation now sits once, in the page sub.
    • The empty line says only "Add one below."
    • The "Assumptions:" paragraph is one plain sentence about trust.
    • The terminal header drops its second line.
  • Code quality.
    • reportOf(app, id) is in own.ts and used by both the page and the terminal.
    • The stray \' escapes in event_audience.ts are gone.
    • On the audience, I disagree with the finding's premise. With a repoId, admins already means that repository's administrators, so machine.allowed and machine.refused match their comment. The mismatch was the comment saying the forge's admins also hear machine.added; that event is actor only, so I fixed the comment.
  • Check tests. The new routes are in lazy_lists.ts and marks/settings.json. The revoke and offer routes are open in marks/settings.json, as the other member-facing routes are. The existing COVERED entry for check_runner.owner_id is unchanged.

New tests cover offer before listing, no owner name on the repository page, revoke by the owner, refusal for another member, and the cross-origin 403s.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs