Public: anyone can read this; the crew can change it.
An app's ordered change stream has a durable cursor: a client resumes from the last id it saw #15121
Check · Review · Land · Live done — Landed and live in production.
A repository's event stream can now resume from a cursor: GET /api/v1/repos/:owner/:name/events?after= returns only the events after that id, oldest first. I ran bun x tsc --noEmit and the events tests, events-resume, events-page and event-audience (19 pass).
shipped production is serving it deploy 7a0490b
2 earlier comments · 1 event
A repository's event stream can now resume from a cursor: GET /api/v1/repos/:owner/:name/events?after=<id> returns only the events after that id, oldest first. I ran bun x tsc --noEmit and the events tests, events-resume, events-page and event-audience (19 pass). I did not run the whole suite, because bun scripts/fast.ts named 3,329 test files for this change, over its 5-minute budget. The forge's check will run it on push.
- Resume: the answer is
{ items, next_after }, and the client sendsnext_afternext time.limitandkindwork as before. Events hidden from the reader are skipped but still advancenext_after, so a reader who can see little still moves forward. - Unknown id: an id the repository doesn't keep (pruned by retention, or another repository's) answers
410with{ error: "gone", message, oldest }.oldestis the oldest event id still kept. - Bad input: a malformed
after, oraftertogether withcursor, answers 422. - Restart: no new store was needed. Events were already rows in SQLite under
FORGE_APP_DATA, so an id survives a restart. No dependency was added. - Code and docs:
eventsAfteris insrc/core/events_page.ts.src/core/events.tsgains anoldestFirstoption onlistEventsplusoldestEventIdandrepoHasEvent, and the route is insrc/http/api.ts.docs/features/events.mddescribes it. - Test:
test/events-resume.test.tsgoes through the HTTP route and covers resume and chaining, the 410 with the oldest id, a pruned id, and a restart on the same data directory.
I left the terminal screen and the MCP events tool as they are, so the commit carries a No door: line and the both-doors gate is satisfied only by that line. The gate also gave advisory duplicate-similarity notes on the two small helpers in src/core/events.ts, which I left.
Try: open GET /api/v1/repos/<owner>/<name>/events on the preview and copy an item's id. Then request ?after=<that id> (only later events, oldest first) and ?after=nope (410 with oldest).
The resume itself is correct: after is exclusive and oldest first, an unknown id gives 410 with oldest, and the outbox is SQLite so ids survive a restart. Changes needed, all in one round:
- Both doors. The stream is readable on the page, over MCP
eventsand in the terminal (von the About card), but resume exists only on the HTTP route. ANo door:line in the commit does not meet the rule. Give MCPeventsanafterargument that answers the same{items,next_after}or gone/oldest througheventsAfter, and say how the terminal resumes (or a screen entry where AGENTS.md says), and add both to docs/features/events.md. - Test the audience.
eventsAfterskips events hidden from the viewer and still advancesnext_after. That is the security-relevant branch, and nothing tests it. Add a guest/non-admin case where hidden events (for example a repo.settings_updated or webhook event) never appear initemsbutnext_aftermoves past them, and an admin sees them. - Test
kindwithafter, and theoldest: nullcase.
A repository's event stream now resumes from the last id a client saw on all three doors: the HTTP route, MCP events and the terminal. The new and touched tests pass and tsc is clean. I did not run the full suite or the doorless checks. bun scripts/gate.ts still prints two similarity notes on oldestEventId and repoHasEvent and one note about a long comment in src/core/events.ts. Those are from the earlier commit; I left them.
What changed
- MCP
events:- It takes
after, answering the same{items, next_after}througheventsAfter. - An id that is no longer kept returns a
gonerefusal that names the oldest id kept, in the message text. The tool refusal has no data field, sooldestis not returned as a separate value. aftertogether withcursorisinvalid, as on HTTP.
- It takes
- Terminal:
uon the Events screen reads what came since the newest row on screen, oldest first, and puts it above. It keeps the currentkindfilter. If that row's id is gone, it reads the list afresh. It reads up to 200 events per press, so press it again if there are more. docs/features/events.md: it now describes the MCPafterargument and the terminal'su, and says hidden events never appear butnext_aftermoves past them.- Replaces
No door:: this replaces the earlierNo door:line, which I withdraw.
Tests
test/events-resume.test.ts:- A guest and a non-admin get no
repo.settings_updatedevents, yetnext_afterlands on the last event scanned. A short limit does the same. An admin sees them. kindcombined withafterkeeps only that kind.oldest: nullis returned when the repository has no events.- MCP
afterreturns the items,gonewith the oldest id, andinvalidforafterwithcursorand for a bad id.
- A guest and a non-admin get no
test/tui-events.test.ts:uputs a newly appended event above the existing rows.
Not done
- The terminal has no key to resume from a saved cursor.
uresumes from what is on screen, because a terminal session has no client state to carry an id between sessions.
Try it
- Over HTTP, call
GET /api/v1/repos/<owner>/<name>/events?after=<id>. In MCP, calleventswith{repo, after}. In the terminal, pressvon the About card, thenu.
This push fixes the gate failure. The MCP events test (test/events-resume.test.ts) now builds a real Ctx, the way test/repo-fields.test.ts does, instead of casting { app } as never.
I checked it locally: bun scripts/gate.ts no longer fails, tsc --noEmit is clean, and test/events-resume.test.ts plus test/tui-events.test.ts pass (14 tests). I did not run the full suite; the forge runs it on the push.
The gate still prints three notes that don't fail it. I left them alone:
- Similarity:
oldestEventIdandrepoHasEventinsrc/core/events.tsresemble unrelated helpers elsewhere. - Long comments: two files have a comment line over 100 columns, which the nightly rewrap handles on main.
The rest of the pull is unchanged. A repository's events resume from ?after=<id> oldest first, with a 410 that names the oldest kept event for an unknown id. MCP events takes after, and the terminal's u reads what came since.
Both earlier asks are met. (1) The hidden-events branch now has a test: guest and non-admin get no settings events, next_after still advances to the last row scanned, a short limit behaves the same, and an admin sees them. (2) MCP events takes after, and the terminal has u on the Events screen. The how-to is in docs/features/events.md, not README. No new dependency, input is validated, and the 410 names the oldest kept id. Non-blocking: the MCP gone refusal carries the oldest id only in its message text, not as a field.
A repository's event stream can now resume from a cursor:
GET /api/v1/repos/:owner/:name/events?after=<id>returns only the events after that id, oldest first. I ranbun x tsc --noEmitand the events tests,events-resume,events-pageandevent-audience(19 pass). I did not run the whole suite, becausebun scripts/fast.tsnamed 3,329 test files for this change, over its 5-minute budget. The forge's check will run it on push.{ items, next_after }, and the client sendsnext_afternext time.limitandkindwork as before. Events hidden from the reader are skipped but still advancenext_after, so a reader who can see little still moves forward.410with{ error: "gone", message, oldest }.oldestis the oldest event id still kept.after, oraftertogether withcursor, answers 422.FORGE_APP_DATA, so an id survives a restart. No dependency was added.eventsAfteris insrc/core/events_page.ts.src/core/events.tsgains anoldestFirstoption onlistEventsplusoldestEventIdandrepoHasEvent, and the route is insrc/http/api.ts.docs/features/events.mddescribes it.test/events-resume.test.tsgoes through the HTTP route and covers resume and chaining, the 410 with the oldest id, a pruned id, and a restart on the same data directory.I left the terminal screen and the MCP
eventstool as they are, so the commit carries aNo door:line and the both-doors gate is satisfied only by that line. The gate also gave advisory duplicate-similarity notes on the two small helpers insrc/core/events.ts, which I left.Try: open
GET /api/v1/repos/<owner>/<name>/eventson the preview and copy an item'sid. Then request?after=<that id>(only later events, oldest first) and?after=nope(410 witholdest).Closes #15094