diff --git a/README.md b/README.md index 529e36cf..cb9397b1 100644 --- a/README.md +++ b/README.md @@ -357,6 +357,7 @@ Every community PR that lands in main is credited here — that's a project rule - [@davekopecek](https://github.com/davekopecek) (Dave Kopecek) — committed the design-reference fixture so the design-token guard runs on every machine (#30) - [@snapsynapse](https://github.com/snapsynapse) (Sam Rogers) — graceful shutdown on SIGINT/SIGTERM with worker-tree cleanup and finished state, plus the 14-test end-to-end CLI regression suite (#4) - [@mlava](https://github.com/mlava) (Mark Lavercombe) — named setup failures across every diagnostic surface (#37) and `run --baseline`, the no-workers check preflight (#38) +- [@jeffhamons](https://github.com/jeffhamons) (Jeff Hamons) — a private OpenCode session store per worker, ending the `database is locked` deaths that made concurrent cheap-tier workers look like model failures (#79), and fix-swarm staging scoped to owned files instead of sweeping worktree debris (#80) Contributions are welcome — see [CONTRIBUTING.md](CONTRIBUTING.md) for the philosophy and what gets a PR merged fast. The short version: small and scoped, rebased on current main, every claim backed by an executed test. Authorship is always preserved — where a maintainer pushes a mechanical fix to your branch, you remain the commit author. diff --git a/templates/fix-swarm/checks/fix-swarm.py b/templates/fix-swarm/checks/fix-swarm.py index 9c482150..1e84aa31 100644 --- a/templates/fix-swarm/checks/fix-swarm.py +++ b/templates/fix-swarm/checks/fix-swarm.py @@ -131,9 +131,27 @@ def main() -> int: ) ) - add_result = run_git(["add", "-A"]) - if add_result.returncode != 0: - failures.append(fail("git_add_failed", output_tail(add_result.stdout))) + if "*" in owned_files: + add_result = run_git(["add", "-A"]) + if add_result.returncode != 0: + failures.append(fail("git_add_failed", output_tail(add_result.stdout))) + else: + # Stage tracked-file modifications (so out-of-lane edits to existing + # files still get caught by the owned-files check below) plus any + # new files under the owned paths. Deliberately does NOT `add -A`: + # worker/check subprocesses can leave untracked debris in the + # worktree (e.g. a sandboxed pytest run falling back to cwd for its + # basetemp) that has nothing to do with the agent's actual diff. + add_u_result = run_git(["add", "-u"]) + if add_u_result.returncode != 0: + failures.append(fail("git_add_failed", output_tail(add_u_result.stdout))) + # Only pass owned paths that actually exist: `git add -- ` hard-fails + # ("did not match any files") for a declared-but-untouched owned path. + existing_owned = [item for item in owned_files if Path(item).exists()] + if existing_owned: + add_owned_result = run_git(["add", "--"] + existing_owned) + if add_owned_result.returncode != 0: + failures.append(fail("git_add_failed", output_tail(add_owned_result.stdout))) if not args.summary.is_absolute() and args.summary.exists(): run_git(["reset", "--quiet", "--", str(args.summary)])