Skip to content

fix(work-items): resolve the repository root in its own call - #15380

Merged
kyle-sexton merged 4 commits into
mainfrom
fix/work-items-toplevel-separate-calls
Nov 11, 2026
Merged

kyle-sexton merged 4 commits into
mainfrom
fix/work-items-toplevel-separate-calls

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

No related issue: a cross-plugin item the stage-3 skill re-audit withheld for one fix; it has no tracking issue.

Summary

Thirty-two snippet and path sites in the work-items skills embedded $(git rev-parse --show-toplevel) inside a larger command. #6929 found that a worktree-isolated session refuses that shape, and decompose and track add were already rewritten to resolve the root in a separate call. This PR gives every other site the same treatment.

Fix

  • plugins/work-items/reference/tracker-seam.md gets a new Project root section. Resolve the root in separate Bash calls (printenv CLAUDE_PROJECT_DIR, then git rev-parse --show-toplevel when that prints nothing) and spell the printed path out. The section carries the pointer record: the worktrees isolation section (anchor checked live today), as-of 2026-11-11, and a recheck trigger. The seam's own dispatcher snippet now uses the placeholder too.
  • Every site writes a literal <project root> and links that section. $CLAUDE_PROJECT_DIR still wins when it is set, as before. Sites by file:
    • attend-queue: SKILL.md (tracker fallback)
    • scan-todos: SKILL.md (git -C root)
    • setup: SKILL.md (convention-home root and the adapter path in prose), reference/capability-tier-backfill.md, reference/check.md, reference/personal-override-ignore-probes.md and reference/providers.md
    • ship: SKILL.md and actions/run.md
    • track: actions audit, done, due (2), edit, recheck (2), search, start (2) and stats
    • triage: SKILL.md
    • work: SKILL.md (2) and context/candidate-discovery.md (4)
  • Eval samples: in evals/st-no-group-selected-no-edit/samples/, seven sample answers across four files quoted the old scan-todos command. They now use a literal path. The scans-with-git-grep regex grader still matches them.
  • Patch changelog fragment for work-items.

Verification

  • git grep 'rev-parse --show-toplevel)' -- plugins/work-items/skills now finds only the pre-fix(work-items): decompose publish snippet is refused in worktree-isolated sessions #6929 recheck-trigger text in decompose and track add.
  • markdownlint-cli2 on every changed .md: 0 issues.
  • scripts/check-changelog-fragments.sh --check: valid.
  • validate-cases.py plugins/work-items/evals: no FAIL; the WARNs were already there.
  • scripts/check-changed-skills.sh: all 7 changed skills PASS. The first push hit the triage SKILL.md 500-line hard cap, and the second commit fixes that.
  • Pre-push check-affected: passed.

Related

  • #6929: the probe and the decompose/track add rewrite.
  • Not in this PR: these snippets still run the dispatcher as "$TRACKER" <verb>, where the command name is computed at runtime. The isolation page lists that as another shape it can refuse. decompose and track add call the plugin-root path directly instead. Converting every "$TRACKER" call site is a separate change.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VcupojQwC9uJAfmSt4EHZm

kyle-sexton and others added 2 commits November 11, 2026 08:36
Thirty-two snippet and path sites across attend-queue, scan-todos, setup,
ship, track, triage and work embedded `$(git rev-parse --show-toplevel)`
inside a larger command, the shape #6929 found a worktree-isolated session
refuses. decompose and track add were already rewritten to separate calls.

The shared tracker reference gains a "Project root" section: resolve
`$CLAUDE_PROJECT_DIR` (printenv) and, when unset, `git rev-parse
--show-toplevel` in their own Bash calls, then spell the printed path out.
Each site now writes a literal `<project root>` and points at that section,
keeping the CLAUDE_PROJECT_DIR-first precedence. The section carries the
worktree-isolation pointer record. The scan-todos eval samples that quoted
the old git grep command now use a literal path.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VcupojQwC9uJAfmSt4EHZm
Fold the project-root note into the paragraph after the claim snippet, so
triage/SKILL.md stays at 499 lines, under the 500-line hard cap.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VcupojQwC9uJAfmSt4EHZm
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T13:42:24.812107Z 10f9e37 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.

@github-actions

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 35b46c1e5564c3bc16a3ea23c4700f58a62e05e3: read 26 of 26 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #15380, fix(work-items): resolve the repository root in its own call

No security issues found.

