Repository navigation
fix(statusline): link PRs from tool.call so cc-plugin-sec-default can't skip it - #16
Merged
Merged
Conversation
…'t skip it On Team and Enterprise plans Claude Code's built-in cc-plugin-sec-default seats itself in the outermost (prepend) tier and answers every classic.* event with next.to(e, "append"), skipping the user tier where installed mods sit. The mod's classic.PostToolUse hook therefore never ran there, and PRs opened with gh pr create were never linked to the session. Read the Bash call from a tool.call hook instead, which sec-default does not hook. Only successful, unrefused calls count, as PostToolUse did, and the session id now comes from $.session.id(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W1cER89rF43oNjGycbv9WL
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Contributor
Author
|
/claude review |
Contributor
Author
|
@claude review |
|
Claude finished @AnnatarHe's task in 19s —— View job Review of PR #16Verdict: looks good, no blocking issues. I read the full diff and checked that What I checked
Minor, optional
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On Team and Enterprise plans, Claude Code reports:
cc-plugin-sec-default(sec-default@builtin) is built into the Claude Code binary. It puts itself in the outermostprependtier on Team/Enterprise orgs and on machines with managed settings. Its hooks module answers everyclassic.*event withnext.to(e, "append"), which skips the wholeusertier, where installed mods sit. A user plugin can't get around this:next.tonever lets a lower tier skip a higher one, and only managed settings (prependPlugins) can reorder plugins.So the mod's
classic.PostToolUsehook never ran. PRs opened withgh pr createwere never linked to the session, and the GitHub App never posted a cost comment. The statusline itself was not affected.Fix
hooks/register.tsx: PR linking moves to atool.callhook on{ tool: 'Bash' }, which sec-default doesn't hook.next(e)and readse.commandandran.result.stdout.PostToolUse, which never fired on a failed call.$.session.id().hooks/pullRequests.ts:createdPullRequestUrls(command, stdout). The matcher already limits it to Bash, so the tool-name check and loose field reads are gone.hooks/pullRequests.test.ts: the tests now drive$.tool.callwith a Bash stub beneath. New cases check that the Bash result reaches the model unchanged, and that a failed or refusedgh pr createlinks nothing.gitruns from the statusline refresh are left out of the recorded runs.PostToolUse.Testing
claude plugin test plugins/shelltime-statusline: 34 pass, 0 fail.claude plugin validate --strict plugins/shelltime-statuslineandclaude plugin validate --strict .: pass. The report liststool.call{tool=Bash}and noclassic.PostToolUse.tscagainst the engine's 2.1.306 API types: clean for the changed files. The one error left is insessionEnd.test.ts(anhttp.fetchstub typedunknown), which this PR doesn't touch.pnpm typecheck/pnpm testwere not run locally because the container's pnpm is a placeholder binary. The UI specs and stories don't import the changed files, and CI'suijob runs them.Generated by Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.