Skip to content

feat(toolchain): warn at turn end when the tree's recorded check or lint result is not a pass - #11519

Closed
melodic-automation-lanes[bot] wants to merge 3 commits into
mainfrom
work-resolve-issue/issue-11500-41189494309-1
Closed

melodic-automation-lanes[bot] wants to merge 3 commits into
mainfrom
work-resolve-issue/issue-11500-41189494309-1

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Closes #11500

Summary

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

Nothing recorded a check or lint result per tree before this change. So /toolchain:check and check-mode /toolchain:lint now record their Overall line through scripts/record-result.mjs, keyed by a git tree id of the working tree. The id is computed on a copy of the index with update-index --info-only, so the real index is never touched and no file content is written. The record lives under the common git dir, the same place the verify-gate and confirm-verdict records use. A new node Stop hook (hooks/result-gate.mjs) reads that record and never runs a build, test or lint command. It stays silent on a clean tree, on a recorded PASS, and on a turn that changed no file and recorded nothing (it keeps the last tree and records it saw per session). Otherwise it exits 0 with a systemMessage naming each FAIL, INCOMPLETE or STOPPED line, or saying no result is recorded for this tree. The turn_end_result_gate userConfig option (default advisory) is read from user and managed settings only, through a shared copy of lib/plugin-options.mjs, so the env mirror is never read. enforce blocks once, and only on a recorded FAIL. INCOMPLETE, STOPPED, a missing or unreadable record, a missing git and any settings error never block. I made these design choices from the existing record scripts and the issue's AC6 wording: block only on FAIL; skip recording for ecosystem-narrowed runs and for --fix/--code-fix.

