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

Talk's origins answers tidily: repos finds the account without an id, a page of one-line rows with the total #16402

Merged opened this

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

Merged

In production Talk's first origins {action:"repos"} had no id and failed, and the listing it then read came to about 92,000 characters. repos now finds the account: the id given, or a word naming one (github, a host), or with none the person's only account; several and no word are named in one line (login, host, id).

Notes

shipped production is serving it deploy 3fede26

opened this

In production Talk's first origins {action:"repos"} had no id and failed, and the listing it then read came to about 92,000 characters. repos now finds the account: the id given, or a word naming one (github, a host), or with none the person's only account; several and no word are named in one line (login, host, id). It answers 50 rows a page, one line each (name, private or public, fork, its copy here), with total and next_cursor sent back as cursor; full gives every field. A list read whole (the cache, GitHub's group) is paged here with an o: cursor; a forge's own page of a group keeps the origin's cursor. Archived is not in the cached listing, so a line does not say it.

Try: in Talk, ask "which of my GitHub repositories can you see?" and see one page of short lines with the total No look: no page changes; the MCP tool's answer only No door: the terminal already lists an origin's repositories a screen at a time (Migrate, its filter); the page size and the one-line rows are for the agent's reply, which has no terminal twin Direction: Talk works with origins, the person's repositories hosted elsewhere, from the production test of 11-25 (#10262), ahead of #6534

Co-Authored-By: Claude Fable 5 <[email protected]>

--- Found on production 0.7.656 (conversation 01m88ktaebbwnyhfjxhzs5ka3x): asked for his GitHub repositories, the agent's first origins repos call failed for want of an id, and the listing it then got was about 92,000 characters. One commit.

🤖 Generated with Claude Code

Changes requested — before the latest push

No security finding: the origin is resolved only from listUserOrigins(user), so a guessed id or word reaches nothing of anyone else's, and the changed tests pass here. These are the changes I need, all in one round.

  1. Dead code, src/http/mcp/tools/origins.ts, end of run. After repos now returns early, the closing return bad("bad_action", ...) can never run, because the action was already validated above. Remove it, or restructure so run ends on the sync/inventory branch.
  2. The group path's cursor condition is muddled. cursor === undefined || local > 0 || cursor.startsWith("o:") ? {} : { cursor } has a redundant local > 0, since local > 0 already implies the o: prefix. Say it once: pass cursor to the origin unless it is an o: cursor. Also say in one comment why a group read that comes back with next === null is paged locally and a forge's own page is not.
  3. Tests for behaviour the pull adds are missing. Nothing asserts: (a) the fork and here as owner/name parts of a repo line, which are a new output format; (b) that a group read without full returns one-line strings, since every group test now passes full: true; (c) that full: true without a group returns objects, which is the only case mcp-origins covers; (d) that a group read of a cached whole list (not a forge page) returns the o: cursor and walks to the end; (e) that an unknown id or word gives not_found with the account list. Add tests that would fail without each.
  4. The no-group repos answer changes shape from an array to { total, items, next_cursor }, and items default to strings. Say so in the origin's feature how-to under docs/features/ (forge-origin.md or the page that already describes Talk's origins reads) in one line, so the shape has a written home. The README is capped, so do not put it there.
Approved

I couldn't fetch my earlier review or the old head (1cb52c8c4a6d isn't in the clone), so I read the current change whole. It's clean.

  • Account scoping: originFor resolves id only against listUserOrigins for the caller. A word like github or a host can't reach another person's origin, and the error lists only the caller's own accounts.
  • Cursor: the o: cursor is parsed with parseInt, clamped at 0 and used only as a slice offset. An origin's own cursor is never mixed with it.
  • Output size: pages are capped at 50 one-line rows, and full is opt-in. The only user text in a row is the repo name.
  • Tests: they cover paging to the end, total, the id-less and word-named account cases, the several-accounts error and the no-accounts error. They also cover the fork and here as markers and the o: cursor for a group read whole.
  • Docs: the how-to is in docs/features/talk.md, not the README.

Non-blocking: originFor returns {id} or a bad result and the caller tells them apart with "id" in found. A small discriminated type would be clearer.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs