Skip to content

PRD-9772 Report ACP, engine-less and skill write outcomes (#7233) - #2269

Merged
inkeep-oss-sync[bot] merged 1 commit into
mainfrom
copybara/sync
Oct 21, 2026
Merged

inkeep-oss-sync[bot] merged 1 commit into
mainfrom
copybara/sync

Conversation

@inkeep-oss-sync

Copy link
Copy Markdown
Contributor

Copybara-translated 1 Inkeep OSS change. Rebase-merge this PR so the prepared commit lands directly on public main.

Linear: this mirror replays a change that already merged upstream, so it must not drive ticket status.
skip PRD-9772

* PRD-9772 Report engine-less and skill save results on agent writes

An agent write to a Mermaid, Excalidraw or text document, or to a global
or external skill, now answers with what its save did instead of
omitting the outcome fields. The store outside the Markdown pipeline
records the result for an agent-triggered save: a kept-live, merged or
both-kept save as a store intake, and a held or failed write as a store
failure. Each hold cause maps to a save-held reason:
pending-unreadable, pending-exhausted, pending-no-history-or-backup or
pending-not-utf8. A newly created skill reports applied.

* PRD-9772 Send the in-app agent's file write through the write route

The ACP whole-document write of a Markdown file now posts to
/api/agent-write-md in process instead of writing the document directly,
so it gets the pre-write merge, the awaited save and the same outcome as
every other agent write. A saved write returns the outcome under
_meta.openknowledge. A replace refused by a recent edit keeps error code
-32009 with the outcome added to its data, and every other outcome is
error code -32010, whose message is the result's title and detail. The
write sessions are keyed by the agent's presence id, so closing a thread
now closes them.

* PRD-9772 Lower the spine-call floor after the ACP write moved

The three agent-write coverage meta-tests require at least six
applyAgentMarkdownWrite call sites outside tests, as a guard against a
scan that finds nothing. The ACP file write no longer calls it directly;
it goes through the agent-write-md handler instead. That removed the one
call in acp/thread-manager.ts, and no other site changed: api-extension.ts
keeps two, http/agent-write-routes.ts two and http/lint-write-routes.ts
one. The floor is now five. The pre-drain floor of three pre-drainable
calls is unchanged, because the removed call was a whole-document
replace.

* PRD-9772 Fix the review of the ACP and outside-store outcomes

The in-app agent's file write over ACP now goes through the document
for every file the project shows as one: Markdown, including skills and
folder templates under dot folders, and Mermaid, Excalidraw and text
files. It posts to an in-process route that runs the agent-write-md
handler with the document admitted by the content filter instead of the
HTTP name rule, without the 1 MiB cap and the control-character check (a
whole-file write carries back what the document already holds), and
without the merge before the write, so the save merges an outside change
instead of the replace erasing it. Files that are not documents are
still written as is and answer an empty result.

Agent writes mark their store at edit time, and the flush waits for a
store that is already running and stores again, so a store Hocuspocus
runs at once still reports what it did. The unconsumed mark is dropped
at the end of the flush.

A Mermaid, Excalidraw or text file holding bytes that are not UTF-8 is
now refused with nothing to do, and the detail says no save runs until
the file is text again and to tell the user. A managed skill store that
writes no file (a legacy name, an unresolvable path, a skill folder that
is gone) answers the new write-dropped problem instead of applied, and a
store right after a polled intake that already wrote the file reports
the take-in, and one that ran while the intake was still taking the
change in answers write-dropped with re-read.

* PRD-9772 Give the route test doubles the running-store check

The agent write flush now asks Hocuspocus's debouncer whether a store is
already running (isCurrentlyExecuting) so it can wait for that store.
The real debouncer always has that method, but the hand-built Hocuspocus
doubles in the rollback, save-version, rename, folder and skill-store
tests only had isDebounced and executeNow. The flush threw on the
missing method and the rollback route answered 500. The doubles now
model the real debouncer with isCurrentlyExecuting returning false.
Nothing in the route needs an agent session.

The ACP permission test plants planted.txt in an empty project. Its rig
said every path is shown, so under the new ACP rule the text file counted
as a document and needed the in-process write route, which the rig does
not have; the write failed and the file never appeared. With the real
content filter, a text file in a folder that holds no document is not
shown, so it is written to disk as is. The test now gives the rig that
answer (only Markdown is shown) and the approved write lands.

* PRD-9772 Check this PR's results against the per-result guidance

The scan test now also checks the rows this PR adds to the per-result
table in conflict-resolution.md and mcp.mdx against the server mapping:
the non-UTF-8 hold, and the three write-dropped cases (a name with no
file of its own, an outside change being taken in, a skill folder that
is gone or a path that does not resolve). The changeset now covers every
agent write, the in-app agent's file writes included, since this PR
reports the engine-less and skill saves and the ACP write.

* PRD-9772 Fix the first review of the ACP and outside-store outcomes

Every route that answers with outcome fields now marks the store when
it edits, not only when it flushes: frontmatter patch, undo, rollback,
agent-write, lint fix, the template writes and the skill file PUT. An
undo of a Mermaid file whose bytes stopped being text, saved at once,
answers the held save instead of applied.

The not-UTF-8 hold no longer sends retryWhen next-save, since only a
person ends it and no beta returned it. Each hold reason's outcome now
comes from one exhaustive table.

The in-app agent's write runs under acp-document-write in its log and
divergence-gate labels, counts toward neither agent write calls nor
summary adoption, and skips the hints, checks, advisories and lint that
only MCP callers read, so that work cannot turn a saved write into a
500. It answers with its own strict schema.

mcp.mdx now agrees with itself and the code on the person-only holds,
on skills returning the not-UTF-8 hold, and on the -32009 and -32010
data shapes. The changeset names 409 write-dropped and the in-app
agent's -32010.

GitOrigin-RevId: 900b4cf16310e2bde493b2998a496725daa955db
@inkeep-oss-sync
inkeep-oss-sync Bot merged commit dd759dc into main Oct 21, 2026
@inkeep-oss-sync
inkeep-oss-sync Bot deleted the copybara/sync branch October 21, 2026 19:30
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