feat(workflow): a file the model writes becomes the step's artifact - #86
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_fileduring anai()exchange, the workflow now auto-emits afileartifact for each written path.recordWrittenFiles($history)runs after each work exchange (fromai(), notrunTurns), pairing eachwrite_filecall 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 ownartifact()calls — and emits afileartifact 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.Why recording lives in
ai()and notrunTurns(a clean-context review caught this as a bug, with a repro): handoff formation also drivesrunTurns, continuing the previous step's conversation — which still holds that step'swrite_filecalls. Recording there re-attributed the prior step's file to the next step. Going throughai()only sees the exchanges a step runs as work. The regression testaWrittenFileIsAttributedToTheStepThatWroteItNotTheNextOnepins 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".