Skip to content

Extend scratch-file workaround to dirs, harden revert-ladder rung 1 - #86

Merged
dmccoystephenson merged 3 commits into
mainfrom
fix/scratch-dir-and-revert-checkpoint
Jul 31, 2026
Merged

Extend scratch-file workaround to dirs, harden revert-ladder rung 1#86
dmccoystephenson merged 3 commits into
mainfrom
fix/scratch-dir-and-revert-checkpoint

Conversation

@dmccoystephenson

@dmccoystephenson dmccoystephenson commented Jul 30, 2026

Copy link
Copy Markdown
Member

Summary

  • Extends the scratch-file sandbox workaround (Universal rules) to cover scratch directory trees, not just single files: use python3 -c "import shutil; shutil.rmtree(path)" instead of rm -rf (fixes Scratch-file sandbox workaround (create-dev-loop.md:258) doesn't cover directory trees #85 — confirmed on medieval-factions-dev-loop, a session hit the classifier block on rm -rf for a session-created .gradle-local/ scratch dir).
  • Hardens the Tests-fix fallback ladder's former rung 1 ("CI-based temporary revert") so a killed session between "push the revert" and "restore the fix" doesn't leave a real broken commit shipping pre-fix behavior on the PR branch, undetected (fixes Tests-fix fallback ladder rung 1 (CI-based temporary revert) has no interruption-safe checkpoint #84):
    • New rung 1: prefer a local, non-pushed revert (git checkout <merge-base> -- <src files> → test → restore) whenever any local anchor can run at all, even partially — it never touches the pushed branch.
    • The CI-based push technique (now rung 2) is reserved for when rung 1 is genuinely unrunnable, and its revert commit message must now be a TEMP: revert <fix-sha> ... MUST be reverted before merge, see <verified-good-sha> marker so a resuming session doesn't need to reverse-engineer the stuck state from a bare red CI run.
    • Added a matching check to Phase 1's open-PR-from-previous-cycle handling: a red final CI run plus a TEMP:-prefixed HEAD commit is now a named signal to reset back to the verified-good SHA and restore, before falling through to generic "CI is red" handling.

Research grounding

No RESEARCH.md finding applies directly — both changes are harness/process robustness fixes (sandbox command classification, and crash-recovery of an in-progress self-review step) rather than an empirical finding about agent behavior.

Test plan

Ran the modified template's Steps 1-4 against a real fixture repo (dmccoystephenson/dans-plugin-manager, cloned fresh, no existing skill — exercised fresh-generation, not update mode) and manually inspected the output:

  • Generated skill file has zero unresolved {{placeholders}} (grep -n '{{' <output> — no matches)
  • All 13 fenced code blocks survived embedding correctly (26 triple-backtick markers, no leftover escaped backslash-triple-backtick artifacts)
  • <!-- template-version: e933cdb --> / <!-- generated-at: ... --> comments present directly below the # <slug>-dev-loop H1
  • The new scratch-directory guidance, the renumbered/hardened Tests-fix ladder, and the new orphaned-PR TEMP: check all resolved into the generated output with placeholders substituted correctly (CI, main, repo name, etc.)
  • python3 scripts/check_docs.py passes (placeholder/Step-count/link checks)
  • Slash-command registration (Step 5) and GitHub repo creation (Step 6) were intentionally skipped for this fixture run — this PR doesn't change those steps, and registering a real skill/repo isn't warranted for a docs-only template validation.

Closes #85
Closes #84


This PR description was drafted during a Gardener session (Stephenson-Software/gardener).

dmccoystephenson and others added 3 commits July 30, 2026 03:14
…ix rung 1 revert with a local-first preference and interruption-safe checkpoint

Closes #85
Closes #84

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…der, doesn't sit inside it

The ladder is gated on the tool/interpreter being unavailable (UNVERIFIED), so a rung
requiring a working local anchor could never be reached as worded. Move the local,
non-pushed checkout-revert preference to a pre-check before the ladder instead.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
… rung 1

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@dmccoystephenson

Copy link
Copy Markdown
Member Author

Self-review rubric:

  • Scope: PASS — only create-dev-loop.md modified; every hunk is required by Scratch-file sandbox workaround (create-dev-loop.md:258) doesn't cover directory trees #85 or Tests-fix fallback ladder rung 1 (CI-based temporary revert) has no interruption-safe checkpoint #84 (no unrelated formatting/renames).
  • Placeholder-consistency: PASS — no new {{placeholder}} tokens introduced; the diff reuses {{EXTERNAL_SIGNAL_LABEL}} and {{DEFAULT_BRANCH}}, both already rows in the Step 4 table. Confirmed via fixture generation: grep -n '{{' <generated output> had zero matches.
  • Escaping: PASS — no new fenced (triple-backtick) code blocks were added, only inline single-backtick code spans, so the leading-backslash escaping rule doesn't apply to this diff. Confirmed the existing 13 fenced blocks in the surrounding template still round-trip correctly through generation (26 triple-backtick markers in the fixture output, zero leftover escaped artifacts).
  • Docs: PASS — README's Step count is unaffected (no Step added/removed, only prose within existing Phase 1/3/4 sections); RESEARCH.md needs no update since no finding applies (stated explicitly in the PR body per CLAUDE.md's grounding rule).
  • Research-grounding: PASS — PR body states explicitly that no RESEARCH.md finding applies; both changes are harness/process-robustness fixes, not behavioral findings.
  • Issue resolution: PASS — Scratch-file sandbox workaround (create-dev-loop.md:258) doesn't cover directory trees #85's suggested shutil.rmtree addition is present verbatim in the Universal rules bullet. Tests-fix fallback ladder rung 1 (CI-based temporary revert) has no interruption-safe checkpoint #84's three suggested actions (prefer local revert first, TEMP:-tagged CI-push as last resort, Phase 1 stuck-mid-revert detection) are all present.
  • Sibling structure / sibling renames: no signal this cycle — no new files or renamed identifiers.
  • Manual validation: PASS — generated a real skill (dans-plugin-manager-dev-loop.md) from this branch's create-dev-loop.md against a freshly cloned fixture repo (dmccoystephenson/dans-plugin-manager, fresh-generation mode). Zero unresolved placeholders, header comments correctly placed below the H1 with matching SHA, all new prose (scratch-dir guidance, hardened ladder, Phase 1 TEMP: check) resolved correctly with real values substituted.

One thing I found and fixed mid-review (not a FAIL left open, but worth flagging): my first pass at #84 introduced a self-contradiction — a fallback-ladder rung that required "a local anchor that can run" nested inside a ladder explicitly gated on "the local anchor cannot run" (UNVERIFIED), making that rung unreachable as worded. Reworked it as a pre-check before the ladder (a checkout-based retry of the primary stash-and-run experiment) rather than a ladder rung, which also let the CI-based-revert rung keep its original number (1) instead of shifting to 2 — caught and fixed a stale "rung 2" cross-reference in Phase 1 as a result.

Manual validation used the working tree at commit 0fb0046 (this branch's tip). Slash-command registration (Step 5) and GitHub repo/label creation (Step 6) were intentionally skipped for the fixture run — this PR doesn't touch those steps, and creating a real skill/repo isn't warranted for a docs-only template validation.

@dmccoystephenson

Copy link
Copy Markdown
Member Author

Do-not-auto-merge check: this PR modifies create-dev-loop.md (the template itself), which is on this skill's do-not-auto-merge list — leaving open for human review rather than merging autonomously.

@dmccoystephenson

Copy link
Copy Markdown
Member Author

Triage note: issues #81 and #79 were also open this cycle but deferred — both require editing CLAUDE.md (agent-loaded config), which needs explicit human authorization per this skill's harness-blocked-operations rule, so neither was attempted. #79 additionally needs a maintainer decision between two resolutions (make gardener public vs. soften the docs) that isn't a docs-sweep call to make.

@dmccoystephenson
dmccoystephenson merged commit 07735e3 into main Jul 31, 2026
1 check passed
@dmccoystephenson
dmccoystephenson deleted the fix/scratch-dir-and-revert-checkpoint branch August 3, 2026 06:01
dmccoystephenson added a commit that referenced this pull request Aug 3, 2026
)

* Extend scratch-file sandbox workaround to directories, harden Tests-fix rung 1 revert with a local-first preference and interruption-safe checkpoint

Closes #85
Closes #84

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Fix self-review contradiction: local checkout-revert precedes the ladder, doesn't sit inside it

The ladder is gated on the tool/interpreter being unavailable (UNVERIFIED), so a rung
requiring a working local anchor could never be reached as worded. Move the local,
non-pushed checkout-revert preference to a pre-check before the ladder instead.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Fix stale rung-2 cross-reference after ladder renumbering reverted to rung 1

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant