Skip to content

fix(planner): read a document this one created with orchestrate read - #1049

Merged
lavaman131 merged 1 commit into
mainfrom
fix/orchestrate-read
Dec 1, 2026
Merged

lavaman131 merged 1 commit into
mainfrom
fix/orchestrate-read

Conversation

@lavaman131

Copy link
Copy Markdown
Collaborator

A fan-out document's Planner called read_child with the id of a document it had opened with orchestrate (one orchestrate list showed) and was refused with "no such child document of this document". Chopin has two kinds of related document: documents nested in this one (parentChannelId, such as published research, reached by list_children/read_child/edit_child/anchor_child) and separate top-level documents this one created (createdFrom, reached by orchestrate). The prompt only taught the nested kind, both were called "child documents" in places, and orchestrate had no way to read a created document, so a model that wanted to read one reached for read_child.

What changed

  • orchestrate read (Planner host tool and MCP orchestrate): takes one target (id or url, as answer does) and offset/limit/column, and returns the view read_plan/read_child give (document, revision, blocks, questions, accepted comments, source) with target naming it. It reaches only documents this one created (same repository, top-level, unarchived), reads under the document's archive hold (withHeldPlan in main.ts, serializeDocument + withOpenedPlan over MCP) and rechecks there, so a document archived meanwhile is refused (target-not-created). A range outside the document is invalid-range. It never writes: a created document's own Planner and members edit it, and a change is asked for with instruct. Over MCP it is read-only like list and decisions (pull access is enough); on the Planner it has the same person-request gate as every orchestrate operation.
  • Paged text: readingOutput shows a successful orchestrate read to the model as the same line-addressable text read_plan gives, with next: orchestrate {"operation":"read","target":…,"offset":…}; MCP's text result is the same, with the source id in its next: call. Other operations and refusals are left as returned.
  • Helpful refusal: read_child, edit_child and anchor_child given the id of an unarchived document this one created now answer <id> is not nested in this document: it is a separate document this one created, with its own Chat and Planner. Read it with orchestrate {"operation":"read","target":"<id>"}, and change it by sending its Planner an orchestrate instruct. Every other id keeps the generic refusal (now "no such child document nested in this document"), so nothing is revealed about documents outside that relationship.
  • Wording: the Planner prompt, the child tools' and orchestrate's descriptions and schema, MCP orchestrate's description, the focus line and the docs (AGENTS.md, hosted-agent.md, local-agent-mcp.md, channels.md, agent-connection.md) say "nested documents" (child documents nested in this one) for the first kind and "documents this one created" for the second, the vocabulary the index heading (Documents created from this one) and docs already used. Each description says in a sentence why the other kind is out of its reach.

Verification

  • bun run fix, bun run ci, bun run types pass.
  • New tests: orchestrate read arguments, reads of a created document (by url and id, with ranges), refusals for a document this one did not create, one created by a created document, this document, an archived one and one archived while waiting for its hold (agent/orchestrate.test.ts); the model's paged text and its next: call; the child tools' refusal for a created document versus an archived or unrelated one (agent/child-tools.test.ts); prompt and description text (agent/planner.test.ts, agent/child-tools.test.ts); the MCP mirror end to end, including a pull-only caller, paged text, refusals, an archived target and the advertised schema (mcp/orchestrate.test.ts).
  • bun test apps/server/src/agent apps/server/src/chat apps/server/src/mcp apps/server/src/harness: 2395 pass. Full bun test: 10125 pass; the only 2 failures (ai/launch-handoff.test.ts, experiments/routes.test.ts) come from this machine's global git commit-signing config and pass with GIT_CONFIG_GLOBAL=/dev/null.
  • Not run locally: the Chromium E2E suite (no browser behavior changed).

A fan-out document's Planner called `read_child` with the id of a document it
had opened with `orchestrate` and was told "no such child document". Chopin has
two kinds of related document: ones nested in this one (`parentChannelId`,
reached by the child tools) and separate top-level documents this one created
(`createdFrom`, reached by `orchestrate`). The prompt only taught the first,
and `orchestrate` could not read a created document at all.

- `orchestrate` gains a read-only `read` operation: one created `target` (id
  or url) with `offset`, `limit` and `column`, returning the same view
  `read_plan` and `read_child` give, held under the document's archive hold and
  refused for a document not created from this one, archived or deleted. The
  model reads it as paged text with a `next:` call; MCP `orchestrate` mirrors
  it (read access is enough) with the same paged text.
- `read_child`, `edit_child` and `anchor_child` given the id of a document this
  one created say it is a separate document and to read it with `orchestrate`
  `read` and change it through `instruct`; any other id keeps the generic
  refusal.
- The prompt, tool descriptions and docs call the first kind nested documents
  and the second documents this one created, never both child documents.
@lavaman131
lavaman131 merged commit 771a76b into main Dec 1, 2026
26 checks passed
@lavaman131
lavaman131 deleted the fix/orchestrate-read branch December 1, 2026 02:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant