Skip to content

fix(ce-compound,ce-sessions): handle non-git CWD in pre-resolved git branch#731

Merged
tmchow merged 2 commits intomainfrom
tmchow/issue-730-check
May 1, 2026
Merged

fix(ce-compound,ce-sessions): handle non-git CWD in pre-resolved git branch#731
tmchow merged 2 commits intomainfrom
tmchow/issue-730-check

Conversation

@tmchow
Copy link
Copy Markdown
Collaborator

@tmchow tmchow commented May 1, 2026

Summary

Test plan

  • bun test tests/skill-shell-safety.test.ts — 81 pass, the new per-skill check fails on the unfixed lines and passes after the fix
  • bun test — full suite (1045 tests) passes
  • bun run release:validate — clean
  • Manual: cd /tmp && bash -c 'git rev-parse --abbrev-ref HEAD 2>/dev/null || true'; echo \$? → exit 0
  • Smoke test in a fresh non-git directory: /ce-compound and /ce-sessions load without "Shell command failed for pattern"

Fixes #730

🤖 Generated with Claude Code

…branch

`git rev-parse --abbrev-ref HEAD 2>/dev/null` exits 128 outside a git repo;
`2>/dev/null` suppresses stderr but the non-zero exit propagates and Claude
Code reports "Shell command failed for pattern", aborting skill load.

Pair the suppression with `|| true` so the line resolves to an empty value
that the existing SKILL.md prose already handles ("if they... are empty,
omit them from the dispatch and let the agent derive them at runtime").

Also fixes the same bug class in ce-work-beta's codex availability probe
(`command -v codex 2>/dev/null` exits 1 on machines without codex).

Adds a `hasUnguardedErrorSuppression` check to `tests/skill-shell-safety.test.ts`
that flags any pre-resolution command whose trailing top-level statement uses
`2>/dev/null` without an `||` fallback. The check ignores non-trailing
suppressions where a later always-succeeding statement (e.g., a final `echo`)
ensures exit 0.

Distinct from #722 / PR #723, which fixed a different line on the same files
(the "Repo name" pipe triggering "multiple operations requiring approval").

Fixes #730

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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: b9dcff129a

ℹ️ 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
- Treat top-level `||` as a separator in `hasUnguardedErrorSuppression` so
  forms like `probe || git rev-parse 2>/dev/null` are flagged. The earlier
  `||` belongs to the previous statement and does not protect the trailing
  unguarded `2>/dev/null`. Added regression test for the pattern.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@tmchow tmchow merged commit 5e04534 into main May 1, 2026
2 checks passed
@github-actions github-actions Bot mentioned this pull request May 1, 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.

[compound-engineering] Bug: ce-compound and ce-sessions fail with "Shell command failed for pattern" outside git repos

1 participant