You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What broke: When an Archon workflow runs, the worktree-copy step pulls untracked files from the source checkout into the new worktree. If any such file lands under .archon/workflows/defaults/ (or any path scanned by generate:bundled), the workflow's validation step regenerates packages/workflows/src/defaults/bundled-defaults.generated.ts to include it, and the workflow's commit/push step then commits both the leaked file and the regenerated bundle into the PR.
When it started: Pre-existing — same class of issue as fix(workflows): stop sweeping scratch artifacts from every git add -A site #1506 (fix(workflows): stop sweeping scratch artifacts from every git add -A site), which fixed the git add -A sweeping path but did not address the worktree-copy + bundled-defaults regeneration vector.
Severity: major — silently pollutes PRs with unrelated changes; reviewers may miss the leak; reverting requires manual cleanup.
Real-world repro
Hit during work on #1576 → the resulting PR #1577 included .archon/workflows/defaults/archon-feedback.yaml (+337 lines) and a corresponding bundled-defaults.generated.ts change, neither of which had any relationship to the actual fix (a one-line path-separator normalization in scripts/check-bundled-skill.ts). Cleanup commit: 4cebf054.
Steps to Reproduce
In your Archon source checkout, create an untracked file at .archon/workflows/defaults/<anything>.yaml. (Leave it untracked — do not stage or commit.) The user's case was a draft of a personal community-feedback workflow.
Run any Archon workflow that produces a PR (archon workflow run archon-fix-github-issue --branch ...).
When the workflow opens its PR, observe that the PR includes:
The untracked file you never staged (.archon/workflows/defaults/<anything>.yaml)
A change to packages/workflows/src/defaults/bundled-defaults.generated.ts adding an entry for it
Expected vs Actual
Expected: The worktree starts from a clean checkout of the target branch. Untracked files in the source checkout do not propagate into the worktree, and definitely never get committed.
Actual: Worktree-copy pulls the untracked file into the worktree → bun run generate:bundled (run as part of validation/self-fix) regenerates bundled-defaults.generated.ts to embed it → workflow commits both files → both end up in the PR with no warning.
Root Cause
Two-step leak:
packages/isolation/src/worktree-copy.ts copies untracked files from the source checkout into the new worktree (presumably as a "preserve in-progress work" feature).
scripts/generate-bundled-defaults.ts scans .archon/workflows/defaults/ and .archon/commands/defaults/ on disk; whatever it finds gets embedded into the generated bundle.
When the workflow's validation/self-fix loop runs bun run generate:bundled, the regenerated bundle picks up the leaked file. The workflow's commit step then git adds both the leaked file and the regenerated bundle.
User Flow
Maintainer source checkout Archon workflow Worktree PR
───────────────────────── ─────────────── ──────── ──
.archon/workflows/defaults/ ─copy─▶ worktree-copy.ts ─────▶ same untracked file
my-scratch.yaml (untracked) (preserves in-progress work) now sits in worktree
self-fix runs
bun run generate:bundled ─────▶ regenerated
bundled-defaults.generated.ts
(embeds my-scratch.yaml)
workflow commits + pushes ─────▶ [X] both files end up in PR ──▶ leaked into PR
with no warning to maintainer
Environment
Platform: CLI (archon workflow run archon-fix-github-issue)
Database: SQLite (default)
Running in worktree? Yes (worktree created by Archon)
OS: Windows 11 — but this is OS-agnostic; the worktree-copy + bundled-defaults regen is the same on every platform.
Logs
Excerpt from the workflow run that produced PR #1577:
.archon/workflows/defaults/archon-feedback.yaml +337 -0
packages/workflows/src/defaults/bundled-defaults.generated.ts +3 -2
... (the actual fix and unrelated review-driven changes) ...
Impact
Affected workflows/commands: any workflow that opens a PR — archon-fix-github-issue, archon-feature-development, archon-idea-to-pr, archon-plan-to-pr, archon-ralph-dag, etc.
Reproduction rate: Always — given an untracked file under .archon/{workflows,commands}/defaults/ in the source checkout.
Workaround available?
Maintainer hygiene — keep .archon/{workflows,commands}/defaults/ clean of untracked files; put draft workflows in .archon/workflows/ (project-scope, not defaults/) or ~/.archon/workflows/ (home-scope) instead.
Data loss risk? No — but it puts user's in-progress work into a public PR, which can be a privacy/IP concern.
Suggested Fixes
A few possibilities, not mutually exclusive:
Don't copy untracked files into worktrees by default — or at least exclude .archon/{workflows,commands}/defaults/ from the copy set, since those paths are bundled-defaults territory and should never include local drafts.
Refuse to commit/push files that weren't part of the workflow's own changes — the workflow knows which files it edited; anything else getting auto-staged is suspicious.
Warn at workflow start if the source checkout has untracked files under .archon/{workflows,commands}/defaults/ — the user almost certainly didn't mean for those to be defaults/.
Lint defaults/ to require tracked status — generate:bundled could refuse to embed a file that's not tracked in git, surfacing the issue at validation time.
The cleanest fix is probably (1) combined with (4): worktree-copy should skip defaults/ subtrees, and generate:bundled should warn when it finds untracked files there.
Summary
.archon/workflows/defaults/(or any path scanned bygenerate:bundled), the workflow's validation step regeneratespackages/workflows/src/defaults/bundled-defaults.generated.tsto include it, and the workflow's commit/push step then commits both the leaked file and the regenerated bundle into the PR.fix(workflows): stop sweeping scratch artifacts from every git add -A site), which fixed thegit add -Asweeping path but did not address the worktree-copy + bundled-defaults regeneration vector.major— silently pollutes PRs with unrelated changes; reviewers may miss the leak; reverting requires manual cleanup.Real-world repro
Hit during work on #1576 → the resulting PR #1577 included
.archon/workflows/defaults/archon-feedback.yaml(+337 lines) and a correspondingbundled-defaults.generated.tschange, neither of which had any relationship to the actual fix (a one-line path-separator normalization inscripts/check-bundled-skill.ts). Cleanup commit:4cebf054.Steps to Reproduce
.archon/workflows/defaults/<anything>.yaml. (Leave it untracked — do not stage or commit.) The user's case was a draft of a personal community-feedback workflow.archon workflow run archon-fix-github-issue --branch ...)..archon/workflows/defaults/<anything>.yaml)packages/workflows/src/defaults/bundled-defaults.generated.tsadding an entry for itExpected vs Actual
bun run generate:bundled(run as part of validation/self-fix) regeneratesbundled-defaults.generated.tsto embed it → workflow commits both files → both end up in the PR with no warning.Root Cause
Two-step leak:
packages/isolation/src/worktree-copy.tscopies untracked files from the source checkout into the new worktree (presumably as a "preserve in-progress work" feature).scripts/generate-bundled-defaults.tsscans.archon/workflows/defaults/and.archon/commands/defaults/on disk; whatever it finds gets embedded into the generated bundle.When the workflow's validation/self-fix loop runs
bun run generate:bundled, the regenerated bundle picks up the leaked file. The workflow's commit step thengit adds both the leaked file and the regenerated bundle.User Flow
Environment
archon workflow run archon-fix-github-issue)Logs
Excerpt from the workflow run that produced PR #1577:
Resulting PR file list (before cleanup):
Impact
archon-fix-github-issue,archon-feature-development,archon-idea-to-pr,archon-plan-to-pr,archon-ralph-dag, etc..archon/{workflows,commands}/defaults/in the source checkout..archon/{workflows,commands}/defaults/clean of untracked files; put draft workflows in.archon/workflows/(project-scope, notdefaults/) or~/.archon/workflows/(home-scope) instead.git rmthe leaked file, regenerate, commit, push.Suggested Fixes
A few possibilities, not mutually exclusive:
.archon/{workflows,commands}/defaults/from the copy set, since those paths are bundled-defaults territory and should never include local drafts..archon/{workflows,commands}/defaults/— the user almost certainly didn't mean for those to bedefaults/.defaults/to require tracked status —generate:bundledcould refuse to embed a file that's not tracked in git, surfacing the issue at validation time.The cleanest fix is probably (1) combined with (4): worktree-copy should skip
defaults/subtrees, andgenerate:bundledshould warn when it finds untracked files there.Scope
isolation(worktree-copy),workflows(bundled-defaults generation)packages/isolation/src/worktree-copy.ts,scripts/generate-bundled-defaults.tsRelated