Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(skills): replace case statements blocked by permission check#701

Merged
tmchow merged 4 commits into
mainfrom
tmchow/ce-compound-case-stmt
Apr 26, 2026
Merged

fix(skills): replace case statements blocked by permission check#701
tmchow merged 4 commits into
mainfrom
tmchow/ce-compound-case-stmt

Conversation

@tmchow
Copy link
Copy Markdown
Collaborator

@tmchow tmchow commented Apr 26, 2026

/ce-compound and /ce-sessions were failing at skill-load with Error: Shell command permission check failed ... Contains case_statement. Claude Code's shell permission checker AST-rejects bash case in ! backtick pre-resolution commands. PR #699 introduced the offending block in ce-compound and ce-sessions; ce-update has carried the same shape against ${CLAUDE_SKILL_DIR} since PR #656 and would fail identically the next time /ce-update ran.

ce-compound and ce-sessions now use basename "$(dirname "$(git rev-parse --path-format=absolute --git-common-dir)")" for a worktree-stable repo name. This is the conditional-free idiom already documented in plugin AGENTS.md, with identical output in regular checkouts and worktrees. ce-update uses grep -q plus &&/|| chaining for its ${CLAUDE_SKILL_DIR} pattern match. Output is identical to the original case forms across all branches.

tests/skill-shell-safety.test.ts scans every ! block under plugins/*/skills/**/*.md and fails any new case/esac, guarding against reintroduction. The existing frontmatter.test.ts validates the YAML header but never the body of ! commands.


Compound Engineering
Claude Code

…n check

Claude Code's shell permission checker AST-rejects `case` statements in `!`
backtick pre-resolution commands with "Contains case_statement", failing the
skill at load time before its body runs. Replace with permission-clean forms:
`git rev-parse --path-format=absolute --git-common-dir` for worktree-stable
repo names in ce-compound and ce-sessions; `grep -q` with `&&`/`||` chaining
for CLAUDE_SKILL_DIR pattern matching in ce-update. Add a regression test
that fails any new `case`/`esac` block in a pre-resolution command.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e1f08cad82

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/skill-shell-safety.test.ts Outdated
Parse `!` pre-resolution blocks across the full file body so multi-line
commands are also checked. Add unit tests for single-line and multi-line
parsing. Reviewer flagged that the line-by-line extractor would miss any
`case ... esac` reintroduced inside a wrapped `!` block.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 31a6448476

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread plugins/compound-engineering/skills/ce-compound/SKILL.md Outdated
tmchow and others added 2 commits April 26, 2026 14:02
Guard the pre-resolved repo name so it stays empty when the skill is
invoked outside a git repository. The `--path-format=absolute` form
returns nothing in that case, but `basename "$(dirname "")"` produces a
literal `.` which downstream logic in ce-compound and ce-sessions would
treat as a valid repo name and pass to ce-session-historian. Capture
the output and short-circuit on empty so the empty/sentinel failure
path the SKILL.md gate already handles is preserved.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Roll the empty-fallback guard through the remaining places that share the
same `git rev-parse` shape so the fix doesn't regress through the back
door:

- ce-session-historian.agent.md: replaced the documented `case "$common"
  in /*) ... esac` runtime fallback with the empty-guarded
  `--path-format=absolute --git-common-dir` form. The agent only runs
  this when pre-resolution from the dispatch prompt is empty, but with
  the new pre-resolution guard that case now happens cleanly outside a
  repo, so the agent's runtime fallback would have hit Claude Code's
  permission denial on `case_statement` instead of producing nothing.

- AGENTS.md "Reading Config Files from Skills": replaced the unguarded
  config-reader idiom with subshell-scoped `[ -n "$top" ]` and
  `[ -n "$common" ]` checks. Outside a git repo, `dirname ""` resolves
  to `.` and the unguarded `cat "./.compound-engineering/config.local.yaml"`
  could pick up a stray file from the user's CWD; guarded, both branches
  fail and the `__NO_CONFIG__` sentinel takes over. Verified with a
  stray-file repro: old form cats the stray, new form hits the sentinel.

- ce-work-beta/SKILL.md: same idiom update as AGENTS.md, since this is
  the only current consumer of the documented pattern.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@tmchow tmchow merged commit 5952b20 into main Apr 26, 2026
2 checks passed
@github-actions github-actions Bot mentioned this pull request Apr 26, 2026
michaelvolz pushed a commit to michaelvolz/compound-engineering-plugin-windows-version that referenced this pull request Apr 28, 2026
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.

1 participant