Skip to content

feat(workflow): a file the model writes becomes the step's artifact - #86

Merged
EdmondDantes merged 1 commit into
mainfrom
feat/auto-file-artifacts
Jul 24, 2026
Merged

feat(workflow): a file the model writes becomes the step's artifact#86
EdmondDantes merged 1 commit into
mainfrom
feat/auto-file-artifacts

Conversation

@EdmondDantes

Copy link
Copy Markdown
Contributor

What was missing

A step's real deliverable — the file it actually wrote, e.g. src/Stats.php — never became an artifact unless the model also thought to record it by hand. The panel had no answer to "where is the result", and the critic had nothing to open.

The fix

When a step's model calls write_file during an ai() exchange, the workflow now auto-emits a file artifact for each written path.

  • recordWrittenFiles($history) runs after each work exchange (from ai(), not runTurns), pairing each write_file call with its result by tool-use id so an errored write leaves nothing, and accumulating the successful paths into a per-attempt set.
  • emitWrittenFileArtifacts() runs once at the end of the step body — after the step's own artifact() calls — and emits a file artifact per path, deduped against what the step already recorded. So a path written twice, or one the step also recorded by hand, appears exactly once.
  • Skipped while reviewing (a critic does not write), and the path set is reset per step attempt.

Why recording lives in ai() and not runTurns (a clean-context review caught this as a bug, with a repro): handoff formation also drives runTurns, continuing the previous step's conversation — which still holds that step's write_file calls. Recording there re-attributed the prior step's file to the next step. Going through ai() only sees the exchanges a step runs as work. The regression test aWrittenFileIsAttributedToTheStepThatWroteItNotTheNextOne pins it.

Auto-emitted file artifacts are deterministic across identical re-runs, so they do not disturb the byte-identical-attempt churn guard, and a step that wrote a file is correctly no longer "produced nothing".

@EdmondDantes
EdmondDantes merged commit 01728a9 into main Jul 24, 2026
2 checks passed
@EdmondDantes
EdmondDantes deleted the feat/auto-file-artifacts branch July 24, 2026 19:58
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