Repository navigation
feat(artifacts): artifact-first WorkerResult lineage with hashes - #7555
CR1MS0N-Operator wants to merge 2 commits into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Speaking as Kun's firstmate: thanks, @CR1MS0N-Operator. A hash-pinned artifact manifest in place of a prose self-report fits "workers are supervised, not trusted". The path confinement and symlink refusal are careful work. Where it stands: I read the diff of head
A small consistency nit while you're there: Contract-class (my own read): new-default. Every unconfigured ship and scout brief now tells the worker to write and hash a manifest before VISION.md per rule:
Overlap: your #7553 adds a |
…(bead 82cc) Workers now return artifact references plus full SHA-256 hashes instead of a conversational summary. A manifest at data/<task>/artifacts.json names each artifact by kind and path; the parent channel carries only the manifest pointer and its digest. - bin/fm-artifact-lib.sh: closed kind allowlist (transcripts refused), confined data/<task>/ paths, full-hash hashing, atomic write, verified re-hash. - bin/fm-artifact-manifest.sh: write/verify/ref entry point. - bin/fm-inactive-reconcile.sh: append artifacts= and artifacts_sha256= to a child's local parent-channel line while the manifest verifies. - bin/fm-brief.sh and bin/fm-dod-lib.sh: scout and ship definitions of done require the manifest before the done line. - docs/artifact-lineage.md plus the parent-channel and script-index pointers. - tests/fm-artifact-manifest.test.sh covers the round trip, tamper detection, transcript refusal, unsafe paths, and both channel routes. Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
`fm_artifact_kind_valid` (bin/fm-artifact-lib.sh:44) accepts `manifest`, and docs/artifact-lineage.md lists it, but the library header, the entry-point header, and both definition-of-done texts in bin/fm-brief.sh and bin/fm-dod-lib.sh listed only the other five kinds. A worker reading the ship or scout DoD could not find the sixth kind it is allowed to name. Measured: bin/fm-artifact-manifest.test.sh passes unchanged (it asserts behaviour, not the prose list), and `bash -n` is clean on all four scripts.
ee1812c to
ca92eaa
Compare
[Medium impact] The PR changes how scout and ship work records reach local parent channels. Fix the skipped artifact checks, cross-task paths, and scout command before merging. Reviews (1) · Last reviewed commit: "docs(artifacts): list the manifest kind ..." · Reviewed by Greptile |
| case "$line" in | ||
| ' {'*'}') ;; | ||
| *) continue ;; |
There was a problem hiding this comment.
fm_artifact_manifest_verify skips every non-final entry written by write. The writer adds no newline after each object, so the next separator makes that line end in },. This selector accepts only lines ending in }.
With a patch and a test log, changing or deleting the patch still lets verify and ref succeed while the test log remains intact. Check every entry and add a test that changes a non-final artifact.
How this was verified: The writer produces comma-ended non-final entries, the verifier skips those lines, and the publisher accepts the resulting successful check.
| base=$(CDPATH='' cd -- "$data" 2>/dev/null && pwd -P) || return 1 | ||
| real=$(CDPATH='' cd -- "$(dirname "$path")" 2>/dev/null && pwd -P) || return 1 | ||
| case "$real" in | ||
| "$base"|"$base"/*) ;; | ||
| *) return 1 ;; |
There was a problem hiding this comment.
fm_artifact_resolve checks the resolved directory against the whole data directory, not the task directory. It also allows intermediate directory links. A worker can create data/task/link pointing to ../other and submit data/task/link/report.md; both writing and checking accept the other task's report as its evidence.
Reject linked directory components and require the resolved file to stay under the requested task.
How this was verified: Worker-selected paths pass through the same resolver during writing and checking, and its resolved-path check accepts sibling task directories.
| Write your findings to \`$DATA/$ID/report.md\`. | ||
| The report must stand alone: what you did, what you found, the evidence (commands run, output, file:line references), and what you recommend. | ||
| Return artifacts, not a transcript: write the lineage manifest with | ||
| \`$FM_ROOT/bin/fm-artifact-manifest.sh write --task $ID --artifact report=$DATA/$ID/report.md\`, |
There was a problem hiding this comment.
Scout command rejects report path
The generated command passes an absolute report path, but fm_artifact_rel_valid accepts only data/<task>/.... DATA is resolved to an absolute directory before this brief is written, so following the command fails with exit code 3 instead of creating the required manifest.
Render report=data/$ID/report.md and keep the chosen home/data directory separate from the artifact's relative path.
| cat <<EOF | ||
|
|
||
| ## Artifact lineage | ||
| Return artifact references and hashes, not a conversational summary: the parent consumes your manifest, never your transcript. | ||
| Before your done line, write the lineage manifest with | ||
| \`$artifact_root/bin/fm-artifact-manifest.sh write --task $id --artifact <kind>=<path> ...\`, |
There was a problem hiding this comment.
Manual PRs miss manifest instructions
The new shared block is never printed for no-mistakes tasks with pr=manual. That branch calls fm_dod_manual_pr_block and returns before reaching this block. The helper contains no manifest instructions, so these workers miss the new completion requirement.
Make that branch continue to the shared block too.
| path=$(fm_artifact_resolve "$data" "$task" "$rel") || return 3 | ||
| hash=$(fm_artifact_sha256 "$path") || return 4 |
There was a problem hiding this comment.
Manifest overwrites its own evidence
write accepts an existing data/<task>/artifacts.json as a manifest artifact, hashes it, then overwrites that same file with the new manifest. Rerunning with only --artifact manifest=data/task/artifacts.json returns success but immediately fails verification because it records the old file's hash.
Reject the output path as an input before replacing any existing manifest.
What
Workers return a verified artifact manifest instead of prose:
bin/fm-artifact-lib.sh+bin/fm-artifact-manifest.shenforce a closed kind allowlist, refuse transcripts, keep paths insidedata/<task>/(symlink-safe), record the full sha256, and write atomically with a re-hash verification. The publisher appendsartifacts=<manifest> artifacts_sha256=<digest>on the local parent channel; the scout and ship definitions of done require the manifest;docs/artifact-lineage.mdand the script index are updated.Consistency nit (fixed in
ca92eaa5)fm_artifact_kind_validacceptsmanifest, anddocs/artifact-lineage.mdlists it, but the library header, the entry-point header, and both definitions of done listed only the other five kinds. All four now saypatch, test-log, review-report, report, trace, manifest, so a worker reading the ship or scout DoD can find the kind it is allowed to name. No behaviour changed;tests/fm-artifact-manifest.test.shpasses unchanged.How this composes with #7553 and #7389
#7553 adds
## Required artifactto the same briefs. They compose at exactly one point: that field names the manifest, and this PR is the contract behind the name. A ship or scout## Required artifactshould read something like "the verified manifest atdata/<task>/artifacts.json, pinning the patch and the test log", and the DoD line owned here tells the worker how to write, verify, and reference it. Neither PR introduces a second artifact contract: the DoD/docs/artifact-lineage.mdremains the single owner of the writer instruction and the kind list, and## Required artifactonly points at its output. Now thatmanifestis in every kind list, a brief that names "the manifest" agrees with the allowlist.#7389 also edits worker artifact instructions. Whichever lands second should keep that single owner rather than restating kinds in the brief; this PR does not add a parallel instruction surface.
Verification
Rebase and conflicts
Rebased onto upstream
main9224c902(2026-11-02). Two conflicts, both mechanical, both sides kept:bin/fm-brief.sh— upstream added an empty-inventory attestation exception to the scout "stay inside this worktree" rule; this PR added the artifact manifest as a permitted outside-worktree write. Merged into one rule that allows the report, the artifact manifest, and the status file, with the attestation exception intact.docs/secondmate-parent-channel.md— upstream added theconfig/ready-after-greennote to the ship row; this PR added the artifact manifest to the scout row. Both kept.Automated checks on this head
ShellCheck and actionlint were installed locally for this run with the repo's own pinned installers (
bin/fm-install-shellcheck.sh /tmp/sc-bin,bin/fm-install-actionlint.sh /tmp/sc-bin); nothing was installed system-wide.Live validation: the parent channel, local route and remote route
Disposable main and mate homes; a child task record whose ledger ends in a terminal
done:line; the real publisher invoked asbin/fm-inactive-reconcile.sh report childon each route.Local route — manifest written, verified, then published:
The published pair is exactly the
refoutput: the parent reads the pointer and the digest, and the digest names the manifest bytes.Remote route — same child, same writer, remote parent config:
The remote line keeps the
report=pointer and omits the manifest pair it cannot fetch, asdocs/artifact-lineage.mdsays.Gaps I could not validate here (named, not faked)
data/<id>/artifacts.json. No harness this repo's gate configuration permits is authenticated on this machine:claude -p "reply with exactly: OK"returnsNot logged in · Please run /login;codexreturns 401 Incorrect API key;pireports no API key for the selected model;grokis not signed in;ompgets 401 from its local gateway. A spawn reaches the worktree and the pane and then stops at the harness's first-run screen, so I could not obtain a real worker transcript writing the manifest. The manifest writer/verifier and the publication path above are the real scripts with real output, but the worker-driven half is unproven here..fm-secondmate-home,.fm-secondmate-parent) with a terminal child ledger line and the real publisher, not a provisioned second mate with a live worker.no-mistakes attestation
This branch was pushed through the gate on this exact head:
So this head carries no no-mistakes attestation, and the "PR must be raised via no-mistakes" check will stay red until the run can execute an agent. That is an unauthenticated-agent limitation on this machine, not a decision to skip the gate. Before I rebased, the gate's own rebase step reported exactly the two mechanical conflicts listed above (
rebase-1 bin/fm-brief.sh,rebase-2 docs/secondmate-parent-channel.md); after the rebase it completed with 0 findings and the run failed at Review on the agent login.Contract class
New-default: every unconfigured ship and scout brief tells the worker to write and hash a manifest before
done:, and the parent channel gains a field. Captain merge-or-leave decision, not an auto-merge.