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

A forge link's page shows its crew working right now: the last three runs of the new forge, with no sign-in #13694

Merged opened this

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

Merged

A forge link's claim page now shows the crew at work, with no sign-in. It lists up to three agent runs, live ones first, then the most recent finished ones. When the forge has no runs, it says "Your crew is starting.

Notes

shipped production is serving it deploy 59903fa

opened this

A forge link's claim page now shows the crew at work, with no sign-in. It lists up to three agent runs, live ones first, then the most recent finished ones. When the forge has no runs, it says "Your crew is starting. Its first work shows here." The two new tests, the existing forge-link landing and expiry tests, tsc and the design lint all pass.

  • What a line says: each one gives who ran it, which repo, what it was for, and its state ("working now", "waiting to start", "finished", "stopped with a problem", "cancelled"). "What" is the run's issue title, or its summary or reason if there is no issue.
  • Where it shows: under the form on both the /claim page (a link someone was sent) and the /welcome page (your own forge).
  • Privacy and speed: it reads one query on the forge's own database, and every value is escaped.
  • New modules: src/core/crew_now.ts reads the runs and src/web/crew_now.ts renders them. I made new modules rather than editing forge_made.ts, first_week.ts or pages/forge-ready.ts, which the issue listed. Those serve the sender's waiting page and the signed-in home, and this page is the claimant's.
  • Tests: test/link-crew-now.test.ts covers a forge with no runs and one with four runs (three shown, live first, HTML escaped).

I left out live updating, so the list is a snapshot from when the page loads. I also didn't add the three next steps (everyday account, open apps, tell the crew) to this page.

To try it, open a forge link with no cookie and read "Your crew, right now" under the form.

I had to add a "Try:" line to the commit message because the pre-push hook requires one.

Closes #13666

10 earlier comments · 2 events
commented

A forge link's claim page now shows the crew at work, with no sign-in. It lists up to three agent runs, live ones first, then the most recent finished ones. When the forge has no runs, it says "Your crew is starting. Its first work shows here." The two new tests, the existing forge-link landing and expiry tests, tsc and the design lint all pass.

  • What a line says: each one gives who ran it, which repo, what it was for, and its state ("working now", "waiting to start", "finished", "stopped with a problem", "cancelled"). "What" is the run's issue title, or its summary or reason if there is no issue.
  • Where it shows: under the form on both the /claim page (a link someone was sent) and the /welcome page (your own forge).
  • Privacy and speed: it reads one query on the forge's own database, and every value is escaped.
  • New modules: src/core/crew_now.ts reads the runs and src/web/crew_now.ts renders them. I made new modules rather than editing forge_made.ts, first_week.ts or pages/forge-ready.ts, which the issue listed. Those serve the sender's waiting page and the signed-in home, and this page is the claimant's.
  • Tests: test/link-crew-now.test.ts covers a forge with no runs and one with four runs (three shown, live first, HTML escaped).

I left out live updating, so the list is a snapshot from when the page loads. I also didn't add the three next steps (everyday account, open apps, tell the crew) to this page.

To try it, open a forge link with no cookie and read "Your crew, right now" under the form.

I had to add a "Try:" line to the commit message because the pre-push hook requires one.

commented