Not verified

  • plugins/toolchain/hooks/result-gate.test.sh was not executed: this lane runs only the named wrappers, not node or bash suites, and check-affected does not run plugin suites. Left to the PR's CI test lane. The reviewer traced each expect by hand and found none that would fail.
  • tidy skipped: the change is 13 files (cutoff 10), over 300 changed lines, and touches scripts/shared-copies.txt, a listed shared path.
  • review-venue.txt was absent, so the review ran locally in one fresh-context subagent (recorded as review: pass).
  • No tool here can set the executable bit. Instead of shipping #! files at 100644 (check-affected's exec-bit rule flags those), record-result.mjs has no shebang and is always run as node record-result.mjs. result-gate.test.sh has no shebang (# shellcheck shell=bash instead) and runs as bash like
  • check-affected skipped these locally; they are left to CI: validate-plugins identity-prerequisites drift, native-overlap registry, claude plugin test (mods), and changed-skills. Its CI-only scanners also run on the PR (hook-exec-form, hooks-description, silent-skips, test-tmp-cleanup, fixture-git-is
  • The live demo was not run (/toolchain:check in a real session, then end the turn). It needs a host Claude Code session; the contract test covers the same paths.
  • Known limit: the first turn end of a session on a tree that was already dirty reports once, because there is no earlier state to compare. A turn-start baseline would need a UserPromptSubmit hook that hashes the tree on every prompt, which I chose not to add.
  • Review low finding not fixed: the test, like the hook, reads the host's real managed settings (/etc/claude-code). A host whose managed settings configure toolchainmkt, or whose managed-settings.d cannot be read, would change the off/enforce cases.
  • git-read status inside the Bash sandbox lists root dotfiles (.bash_profile, .bashrc, .gitconfig, .idea, .mcp.json, .profile, .ripgreprc, .vscode, .zprofile, .zshrc) that this run did not create. Read reports them absent outside the sandbox, so they look like sandbox mount points, not part of this ch
  • Records and session state under <git-common-dir>/toolchain-results/ are never pruned. Each is a few bytes per tree or session.

Fix

  • plugins/toolchain/lib/tree-result.mjs: new. Working-tree hash (temp index copy that keeps the original mtime, ls-files, update-index --info-only, write-tree --missing-ok), the record store under <git-common-dir>/toolchain-results/<tree>/<skill>, and per-session last-seen state.
  • plugins/toolchain/scripts/record-result.mjs: new CLI that /toolchain:check and /toolchain:lint call to record their Overall line for the current tree. Exit 0 recorded, 1 bad argument or not an Overall line, 2 cannot record.
  • plugins/toolchain/hooks/result-gate.mjs: new Stop hook. Mode off/advisory/enforce from trusted settings, a systemMessage for results that are not PASS or for no record, a block only under enforce on FAIL when stop_hook_active is not set, and fail-open on every error.
  • plugins/toolchain/hooks/plugin-options.mjs: generated copy of lib/plugin-options.mjs (via sync-shared-copies).
  • scripts/shared-copies.txt: registers the plugin-options.mjs copy for toolchain.
  • plugins/toolchain/hooks/hooks.json: new. Exec-form node Stop row with a description and a 30s timeout.
  • plugins/toolchain/hooks/result-gate.test.sh: new contract test for AC1-AC7 plus record-result exit codes, settings precedence, the ignored env mirror, the per-session quiet rule, and a stub PATH that proves no build/test/lint command runs.
  • plugins/toolchain/.claude-plugin/plugin.json: adds the turn_end_result_gate userConfig option (string, default advisory).
  • plugins/toolchain/prerequisites.json: declares node (optional runtime) for the plugin hook and the check/lint record step.
  • plugins/toolchain/skills/check/SKILL.md: new step 4 that records the Overall line, skipped for ecosystem-narrowed runs and 'No changes found'.
  • plugins/toolchain/skills/lint/SKILL.md: new step 5 that records the check-mode Overall line. Nothing is recorded for --fix/--code-fix, filtered runs or 'No changes found'.
  • plugins/toolchain/README.md: documents the gate and its three modes, and adds the generated options reference block (hand-rendered to match scripts/sync-plugin-options-docs.py output; its --check passes).
  • .changes/toolchain/feat-11500-turn-end-result-gate-6e1f3a8c.md: minor changelog fragment.

Verification

The runner ran each check from the base copy against c7008ec:

  • scripts/check-changelog-fragments.sh --check: passed

The run reports:

  • read https: //code.claude.com/docs/en/hooks: Stop input carries stop_hook_active. Stop decision control: decision "block" with reason prevents stopping, and additionalContext also continues the conversation. systemMessage is a 'Warning message shown to the user'. Exit 0 with one JSON object is struc
  • read https: //github.com/melodic-software/claude-code-plugins/issues /9154: Decision 2 (a judgment row takes advisory; enforce without a source adds blocking with no evidence). The host run note says G1 has no hook in plugins/toolchain yet and G2 folds in as lint INCOMPLETE not passing.
  • /home/runner/work/claude-code-plugins/claude-code-plugins/.lane/checks/bin/check-changelog-fragments: All 11 changelog fragment(s) valid (final run).
  • /home/runner/work/claude-code-plugins/claude-code-plugins/.lane/checks/bin/check-affected: final run 12 passed, 6 skipped, 0 failed over 13 changed files. Earlier runs failed shellcheck SC2016 in the test and plugin-options-docs (stale README options block); I fixed both.
  • /home/runner/work/claude-code-plugins/claude-code-plugins/.lane/verify/bin/sync-shared-copies: generated plugins/toolchain/hooks/plugin-options.mjs, exit 0.
  • /home/runner/work/claude-code-plugins/claude-code-plugins/.lane/verify/bin/cant-fail-scan --file plugins/toolchain/hooks/result-gate.test.sh --check: PASS, no gating findings, 1 test file fully read.
  • Fresh-context review subagent over the whole diff: no blocking bugs. Medium findings fixed: AC5 is now turn-scoped through per-session state, and narrowed runs no longer record a whole-tree PASS. Low findings fixed: the index copy keeps its mtime, untracked nested repos are filtered out, the Overall
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/41189494309

Left out: the items under Not verified.

Related

#11500

Lane-Activity: work-resolve-issue/resolve-issue

@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: 1 inline finding(s) on c7008ecee3a9ebced2b23c3e137cb6bf2dd56acc; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed baf98ffbd25451ac2bd353f3dc12f11460350a02: 0 finding(s), 0 as inline comments.

Incremental review of the changes since cce4ffe: a new SessionStart node-notice hook, a changelog line, and matching description edits in plugin.json and docs/catalog.md. I found nothing to flag. Everything below comes from reading the files in this checkout. I did not run any of it, and the tests in the PR are the author's.

  • New hook (plugins/toolchain/hooks/hooks.json). The SessionStart row has the same shape as the guardrails, markdown-format and typos-format hooks. That covers the startup|resume|clear|fork matcher, the sh … prerequisites.sh node-notice <check>; ${PPID:+exit}; powershell … prerequisites.ps1 node-notice <check> command, and the exec form.
  • Files it calls. plugins/toolchain/lib/prerequisites.sh and prerequisites.ps1 both exist and implement node-notice. plugins/toolchain/skills/check-prerequisites/SKILL.md exists, so the notice points at a real command. prerequisites.json already names /toolchain:check-prerequisites as the node check.
  • Fail-open behavior. The notice runs without node. With node on PATH it prints nothing and exits 0. Without node it prints one systemMessage and exits 0. It never blocks a session. The notice is shown once per session (the script's per-session latch).
  • Manifest checks.
    • manifest description: pass. The new text describes what ships (check, lint, setup, ratchet, and the turn-end Stop hook) and matches the docs/catalog.md entry.
    • manifest version bump: pass. The fragment keeps bump: minor, which fits a new hook and option.
    • manifest userConfig: unchanged in this increment.
  • Changelog fragment. The added bullet describes the notice accurately.

No spend beyond normal CI runs and no hold class applies.

@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-security-review: 3 inline finding(s) on c7008ecee3a9ebced2b23c3e137cb6bf2dd56acc; the summary is in this lane's pull request comment.

claude-lane: claude-security-review

Comment thread plugins/toolchain/hooks/hooks.json Resolved
Comment thread plugins/toolchain/lib/tree-result.mjs Resolved
@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed baf98ffbd25451ac2bd353f3dc12f11460350a02: 0 finding(s), 0 as inline comments.

I found no security issues in the incremental change since cce4ffe. It touches four files: the changelog fragment, docs/catalog.md, plugins/toolchain/.claude-plugin/plugin.json and plugins/toolchain/hooks/hooks.json.

critical-findings: 0

hooks/hooks.json (new SessionStart row)

  • The row runs sh "${CLAUDE_PLUGIN_ROOT}/lib/prerequisites.sh" node-notice /toolchain:check-prerequisites, with a PowerShell fallback.
  • Both scripts ship inside the plugin (plugins/toolchain/lib/prerequisites.sh and .ps1). Nothing is fetched from outside the repository.
  • It matches the row eol-normalizer, markdown-format and typos-format already ship.
  • Every argument is a constant string in the hook. The one eval in prerequisites.sh (line 32) only runs on the optional third argument, which this hook does not pass. That argument is also limited to [A-Z0-9_] by the case on line 30. No PR, issue or session text reaches a shell expansion.
  • The script reads session_id from stdin with sed and strips it to [A-Za-z0-9_-] before using it as a directory name under the temp directory. That blocks path traversal.
  • The hook only prints a systemMessage and exits 0. It holds no credentials and writes nothing beyond a latch directory in the temp directory.

plugin.json

  • manifest description: pass. It is in the inert set, and the new text describes behavior already in the PR.
  • The incremental diff changes only description. The userConfig key, keywords entry and hooks/hooks.json came with the earlier-reviewed base of this PR and are unchanged.
  • plugin.json has no hooks field. The hooks load by auto-discovery from hooks/hooks.json, so the manifest hooks flag does not apply. Existing toolchain users get the new in-repo hooks on update, as the earlier review of this PR already covered.

Other files

  • docs/catalog.md and the changelog fragment are prose only, with no trust-control or instruction-surface content. They contain no directives to the lane.

Cost: none. This is a local hook with no billed resource.

Lane-Activity: pr-unblock/address-feedback
Lane-Thread: PRRT_kwDOTCGFQM6yQO1c
Lane-Thread: PRRT_kwDOTCGFQM6yQO5L
@melodic-automation-lanes

melodic-automation-lanes Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor Author

Unattended merge: native auto-merge leaves this pull request unarmed at head baf98ffbd25451ac2bd353f3dc12f11460350a02. The lanes clear this reason on their own; the next scheduled run judges it again.

pr-merge's gate refuses its verifier verdict (verify:missing)

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

melodic-automation-lanes Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor Author

The pr-unblock lane stopped address-feedback on this pull request: the pull request has an unresolved review thread the lane does not take (a reviewer it does not act on, a review of an older head, or a thread it already answered), so nothing will resolve it. The lane sets no label: the run ends in a failing pr-unblock/address-feedback status on the head the lane gated.

When a retry on this head can change the outcome, the lane runs one on its own, up to its per-head cap, and edits this comment if it stops again; a run that does not stop clears the status. When no retry can (a review thread the lane does not take or settle, or a failing check after the retries are spent), a person resolves the threads or gets the checks green, then dispatches the workflow below: that run finds the cause gone and clears the status. On a pull request the lanes App opened, the dispatchers start that run once per stop; on any other, a person does. A new commit to the branch starts clean.

To run it again on this head now, dispatch the pr-unblock workflow:

gh workflow run pr-unblock.yml -R melodic-software/claude-code-plugins -f pr-number=11519 -f activity=address-feedback

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head baf98ffbd25451ac2bd353f3dc12f11460350a02.

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Oct 31, 2026
@melodic-automation-lanes
melodic-automation-lanes Bot removed this pull request from the merge queue due to a manual request Oct 31, 2026
@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Oct 31, 2026
@melodic-automation-lanes
melodic-automation-lanes Bot removed this pull request from the merge queue due to a manual request Oct 31, 2026
@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Oct 31, 2026
@melodic-automation-lanes
melodic-automation-lanes Bot removed this pull request from the merge queue due to a manual request Oct 31, 2026
@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Oct 31, 2026
@melodic-automation-lanes
melodic-automation-lanes Bot removed this pull request from the merge queue due to a manual request Oct 31, 2026
@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Oct 31, 2026
@melodic-automation-lanes
melodic-automation-lanes Bot removed this pull request from the merge queue due to a manual request Oct 31, 2026
@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Oct 31, 2026
@melodic-automation-lanes
melodic-automation-lanes Bot removed this pull request from the merge queue due to a manual request Oct 31, 2026
@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Oct 31, 2026
@melodic-automation-lanes
melodic-automation-lanes Bot removed this pull request from the merge queue due to a manual request Oct 31, 2026
@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Oct 31, 2026
@melodic-automation-lanes
melodic-automation-lanes Bot removed this pull request from the merge queue due to a manual request Oct 31, 2026
@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Oct 31, 2026
@melodic-automation-lanes
melodic-automation-lanes Bot removed this pull request from the merge queue due to a manual request Oct 31, 2026
@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Oct 31, 2026
@kyle-sexton kyle-sexton added the do-not-merge Hard merge gate: do not merge while applied. label Oct 31, 2026
@melodic-automation-lanes
melodic-automation-lanes Bot removed this pull request from the merge queue due to a manual request Oct 31, 2026
@kyle-sexton

Copy link
Copy Markdown
Member
Hold: the pr-merge sweep dequeues this PR on a settled reply, and each cycle spends merge-queue CI. Releases when: #11634 is merged.

@kyle-sexton kyle-sexton removed the do-not-merge Hard merge gate: do not merge while applied. label Oct 31, 2026
@melodic-automation-lanes

melodic-automation-lanes Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor Author

The pr-unblock lane stopped resolve-conflicts on this pull request: the merge stages the pull request's own .github/workflows/ changes together with the base's, which the lane token cannot push, so a session merges main by hand. The lane sets no label: the run ends in a failing pr-unblock/conflict status on the head the lane gated.

When a retry on this head can change the outcome, the lane runs one on its own, up to its per-head cap, and edits this comment if it stops again; a run that does not stop clears the status. When no retry can (a review thread the lane does not take or settle, or a failing check after the retries are spent), a person resolves the threads or gets the checks green, then dispatches the workflow below: that run finds the cause gone and clears the status. On a pull request the lanes App opened, the dispatchers start that run once per stop; on any other, a person does. A new commit to the branch starts clean.

To run it again on this head now, dispatch the pr-unblock workflow:

gh workflow run pr-unblock.yml -R melodic-software/claude-code-plugins -f pr-number=11519 -f activity=resolve-conflicts

@kyle-sexton

Copy link
Copy Markdown
Member

Hold: superseded by #11684. Releases when: never; the original closes after #11684 merges.

@kyle-sexton

Copy link
Copy Markdown
Member

Superseded by #11684, merged 2026-10-31T21:50:47Z.

@github-actions
github-actions Bot deleted the work-resolve-issue/issue-11500-41189494309-1 branch November 3, 2026 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge Hard merge gate: do not merge while applied.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(toolchain): warn at turn end when the tree's recorded check or lint result is not a pass

1 participant