Skip to content

fix(hook-census): keep ".md" out of the scratch paths so the spawn budget is deterministic - #8579

Merged
kyle-sexton merged 1 commit into
mainfrom
work-resolve-issue/issue-8425-39312357485-1
Oct 20, 2026
Merged

kyle-sexton merged 1 commit into
mainfrom
work-resolve-issue/issue-8425-39312357485-1

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Closes #8425

Summary

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

The spawn-budget case failed intermittently because hook-census's mktemp default template tmp.XXXXXXXXXX could draw a suffix starting md, putting .md in the payload's DIR paths. The markdown-format launcher then ran the script instead of skipping (spawns=6 instead of 1). The scratch directory template no longer has a dot before the random part, so the count is deterministic.

Not verified

  • 20 consecutive local runs: moved to #8513 (needs-human) by the maintainer's comment, since a lane run cannot demonstrate it
  • Cause is inferred from reading the code: the failing runs' temp suffixes are not available, so the intermittent failure was not reproduced

Fix

  • scripts/hook-census.sh: scratch dir is now mktemp -d "${TMPDIR:-/tmp}/hook-census-XXXXXXXXXX", with a comment naming #8425

Verification

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

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

The run reports:

Left out: the items under Not verified.

Related

#8425

…dget is deterministic

mktemp's random suffix could start with "md", putting ".md" in the payload's
@dir@ paths. The markdown-format launcher then ran the script instead of
skipping, giving spawns=6 instead of 1 (#8425).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

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

No security issues found. PR #8579 changes only scripts/hook-census.sh. It changes the mktemp -d templates so the random suffix can't begin .md. The scratch directory is still created by mktemp -d with a random suffix and owner-only permissions, under ${TMPDIR:-/tmp}. The rm -rf "$WORK" trap acts on that directory, and no external or untrusted input feeds the path. No instruction surface, guardrail, trust boundary, secret or workflow is touched.

@github-actions

Copy link
Copy Markdown
Contributor

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

No findings. I read the one-file diff to scripts/hook-census.sh, the PR context, and the mktemp and @DIR@ uses in the script. I did not run the markdown-format test or reproduce the intermittent failure.

Cause. The cause in the PR is plausible from the code. With the old mktemp -d default (tmp.XXXXXXXXXX), a random suffix starting md puts .md into $WORK and so into the payload's @DIR@ paths. The old per-run template run.XXXXXX had the same exposure. A launcher that skips on .md text would then run the script, which gives the observed spawns=6 instead of spawns=1.

Fix.

  • Both templates now put - before the random part (hook-census-XXXXXXXXXX, run-XXXXXX).
  • mktemp fills the random part with alphanumerics only, so no .md can appear from it.
  • The fixed path pieces (/repo, /transcript.jsonl, run-, hook-census-) add no .md either.
  • The remaining .md risk is an inherited $TMPDIR that itself contains .md, which is negligible.
  • "${TMPDIR:-/tmp}/…" is a safe explicit base. The inner TMPDIR="$run/tmp" applies only to the env -i fires and is untouched.

Closing issue #8425.

  • Its acceptance criterion is "The cause of the extra spawns … is found and fixed, or the assertion is made deterministic".
  • The maintainer comment narrows the scope to that plus plugins/markdown-format/hooks/markdown-format.test.sh passing in the run.
  • The change meets the criterion in substance: it removes the nondeterministic input, and the existing spawn-budget case in the test would fail if the leak came back.
  • The "20 consecutive local runs" criterion moved to test(markdown-format): confirm the spawn-budget fix holds over 20 runs and 48 hours of main #8513 by the maintainer's comment, so it is out of scope here.

Author-claimed and unverified by me.

  • PASS=47 FAIL=0 for the markdown-format test.
  • check-changelog-fragments passing.
  • The fresh-context subagent review of the diff.

Not verified. The PR body says the cause is inferred, not reproduced, because the failing runs' temp suffixes are not available. I agree the inference holds from the code.

Other checks.

  • No embedded-instruction text was found in the PR context.
  • No .claude/rules/ rule matches scripts/*.sh.
  • Not checked: the paved-path standards index and the .claude/rules/ paths: frontmatter. I did not look for either.

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor Author

Unattended merge: risk HIGH at head b42778afa804e44a51eb5e47ef6bb04ededa6a45. Only LOW merges without a human. A floor path or capability change holds it: a human merges it in person, never an agent or a lane.

HIGH high-path:scripts/**: scripts/hook-census.sh

This refusal has stood unchanged at this head, so a person is needed: the pr-merge lane added the human-gated label.

@melodic-automation-lanes melodic-automation-lanes Bot added the needs-human Human-in-the-loop required; autonomous sessions must not resolve items carrying this. label Oct 20, 2026
@kyle-sexton
kyle-sexton added this pull request to the merge queue Oct 20, 2026
Merged via the queue into main with commit 2ceb175 Oct 20, 2026
43 checks passed
@kyle-sexton
kyle-sexton deleted the work-resolve-issue/issue-8425-39312357485-1 branch October 20, 2026 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-human Human-in-the-loop required; autonomous sessions must not resolve items carrying this.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(markdown-format): spawn-budget test fails intermittently on main

1 participant