<!-- look-pages f505b2a75d1d --> Look pages for f505b2a, from the gate:

  • look pages (none): this pull changes src/web/crew_now.ts, src/web/pages/claim.ts but the forge could not trace the route of /settings/security/controls (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

The gate asked for a page declaration, and it needs no code change. I didn't run the tests or push again.

Looks: /claim

The change renders a "Your crew, right now" section on the forge-link claim page. That is /claim#token, and it needs no sign-in. The gate looked for /settings/security/controls, and I don't know why, because this pull doesn't touch that route. src/web/crew_now.ts is a shared fragment that only src/web/pages/claim.ts uses. The new section comes from src/core/crew_now.ts and shows the last three runs of the new forge's crew. When there are none, it says the crew is starting. test/link-crew-now.test.ts covers both cases.

What I left out: live updates. The section is server-rendered once per load.

To try it: open a forge link (/claim#token) without signing in and read "Your crew, right now" under the form.

commented

I added a "No door:" line in a commit message and pushed it as 6ef21ad36. The gate now passes the "both doors" rule. I ran bun scripts/gate.ts locally but not the tests, and I didn't re-run the forge's check.

  • No door: I added no terminal screen or how-to doc. A forge link is claimed before anyone has an account or a terminal login, so the "Your crew, right now" section on /claim#token has no terminal side.
  • Look pages: The gate still prints a look-pages note. It is advisory, and it did not fail the check. My "Looks: /claim" line is rejected because /claim isn't listed under app.looks in forge.json. The gate also still can't trace the route it names, /settings/security/controls, which this pull doesn't touch. A reviewer should look at /claim#token. The note may need a "No look:" line instead, and I didn't add one.

The change itself is the same as before: a forge link's page shows the last three runs of the new forge's crew, or says the crew is starting. It has no sign-in and no live updates. test/link-crew-now.test.ts covers it.

commented

<!-- look-pages 6ef21ad36766 --> Look pages for 6ef21ad, from the gate:

  • look pages (none): "Looks: /claim" is not a page of app.looks in forge.json; this pull changes src/web/crew_now.ts, src/web/pages/claim.ts but the forge could not trace the route of /settings/security/controls (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 pushed a commit that declares no look page, and bun scripts/gate.ts now prints nothing.

I didn't use "Looks: /claim" last time because /claim isn't in app.looks in forge.json. The page only works from a forge link with a token, so I haven't added it to app.looks. The commit message now says: "No look: /claim is a token-bearing link page that no listed look page shows, and the section is fully covered by test/link-crew-now.test.ts".

The gate also still can't trace /settings/security/controls. This pull doesn't touch that route, so I left it alone.

I didn't re-run the tests or the forge's check. The only change since the last push is an empty commit that carries the message.

Reviewers can see the new section by opening a forge link (/claim#token) without signing in. It is under the form as "Your crew, right now".

Changes requested — before the latest push

Changes needed, in one round:

  1. HIGH: the unauthenticated claim page lists runs from every repo, private ones included. Repo names, issue titles and run summaries leak to anyone who can reach the page. Restrict to public repos, or show only who and a generic state.
  2. The query scans and sorts all agent runs on every anonymous hit. Bound it (indexed lookup, or two LIMITed queries: live, then latest finished). Add a test for the under-50 ms claim, or drop the claim.
  3. Design: hand-rolled <b> and <ul class=list> markup instead of the named row component. Use the row pattern from docs/DESIGN.md, and make the empty state one confident sentence.
  4. Tests: the header comment is copied from another test and describes the wrong thing. Add a test that private repos do not appear, and one that a failed or cancelled run shows its state.
  5. Both doors: the 'No door' reasoning is plausible, but /welcome is the owner's own forge, which has a terminal. Say how the terminal shows this, or why it does not.
commented

The forge link's page now shows only public-repository agent runs, reads them with bounded queries, and uses the row markup. I pushed the changes to the same branch. test/link-crew-now.test.ts passes (4 tests), and tsc, scripts/gate.ts --fix and design-lint are clean. I ran only that one test file, not the full suite.

What changed

  1. Private repos no longer leak. The query joins on p.visibility = 'public', so private repo names, issue titles and summaries never reach an anonymous visitor.
  2. The read is bounded. It now does one LIMIT 3 read per state, newest first. The live states are running and queued, and the finished ones are ok, failed and cancelled. The finished reads only happen when fewer than three runs are live. Each read goes through the existing run_kind_state index, so the cost no longer grows with the number of runs. A test stores 5,000 runs and asserts the read takes under 50 ms.
  3. Design. Each run is a row item: the work is the title, "who on repo" is the muted meta line, and the state in plain words trails on the right. The empty state is now one sentence: "Your crew is starting, and its first public work shows here."
  4. Tests. I rewrote the header comment for the crew-now behaviour. One new test checks that a private repo's runs never appear. It also checks that a failed run reads "stopped with a problem" and a cancelled run reads "cancelled".
  5. Both doors. The commit's No door: line now gives the reason. The link opens before the owner has an account or a terminal login, so there is no terminal session to show it in. Once the link is claimed, the owner's signed-in terminal already shows the same runs, public and private. I did not add a screen.

Left out: no new index or migration, because the existing index covers the read. I did not open /welcome in a browser. The sandbox blocked the preview host, so the checks ran only in the test suite.

commented

I fixed the two failures that came from my change and pushed. The crew-concurrency failure I did not touch, because nothing in my diff relates to it.

  • Wall-clock test: the "under 50 ms" test was rejected because a test may not use a clock. It now counts work: with 5,000 stored runs, reading the crew costs one SQL statement and returns three rows, checked with once and expectWork.
  • Page statement budget: my five per-state queries pushed /claim past its SQL budget of 14. crewNow now runs one statement that joins five LIMIT 3 reads, one per state, and merges them in code, with live runs first. Public-only filtering is unchanged. /claim measures 11 statements warm; I ran only the statement-budget test in test/page-budget.test.ts.
  • Other checks: test/link-crew-now.test.ts passes (4 tests), and tsc and gate --fix are clean.
  • Concurrency failure: "the crew's concurrency and shard count…" hit its 30 s timeout. I did not run it here, so I can't say whether it is a flake or a real problem. If it fails again on this push, I'll look at it.
  • Client-size failure: the check log says test/client-size.test.ts is also red on main, so it isn't counted against this pull.
Changes requested — before the latest push

The section works and the earlier privacy leak is fixed: public repos only, bounded read, row markup, escaped output. One round of fixes remains.

Fix first: the both-doors rule. AGENTS.md says a pull that edits an existing page, or a shared src/web/ file, changes something under src/tui/ and adds docs/features/<name>.md. This pull edits src/web/pages/claim.ts and adds src/web/crew_now.ts, and it has neither. The commit's 'No door:' line is not enough on a strict reading, because crewNow already reads plain data. Add a small terminal screen or palette entry that shows the same three runs (for example, extend the existing flow or first-week screen), and a docs/features/crew-now.md. Do not put the how-to in README.

Also:

  • Principle 1: the heading 'Your crew, right now' and the state words both explain the same thing. Keep one sentence.
  • Principle 3: the section sits directly under the form with no spacing class. Give it the page's rhythm, since the empty state is a bare muted line.
  • Tidy: data-live is not read by any CSS or test beyond counting, so it is dead markup. live is computed twice. The comment above STATES describes the whole query. crewNowBlock is a one-line wrapper.
  • The /claim page cannot be seen in a look picture, so I judged it from the served HTML.

Ticks: boxes 1, 2 and 4 are met. Box 3 (stored state, under 50 ms, nothing private) is met in code and by the bounded-work test.

commented

The page a forge link opens (/claim, and /welcome for a forge's first account) ends with the crew at work: up to three agent runs from public repositories, waiting or working ones first, then the latest finished. Each run shows what it is for, who ran it on which repository, and its state in plain words. Before any run exists, the section says the crew is starting. No sign-in is needed. This round makes the review's changes:

  • Both doors: a new terminal screen, src/tui/screens/crew_now.ts, shows the same three runs in the same words. Its palette command, "Your crew's latest work", sits in forgeCommands and not in ENTRIES, because it is offered to everyone and AGENTS.md puts such entries there. The state words and the "starting" sentence moved into src/core/crew_now.ts so the page and the terminal share them. The how-to is docs/features/crew-now.md, listed in docs/features/README.md; the top-level README is unchanged.
  • Principle 1: the heading is now just "Your crew's latest work". "Right now" is gone, and each row's state words alone say whether it is live.
  • Principle 3: the section takes the page's spacing with class="mt", in both the empty and filled states.
  • Tidy: data-live and the live field it came from are removed. The live check is defined once. The comment about the whole query now sits on ALL. The crewNowBlock wrapper is gone, so claim.ts calls crewNowHtml(crewNow(ctx.app.db)).

test/link-crew-now.test.ts now checks:

  • the spacing class is on the section;
  • the new heading shows, and is absent when there are no runs;
  • the row count, using the row markup in place of data-live;
  • that a live run comes before a finished one;
  • that the terminal's lines match the page's words.

The terminal test checks the screen's lines, not its drawing: the gate refuses fake objects built with as never in tests, so drawing the screen and running the palette command have no test. The commit has a Direction: line because the gate's "pipeline first" rule asks for one. This page has no before/after pictures, since no listed look page shows /claim; the commit says so in a No look: line.

bun scripts/gate.ts, bun x tsc --noEmit, bun scripts/design-lint.ts and the covering tests pass: the crew test, the feature-list check, the palette tests and eight test files that use forgeCommands. scripts/fast.ts named 2,293 test files, about three hours of tests, so I ran those files instead and left the full suite to the forge's check.

To try it, open /claim on a forge link with no cookie and look under the form. In the terminal, open the palette and choose "Your crew's latest work".

🤖 Generated with Claude Code

commented

I merged main into the branch and kept both sides in the two conflicts:

  • src/web/pages/claim.ts: main wrapped both claim layouts (the "Make your account" form and the "This forge is yours" form) in <div class="shell"><div class="narrow">…</div></div>. This branch's crewNowHtml(crewNow(ctx.app.db)) section stays as the last child of the inner narrow column in both, with the closing tags now matching the new wrapper.
  • docs/features/README.md: both new entries are listed, "The crew on a forge link's page" from this branch and "A hosted forge proposes to its parent…" from main.

scripts/gate.ts --fix rewrapped comments in 14 files that came in from main; those changes are in the merge commit. tsc --noEmit is clean, design-lint passes, and 64 tests in 8 files pass: the crew and claim suites, plus home-kpi-row and no-alarm-banner. During the run the sandbox blocked network requests to maria--forge.test and kai--forge.test; none of the tests failed.

🤖 Generated with Claude Code

commented

The roster in the command palette and the claim page now show the crew's latest work: the three runs a forge link's page shows. Before this, the work was only on the link page itself.

What to review

  • src/web/pages/claim.ts: main had wrapped both claim layouts ("Make your account" and "This forge is yours") in <div class="shell"><div class="narrow">. In both, the crew section (crewNowHtml(crewNow(ctx.app.db))) stays as the last child of the inner column, and the closing tags match the new wrapper.
  • test/palette-roster.test.ts: this test came from main and pins the palette's full roster for each kind of session. The new crew-now entry ("Your crew's latest work") is added just before status in all four lists. The test was right; it just didn't know about this branch's new entry yet. The code is unchanged.
  • docs/features/README.md: lists both this branch's crew page and the parent-proposal feature from main.
  • Comment rewrapping: scripts/gate.ts --fix rewrapped comments in 14 files that came from main; those changes are in the merge commit.

Checks: bun x tsc --noEmit and design-lint are clean. I ran the palette-roster test (15 pass) and the crew-now and claim tests (64 pass), not the whole suite. While they ran, the sandbox blocked requests to maria--forge.test and kai--forge.test; no test failed because of it.

To try it: open a forge link's claim page on the preview and look under the account form, or open the palette and choose "Your crew's latest work".

🤖 Generated with Claude Code

Approved

Every earlier ask is met. Private repositories are filtered out in the query (public only). The read is one statement of five LIMITed lookups, and a test pins its cost at one statement and three rows with 5,000 runs stored. The section uses the row pattern, with one plain sentence for the empty state and the page spacing class. The test header is rewritten, and there are tests for private repositories and for failed and cancelled runs. The terminal screen is there, with docs/features/crew-now.md, and the README is untouched. The preview's /claim serves the section with the heading "Your crew's latest work". It works with JavaScript off because it is server-rendered.

Next, two things:

  1. Non-blocking: the diff carries about 14 files of comment rewraps from gate --fix that have nothing to do with this change. In future, land them in their own pull so this one stays single-purpose.
  2. Non-blocking: add a test that draws the terminal screen and runs the palette command, so the terminal door is covered beyond its lines.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs