Skip to content

Builder: edits on edit_workflow / edit_step; document reads bound by the window, not the 50k ceiling - #131

Merged
Evanfeenstra merged 1 commit into
mainfrom
fix/builder-edits-any-workflow
Oct 9, 2026
Merged

Evanfeenstra merged 1 commit into
mainfrom
fix/builder-edits-any-workflow

Conversation

@Evanfeenstra

Copy link
Copy Markdown
Contributor

Why

The builder could not change one line (max_pages: 3 → 100) of a ~50k-char workflow made in the UI. Its own edit_workflow never had an ownership gate, but it only took the whole YAML back, and get_workflow is cut at the tool result cap (50k chars on a 1M window — the "about 50k characters" it reported is the truncation marker). So the builder published a throwaway workflow (exec cat → meta/publish-workflow) and hit the evolve surface's rule instead: a meta/* step republishes only over names it stamped ai (EVOLVE_SPEC §6). The chat transcript confirms the chain: tmp-republish-from-file published, run 1791566214864 returned Workflow "tweet-engagement-study" exists and is not agent-authored (publisher: none), relayed as "refused for workflows I didn't originally create".

What

  • edit_workflow / edit_step take edits — exact-string replacements applied in order to the ACTIVE version's source, each required to match exactly once (applyEdits, src/authoring.ts). A no-match or a repeated match names the edit and the lines it hit, and publishes nothing; validation and the claims gate run on the result as before. yaml / code OR edits, not both. The fix for the tweet workflow is now one call: edit_workflow({ name, edits: [{ old: "max_pages: 3", new: "max_pages: 100" }] }).
  • Document reads are bound by the window, not the ceiling. get_workflow and get_step (DOCUMENT_TOOLS, src/chat-store.ts) get AiDeps.documentMaxChars — the window's headroom with no env ceiling, 176k chars on a 1M window (every Claude 5 model), 16k on Haiku 4.5 — and are never re-cut on replay: truncateToolMessages skips them, since the number they were cut to follows the model and a fixed cap there would rewrite what the model already read (the append-only rule; a cache miss and, on preserved-thinking models, a 400). Every other result keeps the 50k ceiling.
  • The system prompt tells the builder to use edits for a small change to a big workflow and never to work around a long YAML by other means.
Result 1M window 200k window
get_workflow, get_step 176k chars 16k chars
everything else 50k (unchanged) 16k

Unchanged

  • The meta/publish-workflow ownership rule — it guards an unsupervised agent inside a run.
  • The tool-result-spill plan stays proposed; its "error instead of a cut" exemption for documents is noted as superseded (with edits, a cut document is still editable).

Tests

npm test: 1386 pass. New: edits on both tools (one-line change, no-match, repeated match with line numbers, validation error after an edit, edits follow the active version after a rollback), the document cap at the source vs the ordinary cap, and the replay skip. Not exercised against a live model: the change is tool schema + execute logic, not provider streaming. tsc clean.

…y the window, not the 50k ceiling

The builder could not change one line of a 50k-char workflow a person
made in the UI (tweet-engagement-study, 2026-10-09). Its own
edit_workflow never had an ownership gate, but it took only the whole
YAML, and get_workflow is cut at the tool result cap (50k chars on a 1M
window; the "about 50k characters" the builder reported was the
truncation marker). So it published a throwaway workflow (exec cat ->
meta/publish-workflow) and hit the evolve surface's rule instead: a
meta/* step republishes only over names it stamped `ai`, and relayed
that as "refused for workflows I didn't originally create".

- edit_workflow / edit_step take `edits`: exact-string replacements
  applied in order to the ACTIVE version's source, each required to
  match exactly once (`applyEdits`, authoring.ts). A no-match or a
  repeated match names the edit and the lines it hit and publishes
  nothing; validation and the claims gate run on the result as before.
  Pass `yaml` / `code` OR `edits`, not both.
- get_workflow and get_step (`DOCUMENT_TOOLS`, chat-store.ts) are capped
  by the window's headroom alone (`AiDeps.documentMaxChars`, no env
  ceiling: 176k chars on a 1M window) and never re-cut on replay
  (`truncateToolMessages` skips them): the number they were cut to
  follows the model, and a fixed cap there would rewrite what the model
  already read (the append-only rule).
- The system prompt says to use edits for a small change to a big
  workflow and never to work around a long YAML by other means.

The meta/publish-workflow ownership rule is unchanged (EVOLVE_SPEC §6).
The tool-result-spill plan's "error instead of a cut" exemption is noted
as superseded: with edits a cut document is still editable.
@Evanfeenstra
Evanfeenstra merged commit 629a47e into main Oct 9, 2026
1 check passed
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