Skip to content

Advance .agents/shared to the worktree-aware shared scripts - #6

Closed
alexander-yevsyukov wants to merge 1 commit into
masterfrom
advance-shared-agents-pin
Closed

alexander-yevsyukov wants to merge 1 commit into
masterfrom
advance-shared-agents-pin

Conversation

@alexander-yevsyukov

Copy link
Copy Markdown
Contributor

Problem

The committed .agents/shared pin predates d0abf64 ("Make the shared hook scripts worktree-aware"), so any checkout materialized from that pin — a fresh git worktree add, a CI checkout, a cloud session — gets hook gates that read no cwd from the hook payload.

Those older gates resolve the repository with git rev-parse --show-toplevel. The hook process runs in $CLAUDE_PROJECT_DIR, which is the main checkout by design, so in a worktree session they evaluate a different checkout on a different branch than the session is actually working in.

This is not theoretical. A compiler worktree session had ./gradlew build blocked by publish-version-gate.sh reporting version numbers that belonged to the main checkout's unrelated branch, while the worktree itself was correctly bumped. The defect fails open just as silently in the other direction: it would clear an unbumped branch for publishing because some other checkout happened to be bumped.

An audit across the constellation on 2026-10-16 found all 19 consumer repositories carrying a .agents/shared pin below d0abf64, dating from June to 1 October.

Change

Advances the pin to 85668a8, the current origin/master of SpineEventEngine/agents, which carries scripts/session-work-tree.sh and the cwd-aware gates. Exactly one gitlink changes; nothing else is bundled.

Verification

Feeding the gate a synthetic PreToolUse payload (CLAUDE_PROJECT_DIR = main checkout, cwd = a worktree of it) now evaluates the worktree rather than the main checkout:

  • compiler — main checkout on an unrelated branch at 2.0.0-SNAPSHOT.071, cwd a worktree at .073: the gate reports .073 against master's .073, i.e. the worktree's own numbers.
  • core-jvm — main checkout at .570, cwd a worktree at .572: allowed, exit 0.
  • Negative control — an unresolvable cwd: exit 2, "cannot resolve the Git work tree", refusing rather than gating another checkout.

Related

SpineEventEngine/agents#48 hardens the gate's no-cwd fallback so it refuses to gate an unconfirmed checkout instead of silently gating the wrong one. That is defence in depth inside the shared repository and does not fix stale pins: a consumer pinned below d0abf64 never reaches that code path. Only moving the pin does, so the two changes are independent.

🤖 Generated with Claude Code

The committed pin predates `d0abf64` ("Make the shared hook scripts
worktree-aware"), so any checkout materialized from it — a fresh
`git worktree add`, a CI checkout, a cloud session — gets hook gates that
read no `cwd` from the hook payload. Those older gates resolve the
repository with `git rev-parse --show-toplevel`, and the hook process runs
in `$CLAUDE_PROJECT_DIR` (the main checkout, by design), so they evaluate
a different checkout on a different branch than the session is actually
working in.

This is not theoretical: a `compiler` worktree session had `./gradlew
build` blocked by `publish-version-gate.sh` reporting version numbers that
belonged to the main checkout's unrelated branch. The same defect would
let an unbumped branch through just as silently.

Moves the pin to `85668a8`, the current `origin/master` of
SpineEventEngine/agents, which carries `session-work-tree.sh` and the
`cwd`-aware gates.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 16, 2026 21:15
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-16T21:17:20.114665Z 495c4f4 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The supplied review context contains no reviewable diff to independently verify the pin update.

No open issues 🎉

What changed in this PR

Updates the shared tooling pin so hook gates evaluate the session’s worktree rather than the main checkout.

Changes:

  • Advances .agents/shared to 85668a8, which includes worktree-aware hook scripts.
File Description

Review effort: Balanced

@alexander-yevsyukov

Copy link
Copy Markdown
Contributor Author

Closing unmerged: the .agents/shared references will be updated during a next cascade wave in summit instead.

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.

2 participants