Skip to content

fix(harness-config): persist last-audit.md through a script so eval runs stay VALID - #12090

Merged
melodic-automation-lanes[bot] merged 2 commits into
mainfrom
work-resolve-issue/issue-12078-41342986410-1
Nov 1, 2026
Merged

melodic-automation-lanes[bot] merged 2 commits into
mainfrom
work-resolve-issue/issue-12078-41342986410-1

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Closes #12078

Summary

Opened by the work-resolve-issue lane. The run's own summary:

The issue offered two fixes; this takes option 1, its recommendation: audit-prompting-postures and audit-instructions now persist last-audit.md through a new plugins/harness-config/lib/persist-report.sh instead of leaving an inline mkdir on the plugin data directory to the model. The permission layer denies that inline mkdir, and run-validity.py cannot set the denial aside. The script follows findings-state.sh, whose traces in the issue's evidence show no denial. It takes --plugin-data, --component and --report (a file or - for stdin) plus an optional --root, derives the key by running lib/state-key.sh, and writes the file atomically through a staged temp file and mv, then prints the path. Placement in the plugin's lib/ rather than one skill's scripts/ dir follows from both skills using it; run-validity.py and its test are unchanged, as option 1 needs no gate change.

Not verified

  • persist-report.test.sh was not executed directly in this lane (Bash runs only the lane wrappers, and check-affected's output does not name the suites it ran); it was traced by hand and by the review subagent, and is left to the PR's CI test lanes
  • The done-when's eval run of a pp- case writing last-audit.md, showing no denied Bash mkdir under plugin data, was not run here (no eval harness or host run in this lane); the issue's related slice C eval cases are where that re-verification lands
  • Tidy skipped: the change is about 380 changed lines (two new files counted whole), over the 300-line tidy cutoff
  • The CI-only checks check-affected lists (portability-lint, shellcheck-style whole-repo scanners, markdownlint) are left to the PR's CI
  • Untracked dotfiles at the checkout root (.bashrc, .bash_profile, .gitconfig, .idea, .mcp.json, .profile, .ripgreprc, .vscode, .zprofile, .zshrc) are sandbox artifacts this run did not create and are not part of the change

Fix

  • plugins/harness-config/lib/persist-report.sh: new script that persists <plugin-data>/<component>/<state-key>/last-audit.md. It rejects a missing, non-absolute or '..'-component --plugin-data, a non-plain-segment component, a missing or unreadable report and an empty report, each wi
  • plugins/harness-config/lib/persist-report.test.sh: new self-contained shell test covering a first write, an overwrite of the same key (one file left), stdin input, two repositories keying apart, and 13 rejected-argument cases. Each rejected case asserts exit 2 and that nothing landed in its case dir
  • plugins/harness-config/skills/audit-prompting-postures/SKILL.md: 'Persist the report' now runs persist-report.sh from ${CLAUDE_PLUGIN_ROOT} with --plugin-data "${CLAUDE_PLUGIN_DATA}" and says not to run a standalone mkdir against plugin data. The --explain pointer moves to a direct state-key.sh call
  • plugins/harness-config/skills/audit-instructions/SKILL.md: Phase D now says to read the prior report at the key first, since the cost line compares against it. It then writes report.md to the run directory with the Write tool, as lane reports are written, persists it with persist-report.sh, and says
  • plugins/harness-config/skills/audit-instructions/context/report-keying.md: 'Deriving the key' now matches Phase D: the script derives the key and writes, --plugin-data carries the data directory, no mkdir of the model's own, and state-key.sh is still used to read the prior report.
  • .changes/harness-config/work-resolve-issue-issue-12078-41342986410-1-46339b88.md: patch changelog fragment (the repository's release record) describing the fix.

Verification

The runner ran each check from the base copy against 8cf4f76:

  • scripts/check-changelog-fragments.sh --check: passed
  • scripts/check-changed-skills.sh --merge-base: passed

The run reports:

  • check-changelog-fragments: all 5 fragments valid
  • check-changed-skills: first run failed (audit-instructions SKILL.md 506 lines over the 500 hard cap); after moving detail into context/report-keying.md it passes, 499/500 lines, 0 errors on both skills (warnings are pre-existing size advisories)
  • check-affected: 12 passed, 6 skipped, none failed over the changed files
  • cant-fail-scan --file plugins/harness-config/lib/persist-report.test.sh --check: PASS, no gating findings
  • fresh-context review subagent over the whole diff: 7 findings. Fixed: Phase D persisting before reading the prior report the delta compares against; stale read-only contract paragraphs in both skills; the heredoc persist bypassing the Write-tool rule for audit-instructions reports; 'writes nothing'
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/41342986410

Left out: the items under Not verified.

Related

#12078

Lane-Activity: work-resolve-issue/resolve-issue
@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 4672827fbd9c14749506d1bb87bb3cf7e5d533ae: read 2 of 2 changed file(s); 0 finding(s), 0 as inline comments.

Security review (incremental, 8cf4f76..4672827): no security issues found

critical-findings: 0

I read every hunk of .claude-lane/incremental.diff for both files in scope. Neither file matches a trusted-path glob, and this round changes no plugin manifest.

What I checked

  • audit-prompting-postures/SKILL.md: the persist route changed. The main route is now in two steps:

    • The Write tool writes the report to a scratch file under the session's temporary directory, outside the plugin data directory and outside every audited component.
    • persist-report.sh --report <report-file> then persists that file.
    • --report - (the report on stdin) becomes a fallback for sessions without the Write tool.

    This sends the report body through the Write tool's content guards before the script copies it. That adds a check; it doesn't remove one. The script itself is unchanged since the last review, which already covered its path validation (--plugin-data must be absolute with no .., --component must be a plain segment, the state key is sanitized, the file name is fixed). So the scratch-file path adds no new way to steer a write.

  • Instruction-surface lens. In both files, the rule against running a standalone mkdir or any other command of your own on the plugin data directory is kept and stated more firmly ("Persist only through this script"). The removed sentence explained why the permission layer denies inline commands. It is now a Pointer/As of/Recheck block that cites fix(evals): decide the eval-validity treatment of three more sandbox denial shapes #12039. That changes the explanation, not what the rule forbids. The added wording in the read-only paragraph ("Write stays in the tool set for Phase D's report file") is a factual description; it neither widens nor softens anything. No guardrail is deleted, narrowed or softened, so I did not consult the instruction exception register.

  • report-keying.md. The edit matches the SKILL.md wording: the data directory travels only as the --plugin-data argument, and persisting happens only through the script. No security-relevant behaviour changes.

  • Embedded text in the PR context. I found no directives aimed at this lane.

No trust control, token scope, kill switch or merge hold is touched. The change does not touch billing or prepaid usage.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-review: 2 inline finding(s) on 8cf4f76be2cb1f69ef31bc63122257550cd4d58e; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 4672827fbd9c14749506d1bb87bb3cf7e5d533ae: read 2 of 2 changed file(s); 1 finding(s), 0 as inline comments.

Code review: PR #12090 (changes since 8cf4f76)

Scope: I read every hunk of the 2 changed files: audit-instructions/context/report-keying.md and audit-prompting-postures/SKILL.md. Neither is on a trusted path. The other 4 files are unchanged since my last review.

What this change fixes

Both of my earlier inline findings are addressed. Their threads are resolved and nothing has changed under them since, so I'm not raising them again.

  • Write-tool guard (audit-prompting-postures/SKILL.md:164-175). Phase D now writes the report with the Write tool to a scratch file first, then passes that file as --report <report-file>. --report - is now only the fallback for when Write is unavailable. The read-only contract at line 31 now says Phase D's report file is why Write stays in the tool set.
  • Upstream behaviour given as the reason. Both files dropped the restated Claude Code behaviour. They now keep the decision in our own words and add a full record: a pointer, an as-of date (2026-11-01) and a recheck trigger. The pointer is plugins/manifest-reference#where-each-variable-resolves, the same anchor other skills in the repo already cite, plus fix(evals): decide the eval-validity treatment of three more sandbox denial shapes #12039 for the eval-trace evidence. This meets .claude/rules/skill-bodies-state-current-rules.md.

I found no new problem in these hunks.

Findings

  1. The closing issue's done-when criterion is still unverified and has no test. This is about the whole PR, so it goes here; summary findings are repeated each round.

Other checks

  • Prior findings: the 2 inline entries are marked as changed since posted, and their resolved threads are settled with nothing changed since. Finding 1 above is the earlier summary finding, repeated. This is round 2 of a cap of 3, so the cap did not apply.
  • Plugin manifests: none changed in this change.
  • Embedded instructions in the PR context, settled threads or prior findings: none found.
  • Not verified by me: this lane has no shell, so I ran nothing. The test and check results in the PR body are the author's claim and I have not checked them.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head 8cf4f76be2cb1f69ef31bc63122257550cd4d58e.

Lane-Activity: pr-unblock/address-feedback
Lane-Thread: PRRT_kwDOTCGFQM6yd84e
Lane-Thread: PRRT_kwDOTCGFQM6yd84g
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

pr-unblock / address-feedback finished round 1 of max 4 on 4672827.

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Nov 1, 2026
@melodic-automation-lanes
melodic-automation-lanes Bot removed this pull request from the merge queue due to a manual request Nov 1, 2026
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head 4672827fbd9c14749506d1bb87bb3cf7e5d533ae.

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Nov 1, 2026
Merged via the queue into main with commit 5039f17 Nov 1, 2026
46 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-12078-41342986410-1 branch November 1, 2026 21:11
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 5039f1783301a165a2fab69696fb32e13de2f830; later checks count it verified from this comment.

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.

fix(harness-config): persist audit state through a script so eval runs stay VALID

0 participants