githubnext/chopinPublic

Let's compose rich plans together

Return the canonical URL from read_document #305

Mergedlavaman131merged 1 commit intomainfromrefs/pull/305/head
  1. LA

    `read_document` returns a document's id, title, brief, source and revision, but not its readable `/documents/:owner/:repository/:slug` URL. `create_document` and `update_document` both return it, and `docs/local-agent-mcp.md` tells agents to take "the current title and canonical URL" from a fresh `read_document`. So an agent that has only a document's UUID can't get the link to give a person.

    pdd-kit hit this. When `invoke_planner` returned `planner-owner-unavailable` because nobody was signed in, pdd-plan retried the handoff by reading the document by UUID. The read had no URL, so pdd-plan refused to hand off a document whose link it couldn't confirm, and planning stopped even after the user signed in.

    ## What changes

    - `apps/server/src/mcp/hosted.ts`: `read` builds `url` from the channel's current owner, repository and slug, on both the live and stored paths. A read after a rename returns the new slug. - `apps/server/src/mcp.ts`: the `read_document` output schema includes and requires `url`. `DocumentReader.read` returns `LinkedDocument`, the type `create` and `update` already shared, renamed from `CreatedDocument` because reads use it now too. - `docs/local-agent-mcp.md`: says all three tools return the canonical URL and that a read always returns the current one. - Tests: the hosted read assertions expect `url`, and the create test checks that a read after a rename returns `/documents/octo-org/score/launch-plan`. The MCP fixtures carry `url`.

    Creation provenance (idempotency key, base branch and commit) stays out of MCP responses.

    ## Verification

    - `bun test apps/server/src/mcp/hosted.test.ts` without the `hosted.ts` change: 4 fail, all on the missing `url`. - `bun test`: 3666 pass, 3 skip, 0 fail. - `bun run types`: editor, server and web pass. - `bun run ci`: dprint, oxlint, tokens, design contract, design record and Impeccable pass, with no new findings. - Not run: a live Planner handoff against this branch. pdd-kit's handoff will be checked against `dev/integration` once this is on it.

    Assistant-model: Claude Opus 5.5 Assistant-workflow: inline Assistant-verification: bun test failed before the fix: hosted.test.ts 4 fail, the read assertions expect url Assistant-verification: bun test passed: 3666 pass, 3 skip, 0 fail, including a read after rename returning /documents/octo-org/score/launch-plan Assistant-verification: bun run types passed: editor, server, web Assistant-verification: bun run ci passed: dprint, oxlint, tokens, design contract, design record, Impeccable (no new findings)

  2. lavaman131head-ref-force-pushed 838d0e992970last month on GitHub

  3. lavaman131head-ref-force-pushed ca8af691f9a7last month on GitHub

  4. lavaman131merged 9200fd6bd4a8last month on GitHub

  5. lavaman131closedlast month on GitHub

  6. lavaman131head-ref-deletedlast month on GitHub