I read every hunk of all 26 changed files in the full diff. None of them match a listed trusted path. The change has a few parts:

  • Skill snippets. In the work-items skill snippets and reference docs, ${CLAUDE_PROJECT_DIR:-$(git rev-parse --show-toplevel)} becomes a literal <project root> placeholder.
  • New section. plugins/work-items/reference/tracker-seam.md gets a "Project root" section that says how to resolve that placeholder.
  • Eval samples. Four eval sample files now use a fixed path.
  • Changelog. A patch changelog fragment is added.

What I checked:

  • Path resolution is unchanged. The new section still prefers $CLAUDE_PROJECT_DIR and falls back to git rev-parse --show-toplevel (tracker-seam.md#L118-L122). That is the same precedence as before. Every tracker, evaluator and backfill fallback still runs the same project-local script under the same [[ -f ... ]] guard. No new executable source, no new input and no new place a command runs.
  • Spelling the path out literally. Because the resolved path is now written inside double quotes, a directory name containing $(, backticks or " would be interpreted by the shell. I found no attacker who controls that value: CLAUDE_PROJECT_DIR is set by the host, and the work-tree root is the operator's own checkout. So this is not a finding.
  • Instruction-surface lens. No guardrail is deleted or softened. The only prose rewrite is in tracker-seam.md (the retired label protocol sentence), and it changes wording only, not what is allowed. Every claim/exit-code rule and every confirmation step ("Proceed only if the user confirms") is unchanged.
  • Plugin manifests. No plugin.json or marketplace.json changes.
  • Trust controls and merge holds. No trusted-trigger, token, kill-switch, merge-hold or Actions files are touched.
  • Embedded text. I found no directives addressed to the review in the PR context.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed 35b46c1e5564c3bc16a3ea23c4700f58a62e05e3: read 26 of 26 changed file(s); 0 finding(s), 0 as inline comments.

Code review: no findings

I read every hunk of all 26 changed files. The PR replaces each ${CLAUDE_PROJECT_DIR:-$(git rev-parse --show-toplevel)} in the work-items skill snippets and prose with a literal <project root>. That placeholder is defined in a new Project root section in plugins/work-items/reference/tracker-seam.md, which is resolved first in its own Bash calls: printenv CLAUDE_PROJECT_DIR, then git rev-parse --show-toplevel. This follows the pattern #6929 already set for decompose and track add.

What I checked:

  • Same behaviour. $CLAUDE_PROJECT_DIR still wins when it is set, and the repository root is still the fallback, so the resolved root is the same as before.
  • Links. Every relative ../../../reference/tracker-seam.md link points to plugins/work-items/reference/tracker-seam.md. That covers the files under setup/reference/, ship/actions/, track/actions/ and work/context/. The SKILL.md files use the ${CLAUDE_PLUGIN_ROOT}/reference/... form that other links in those skills already use.
  • Coverage. A grep of plugins/work-items/skills finds no $(git rev-parse --show-toplevel) left in a snippet. The only hits are the recheck-trigger text in decompose and track add, which the PR description expects.
  • Pointer record. The new section has a section-anchored docs pointer, the fix(work-items): decompose publish snippet is refused in worktree-isolated sessions #6929 probe, an as-of date and a recheck trigger.
  • Eval samples. The scans-with-git-grep grader (\bgit\b(?:[^"\\]|\\.)*\bgrep\b, case.yaml line 43) checks the tool input, where quotes are backslash-escaped. On that reading the new git -C \"/tmp/scan-todos-repo\" grep sample still matches. I worked that out by reading the regex; I did not run the grader. /tmp/scan-todos-repo is a made-up path that identifies no one, so it meets .claude/rules/eval-case-transcripts.md.
  • Changelog. The fragment has bump: patch, which fits a docs-and-snippet fix. No plugin manifest changes, so no manifest checks apply.
  • Rules and context. The path-scoped rules that match (eval-case-transcripts.md, skill-bodies-state-current-rules.md) are not broken. The PR closes no issue, so there are no acceptance criteria to check. The project's standards index has no paved-path entry.

Not covered here: the PR's own Verification section (markdownlint, the fragment check, validate-cases.py, check-changed-skills.sh, the triage 500-line cap) is the author's claim; I did not rerun any of it.

plugins/work-items/tools/work-item-tracker/seeds/linear/schema-check/README.md (L23) still has a cd "$(git rev-parse --show-toplevel)/...". It is a maintainer README outside the skills the PR targets, so I am noting it, not reporting it.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 11, 2026
Merged via the queue into main with commit 34825b2 Nov 11, 2026
46 checks passed
@kyle-sexton
kyle-sexton deleted the fix/work-items-toplevel-separate-calls branch November 11, 2026 19:39
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant