Skip to content

fix(team): exclude worker runtime state under .gjc/state from auto-checkpoints - #4603

Merged
probepark merged 2 commits into
Yeachan-Heo:devfrom
Veritas-7:fix/team-checkpoint-gjc-state-protection
Aug 18, 2026
Merged

probepark merged 2 commits into
Yeachan-Heo:devfrom
Veritas-7:fix/team-checkpoint-gjc-state-protection

Conversation

@Veritas-7

@Veritas-7 Veritas-7 commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

What

gjc team worker auto-checkpoints no longer commit and merge root-level worker runtime state (.gjc/state/**, e.g. SDK broker endpoints like .gjc/state/sdk/<session-id>.json and settings migration markers) into the leader repo's default branch.

  • packages/coding-agent/src/gjc-runtime/team-runtime.ts: PROTECTED_WORKER_CHECKPOINT_PREFIXES now covers both GJC runtime roots — .gjc/_session-*/ and .gjc/state/ — with the stale single-root comment replaced by the two-root invariant. User-owned .gjc/ content (config.yml, agents/, skills/) stays eligible: worker edits there are reviewable work.
  • packages/coding-agent/test/gjc-runtime/team-runtime.test.ts: the worker-runtime-state guard is relocated beside the other classification tests and extended with matcher-boundary cases (bare .gjc/state protected; .gjc/state-deep/x.md, .gjc/statement.txt eligible). The pre-existing e2e guard now asserts absence at the actual leader merge-target path .gjc/state/team/runtime.json instead of the unrelated session-scoped teamStateRoot(...) path (the old assertion was provably blind to this exact defect), plus a no-protected-paths-in-leader-status check.
  • packages/coding-agent/CHANGELOG.md: [Unreleased] entry.

Why

Observed in the field: running gjc team in a git repository, the leader's default branch gained auto-checkpoint commits containing worker session runtime state files (.gjc/state/sdk/...). The classifier only excluded .gjc/_session-*/; a worker CLI session writes root-level runtime state into its provisioned worktree, and on the next monitor cycle autoCommitDirtyWorker commits those files as gjc(team): auto-checkpoint ..., then integrateGjcWorkerCommits merges them into the leader branch.

Rebased onto current dev (7265a61) by maintainer fix-forward; original substantive commit preserved with author attribution (Veritas-7), amendment commit by maintainer. The previously submitted head cc3aee4 was based on main and its PR-contract CI could not compute the base...head diff; this head is a descendant of dev, which the exact-head contract requires.

Testing

Reproduction (mutation proof, on this head): reverting only the PROTECTED_WORKER_CHECKPOINT_PREFIXES line makes bun test packages/coding-agent/test/gjc-runtime/team-runtime.test.ts -t "protects worker runtime state" fail (classification includes .gjc/state/sdk/runtime.json as eligible); with the fix it passes (5 expect calls). Transcript: artifacts/ralplan-4603/mutation-prefix-fail.txt.

Validation on head 5b3c540 (base 7265a61):

  • bun test packages/coding-agent/test/gjc-runtime/team-runtime.test.ts -t "protects worker runtime state" → 1 pass
  • bun test ... -t "checkpoint classification excludes" → 1 pass
  • bun test ... -t "memory guard wiring" → 4 pass
  • bun test ... -t "native gjc team runtime" → 78 pass, 0 fail
  • bun --cwd=packages/coding-agent run check → green (biome + tsc -p tsconfig.json --noEmit)
  • bun scripts/verify-gjc-state-writers.ts --fail → "0 write site(s) outside the sanctioned writer / known allowlist"
  • bun scripts/changelog-history-guard.ts → "no released sections removed"; bun test scripts/changelog-history-guard.test.ts → 12 pass
  • git diff --check 7265a61c8e...HEAD → clean
  • Three-dot binary diff SHA-256 vs 7265a61: d91985db82751f3f2a248ffee91c729499719da8131175803c5e32629433124d

Known unrelated pre-existing local-env failure: "stalled worker continuation protocol > dispatches continuation through psmux" fails identically on clean dev 7265a61 checkout in this environment (native addon load), not caused by this diff.

GJC verdict

gajae.pr-review-verdict.v1 merge-approved sha256:d91985db82751f3f2a248ffee91c729499719da8131175803c5e32629433124d reviewer:human reviewer-id:probepark evidence:approved-review@5b3c54008d+local-tests+pkg-check+state-writers+changelog-guard+dev-ci-run-32095291587-green

  • Target branch is dev
  • bun check passes (coding-agent package check: biome + tsc green)
  • Tested locally
  • CHANGELOG updated (user-facing fix)
  • Verdict above matches the exact PR head (5b3c540), not an earlier commit


[repo owner's gaebal-gajae (clawdbot) 🦞]

@Yeachan-Heo
Yeachan-Heo changed the base branch from main to dev August 17, 2026 09:41
@Yeachan-Heo
Yeachan-Heo force-pushed the fix/team-checkpoint-gjc-state-protection branch from cc3aee4 to aad5b7d Compare August 18, 2026 01:55
@Yeachan-Heo

Copy link
Copy Markdown
Owner

Exact-head delivery status for aad5b7d08b781908037fe97a139cb04f33fce4ab on base 44d7b6ee07168234e00206c8f080ee5194728056:

  • exact binary diff SHA-256: 0aa35b2342e613ca599b4ce4422e3b96ed6b1600bb4504373d0acea6c8ae52c7
  • PR body now contains exactly one truthful needs-human verdict
  • state gates and affected-path planning are green
  • product Dev CI run 32090142592 remains in progress; native build is currently running
  • bootstrap failure is the intentional independent-review gate: no authorized non-author approval exists at this exact head yet
  • fresh exact-head review requested from @probepark and @snowykr

This head will not be merged until an authenticated exact-head approval updates the verdict to merge-approved and exact-head contract plus product CI are green.


[repo owner's gaebal-gajae (clawdbot) 🦞]

@Yeachan-Heo

Copy link
Copy Markdown
Owner

Exact-head delivery status — PR #4603

Head: aad5b7d08b781908037fe97a139cb04f33fce4ab on base dev @ 44d7b6ee07168234e00206c8f080ee5194728056 (retargeted from stale main base; head is a descendant of dev as the contract requires).
Three-dot binary diff SHA-256: 0aa35b2342e613ca599b4ce4422e3b96ed6b1600bb4504373d0acea6c8ae52c7 — matches the verdict line in the PR body (CI-verified: "Stale verdict digest" check passed, base=dev, exactly one verdict line).
Attribution: substantive fix fix(team): exclude worker runtime state under .gjc/state from auto-checkpoints authored by Veritas-7 (cherry-picked verbatim); maintainer amendment commit pins matcher boundaries, fixes the blind leader merge-target e2e assertion, adds the CHANGELOG entry.

Reproduction (mutation proof, on this head)

Reverting only the PROTECTED_WORKER_CHECKPOINT_PREFIXES line makes bun test packages/coding-agent/test/gjc-runtime/team-runtime.test.ts -t "protects worker runtime state" fail (classifier marks .gjc/state/sdk/runtime.json eligible); with the fix it passes.

Validation evidence (local, head aad5b7d)

  • -t "protects worker runtime state" → 1 pass; -t "checkpoint classification excludes" → 1 pass; -t "memory guard wiring" → 4 pass; -t "native gjc team runtime" → 78 pass / 0 fail
  • bun --cwd=packages/coding-agent run check → green (biome + tsc -p tsconfig.json --noEmit)
  • bun scripts/verify-gjc-state-writers.ts --fail0 write site(s) outside the sanctioned writer / known allowlist
  • bun scripts/changelog-history-guard.ts → no released sections removed; guard tests 12 pass
  • git diff --check 44d7b6ee...HEAD → clean

Current CI (fresh, exact head)

  • PR contract (Validate exact-head PR contract, run 32090142665): all structural checks green (single verdict line, pattern, base=dev, ancestry, digest match, fast gate); fails only on needs-human intentionally blocks merge — the expected hold until an authorized exact-head approval exists. Earlier runs (32089959959/32090025648) raced the body edit and/or were cancelled mid-apt install; superseded.
  • Dev CI (run 32090142592): in progress; Affected path validation / native-build and plan, gjc-state-gates (integrity/static/runtime/read) already green.

Hold

Awaiting a fresh authorized non-author exact-head review at aad5b7d0 (repo admin/maintain/write). On an approving review, the verdict line will be updated to merge-approved with this same digest and CI re-run; merge follows only with contract + product CI green.

Residual scope (follow-up, not this PR): .gjc/ultragoal/ fallback root and .gjc/runtime/<id>/owner-lifecycle/** remain eligible by low-probability disposition; an allow-by-default classifier design is the long-term fix.


[repo owner's gaebal-gajae (clawdbot) 🦞]

@Yeachan-Heo
Yeachan-Heo requested a review from HaD0Yun August 18, 2026 02:09
Veritas-7 and others added 2 commits August 18, 2026 03:18
…eckpoints

The auto-checkpoint classifier protects `.gjc/_session-*/` but not
`.gjc/state/`. A worker CLI session writes its runtime state (for example
.gjc/state/sdk/<session-id>.json) into its provisioned worktree's .gjc tree;
on the next monitor cycle those files are classified as eligible work and
committed as `gjc(team): auto-checkpoint ...`, then merged into the leader
repo's default branch — polluting main with runtime artifacts.

Extend PROTECTED_WORKER_CHECKPOINT_PREFIXES with `.gjc/state/` so worker
runtime state is never checkpointed or merged. Add a unit test asserting the
classifier treats .gjc/state files as protected (fails without the fix).
…rget assertion

The worker-runtime-state e2e guard asserted absence at the session-scoped
teamStateRoot path while the pollution path deposits root-level state at the
leader's `.gjc/state/team/runtime.json`; pre-fix that assertion was provably
blind to this exact defect. Assert the actual merge-target path and that no
protected runtime-root path appears in leader status. Also pin the prefix
matcher boundaries (bare `.gjc/state` protected; `.gjc/state-*` siblings
eligible), relocate the test beside the other classification tests, and
record the fix under [Unreleased].

Lore-id: pr-4603-state-protection
Constraint: preserve Veritas-7's substantive commit attribution
Constraint: no new protected prefixes beyond .gjc/state/
Confidence: high
Scope-risk: narrow
Reversibility: straightforward
Tested: bun test team-runtime.test.ts -t "protects worker runtime state"; -t "checkpoint classification excludes"
Not-tested: full stalled-worker continuation suite (pre-existing native-addon env failure on clean dev)
@Yeachan-Heo
Yeachan-Heo force-pushed the fix/team-checkpoint-gjc-state-protection branch from aad5b7d to 5b3c540 Compare August 18, 2026 03:21

@probepark probepark left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent maintainer review at exact head 5b3c540. independent-architect-review-bare-gjc-state-entry-and-descendants-excluded-without-swallowing-gjc-state-sibling-prefixes-leader-merge-target-asserted

@Yeachan-Heo

Copy link
Copy Markdown
Owner

Exact-head delivery status — PR #4603 (reconstructed onto live dev)

Superseded: prior head aad5b7d08b (base 44d7b6e) predated merged #4616; all its approval/verdict/CI state is stale and was not reused.

Current delivery: head 5b3c54008da260748d87198adffe43527c034ee6 on base dev @ 7265a61c8ed489b6a9461ba7e991198e46c25208, pushed with force-with-lease to the existing branch fix/team-checkpoint-gjc-state-protection (maintainer modification authorized). Attribution preserved: substantive fix(team): exclude worker runtime state under .gjc/state from auto-checkpoints authored by Veritas-7 with original author date (Sun Aug 16 13:47:36 2026 +0900); maintainer amendment commit 5b3c5400 pins matcher boundaries, fixes the blind leader merge-target e2e assertion, and adds the CHANGELOG entry. CHANGELOG [Unreleased] keeps the sibling #4616 resume-listing entry intact.

Three-dot binary diff SHA-256 (7265a61...5b3c540): d91985db82751f3f2a248ffee91c729499719da8131175803c5e32629433124d — CI-verified as matching the PR body verdict line (no stale-digest diagnostic).

Validation on head 5b3c540 (local)

  • bun test ...team-runtime.test.ts -t "protects worker runtime state" → 1 pass; -t "checkpoint classification excludes" → 1 pass; -t "memory guard wiring" → 4 pass; -t "native gjc team runtime" → 78 pass / 0 fail
  • bun --cwd=packages/coding-agent run check → green (biome + tsc -p tsconfig.json --noEmit)
  • bun scripts/verify-gjc-state-writers.ts --fail0 write site(s) outside the sanctioned writer / known allowlist
  • bun scripts/changelog-history-guard.ts → no released sections removed; guard tests 12 pass
  • git diff --check 7265a61c8e...HEAD → clean
  • Mutation proof (unchanged from prior delivery, same code path): reverting only the PROTECTED_WORKER_CHECKPOINT_PREFIXES line fails the protection test.

Fresh CI on exact head 5b3c540

  • PR contract (run 32095292004): all structural checks green — exactly one verdict line, pattern-valid, base=dev, ancestry, digest match, fast gate (0 write sites). Fails only on the intentional needs-human merge-block; this is the correct hold until an authorized exact-head approval exists.
  • Dev CI (run 32095291587): all product jobs greenAffected path validation (plan, native-build, ts-build, the targeted team-runtime.test.ts shard, evidence producer), gjc-state-gates (integrity/static/runtime/read), Virtual integration validation. Windows/darwin jobs skipped by plan.

Hold

Zero reviews exist at this head. Awaiting a fresh authorized non-author exact-head review at 5b3c54008d from the requested reviewers (probepark, snowykr, HaD0Yun — repo push permission, none is the author). Only an actual fresh approval permits flipping the verdict to merge-approved (same digest) and re-running the contract; squash-merge into dev follows only on approval + contract/product CI green. No release/tag/publish.


[repo owner's gaebal-gajae (clawdbot) 🦞]

@probepark
probepark merged commit 4f719aa into Yeachan-Heo:dev Aug 18, 2026
62 of 78 checks passed
pull Bot pushed a commit to folding-mirror/gajae-code that referenced this pull request Aug 18, 2026
…oes not ship

Cherry-picking Yeachan-Heo#4648 hit a CHANGELOG conflict whose union resolution also
pulled in the neighbouring `gjc team` worker-runtime-state bullet from
Yeachan-Heo#4603. That commit is deliberately excluded from the 0.14.1 pick set, so
the bullet advertised a fix the release does not contain.

Lore-id: 4c1f9a02
Constraint: Unreleased bullets must describe exactly the approved pick set
Confidence: high
Scope-risk: narrow
Reversibility: trivial
Tested: re-audited every Unreleased bullet against branch commit provenance
Yeachan-Heo pushed a commit that referenced this pull request Aug 20, 2026
Brings the 0.14.2 release commits — version bumps to 0.14.2, the released
[0.14.2] changelog sections, the pi-natives version sentinel, lockfiles,
and plugin metadata — back onto dev.

Conflict resolution: every source conflict took dev's side. The 0.14.2
payload is a manifest-filtered subset of dev's own commits (patch-only,
explicitly excluding the team -> autoresearch cutover) plus one external
crash-relay commit (c1428d9, from origin/owner/issue-4715-crash-relay-gaps,
not on dev); dev already holds the same underlying changes plus later
evolution (crash-relay trust-boundary hardening past #4658/#4698/#4679,
sdk-broker liveness past #4704/#4705, session/notify fixes, ralplan
worktree-root work past #4699). packages/coding-agent/src/gjc-runtime/team-runtime.ts
and its test were removed on dev by the team->autoresearch cutover; the
0.14.2 branch's fix to that file (#4603) is moot post-cutover and the
deletion was honored. Release metadata (version numbers, CHANGELOG [0.14.2]
sections, native version sentinel, plugin/marketplace version+description,
Telegram daemon generation manifest) took main's side.

Fixed a duplicate getTrustedAgentFile/isProjectEnvDeclaration definition
in packages/utils/src/dirs.ts left over from the merge: main's older
standalone Object.hasOwn(parseEnvFile(...)) implementation and dev's newer
DirResolver-routed implementation both landed without a real conflict
(git treated the two independent insertions as compatible additions);
removed main's stale copy, kept dev's.

Known pre-existing issue, unrelated to this merge (reproduces identically
on pristine origin/dev @ 5f5a1c1): the "a checkout .env HOME declaration
cannot redirect trusted relay state" test in
packages/coding-agent/test/crash-upstream-relay.test.ts and the
"$credentialEnv > preserves inherited credentials when a hostile project
HOME overlays the runtime HOME" test in packages/utils/test/env.test.ts
both hang/time out (~5s) rather than completing. All 55 other tests in
crash-upstream-relay.test.ts pass. Verified via a separate pristine
origin/dev worktree with a fresh install/native build — not introduced by
this merge.
pull Bot pushed a commit to folding-mirror/gajae-code that referenced this pull request Aug 20, 2026
…eckpoints (Yeachan-Heo#4603)

* fix(team): exclude worker runtime state under .gjc/state from auto-checkpoints

The auto-checkpoint classifier protects `.gjc/_session-*/` but not
`.gjc/state/`. A worker CLI session writes its runtime state (for example
.gjc/state/sdk/<session-id>.json) into its provisioned worktree's .gjc tree;
on the next monitor cycle those files are classified as eligible work and
committed as `gjc(team): auto-checkpoint ...`, then merged into the leader
repo's default branch — polluting main with runtime artifacts.

Extend PROTECTED_WORKER_CHECKPOINT_PREFIXES with `.gjc/state/` so worker
runtime state is never checkpointed or merged. Add a unit test asserting the
classifier treats .gjc/state files as protected (fails without the fix).

* test(team): pin .gjc/state matcher boundaries and fix leader merge-target assertion

The worker-runtime-state e2e guard asserted absence at the session-scoped
teamStateRoot path while the pollution path deposits root-level state at the
leader's `.gjc/state/team/runtime.json`; pre-fix that assertion was provably
blind to this exact defect. Assert the actual merge-target path and that no
protected runtime-root path appears in leader status. Also pin the prefix
matcher boundaries (bare `.gjc/state` protected; `.gjc/state-*` siblings
eligible), relocate the test beside the other classification tests, and
record the fix under [Unreleased].

Lore-id: pr-4603-state-protection
Constraint: preserve Veritas-7's substantive commit attribution
Constraint: no new protected prefixes beyond .gjc/state/
Confidence: high
Scope-risk: narrow
Reversibility: straightforward
Tested: bun test team-runtime.test.ts -t "protects worker runtime state"; -t "checkpoint classification excludes"
Not-tested: full stalled-worker continuation suite (pre-existing native-addon env failure on clean dev)

---------

Co-authored-by: Veritas-7 <koreacmc.kr@gmail.com>
Co-authored-by: Yeachan Heo <yeachan.heo@gmail.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

Development

Successfully merging this pull request may close these issues.

3 participants