Skip to content

Commit b04b872

Browse files
committed
chore: stop tracking local agent session state (#567)
The .codexclaw/ goalplans and ledgers are per-machine agent state. They were committed with 'git add -f' despite the ignore rule, and once tracked the rule stopped applying, so they rode along into main and preview. Untrack them (files stay on disk), drop two .DS_Store files that got in the same way, and add tests/repo-hygiene.test.ts so a forced add fails CI instead of landing silently. Also drop a registry.ts comment pointing at a .codexclaw evidence file that was never committed and cannot be resolved by any reader.
1 parent f2a9fce commit b04b872

9 files changed

Lines changed: 63 additions & 767 deletions

File tree

.codexclaw/goalplans/opencodex-4-pabcd-work-phase-wp1-wp2-dev2-go-pr/goalplan.json

Lines changed: 0 additions & 356 deletions
This file was deleted.

.codexclaw/goalplans/opencodex-4-pabcd-work-phase-wp1-wp2-dev2-go-pr/ledger.jsonl

Lines changed: 0 additions & 21 deletions
This file was deleted.

.codexclaw/goalplans/opencodex-live-unfinished-issues-and-prs-triage/goalplan.json

Lines changed: 0 additions & 365 deletions
This file was deleted.

.codexclaw/goalplans/opencodex-live-unfinished-issues-and-prs-triage/ledger.jsonl

Lines changed: 0 additions & 24 deletions
This file was deleted.

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,14 @@ devlog/
88
.opencode/
99

1010
# Local agent/session artifacts
11+
# These are per-machine agent state (goalplans, ledgers, evidence scratch).
12+
# They are never part of the product and must not be committed, not even with
13+
# `git add -f` — see tests/repo-hygiene.test.ts, which fails if any path here
14+
# becomes tracked again.
1115
.codexclaw/
16+
**/.codexclaw/
1217
.omo/
18+
**/.omo/
1319

1420
# Test-generated artifacts
1521
tests/.tmp-*/

devlog/.DS_Store

-6 KB
Binary file not shown.

devlog/_plan/.DS_Store

-6 KB
Binary file not shown.

src/providers/registry.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,6 @@ export const PROVIDER_REGISTRY: readonly ProviderRegistryEntry[] = [
978978
authKind: "key",
979979
dashboardUrl: "https://ollama.com/settings/keys",
980980
// Live IDs verified 2026-07-10; qwen3-coder:480b retires 2026-07-15.
981-
// Evidence: .codexclaw/evidence/260710_wp9_ollama_cloud_model_ids.md.
982981
models: ["glm-5.2", "deepseek-v4-pro", "qwen3-coder:480b", "gpt-oss:120b", "kimi-k2.6", "minimax-m3", "qwen3.5:397b", "gemma4:31b"],
983982
defaultModel: "glm-5.2",
984983
noVisionModels: [

tests/repo-hygiene.test.ts

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import { describe, expect, test } from "bun:test";
2+
import { fileURLToPath } from "node:url";
3+
4+
const repoRoot = fileURLToPath(new URL("../", import.meta.url));
5+
6+
/**
7+
* Local agent/session state must never reach a commit.
8+
*
9+
* `.gitignore` alone does not enforce this: `git add -f` overrides it silently,
10+
* and once a path is tracked the ignore rule stops applying to it entirely. The
11+
* `.codexclaw/` goalplans and ledgers were committed exactly that way and rode
12+
* along into `main` and `preview` before anyone noticed.
13+
*
14+
* This test closes that gap by asserting against the real index instead of the
15+
* ignore file, so a forced add fails CI on the commit that introduces it.
16+
*/
17+
const FORBIDDEN_TRACKED_DIRS = [".codexclaw", ".omo", ".claude", "node_modules", ".tmp"];
18+
19+
const FORBIDDEN_TRACKED_FILENAMES = [".DS_Store", "Thumbs.db"];
20+
21+
function trackedFiles(): string[] {
22+
const result = Bun.spawnSync(["git", "ls-files"], { cwd: repoRoot });
23+
if (result.exitCode !== 0) {
24+
throw new Error(`git ls-files failed: ${new TextDecoder().decode(result.stderr)}`);
25+
}
26+
return new TextDecoder()
27+
.decode(result.stdout)
28+
.split("\n")
29+
.map((line) => line.trim())
30+
.filter(Boolean);
31+
}
32+
33+
describe("repository hygiene", () => {
34+
test("no local agent or session state is tracked", () => {
35+
const offenders = trackedFiles().filter((path) =>
36+
path.split("/").some((segment) => FORBIDDEN_TRACKED_DIRS.includes(segment)),
37+
);
38+
39+
expect(offenders).toEqual([]);
40+
});
41+
42+
test("no OS metadata files are tracked", () => {
43+
const offenders = trackedFiles().filter((path) =>
44+
FORBIDDEN_TRACKED_FILENAMES.includes(path.split("/").pop() ?? ""),
45+
);
46+
47+
expect(offenders).toEqual([]);
48+
});
49+
50+
test("gitignore still declares the agent-state directories", async () => {
51+
const ignore = await Bun.file(new URL("../.gitignore", import.meta.url)).text();
52+
53+
for (const dir of FORBIDDEN_TRACKED_DIRS) {
54+
expect(ignore).toContain(`${dir}/`);
55+
}
56+
});
57+
});

0 commit comments

Comments
 (0)