Skip to content

🤖 feat: Cursor plugin hooks: trust, file review and runner - #7846

Merged
ThomasK33 merged 50 commits into
cursor-plugins/marketplacefrom
cursor-plugins/hooks
Oct 31, 2026
Merged

ThomasK33 merged 50 commits into
cursor-plugins/marketplacefrom
cursor-plugins/hooks

Conversation

@ThomasK33

@ThomasK33 ThomasK33 commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Summary

Cursor plugins can now run their stop, afterAgentResponse and afterFileEdit command hooks in local and worktree workspaces. A hook runs only after the user trusts its exact hooks.json entry in Settings → Plugins. The consent boundary for the files a hook runs is a new file review: the install preview lists every plugin file, and an update lists every changed file and does not apply until the user approves it. A stop hook's followup_message continues the turn under the per-hook limits of PR 7.

Background

ThomasK33 asked for the Cursor plugin RFC as a reviewed, mergeable PR stack. This is PR 8 of that RFC: rfc/20261030_cursor-plugin-support.md, "PR 8: Cursor hooks: parse, trust, update review and runner (security review)". Section 5 (Hooks) is its contract, with decisions D1, D5–D7, D25, D28 and D30.

This PR is stacked on #7844 (PR 2, the Cursor marketplace and the cursor-plugin install method). Before this PR, Xum listed a Cursor package's hooks as "not applied". Cursor plugins such as ralph-loop need a stop hook to loop a turn (CUJ 3).

Implementation

  • Parse (cursorHooks.ts). Discovery reads the hooks source the Cursor manifest names (a path inside the plugin folder, default hooks/hooks.json, or an inline object). Each entry becomes an AgentPluginHookSchema hook with a cursor-command handler, or cursor-prompt for type: "prompt". key, hash and declared follow RFC 5.1. A hook that does not run (a prompt hook, an unmapped event, a matcher) gets a notApplied row with one reason, and so does an entry the parser drops (at most 50 such rows).
  • Trust. Trust is per hash of the event, the matcher and the raw entry, unknown fields included. The hooks panel shows declared with control characters marked, and Trust waits until a cut definition is expanded. A hook that does not run cannot be trusted.
  • File review (D30, installService.ts, treeHash.ts). The install preview gains fileChanges, one row per file or symlink of the plugin tree. An update's review lists each changed file with its before and after text. Any row blocks an update without consent. Only plugins with a runnable Cursor command hook get rows. While no Cursor command hook of a plugin is trusted, the hooks panel shows the same review of every file, and the first trust needs a digest of those rows (a plugin installed by a build without the file review never showed its files).
  • Runner (cursorHookRunner.ts). It registers on turn.stop (afterAgentResponse, then stop) and on tool.execute after the edit tools (afterFileEdit). Every call checks the start conditions again (see Security decisions) and runs the command through runtime.exec.
  • Cancellation. The turn.stop context gains an abort signal through eventSpine.ts, promptHooks.ts and agentSession.ts. A user Stop aborts running hooks, and a Stop before the chain starts gives it an aborted signal. LocalBaseRuntime.exec checks the abort again after its working-folder check.
  • Wiring (requestHooks.ts, codexHookService.ts). The hook service registers Cursor hooks next to Codex hooks, with its own gate: a Cursor command hook needs no plugin MCP, so a local workspace with several projects runs it. There, workspace_roots lists each project's folder in the workspace container.

Security decisions

  1. Trust: per hash of the event, the matcher and the raw entry (unknown fields included). An edit to the entry drops trust and the panel shows the hook as changed.
  2. File review rows: every file at install, and again at the first trust of a Cursor command hook while no hook of the plugin is trusted (no new persisted field: that is the trigger). At update, every changed file, or every file when the installed plugin had no runnable hook. A row has no component field, so any row blocks an update without consent.
  3. File review reads: each file is read once, without following symlinks, and the shown text is the hashed bytes. A symlink shows only its link text, and a row names a symlink and a file's mode change. The first-trust digest covers each entry's content hash, so a hidden file that changes after the review voids it. A file over 64 KiB or not UTF-8 says "contents not shown: binary or larger than 64 KiB". The review keeps the staged-tree quota and the size cap, and stops with the existing "too large" message once its kept text passes 3 MB per tree.
  4. Marked text: file names, link targets, hook events, matchers, the hooks file path, warnings (hooks panel, install preview and update review) and the command in the exit 127 notice go through showOneLineControls, so a bidi or newline character shows as <U+XXXX>.
  5. Checked on every call, after the plugin reads: the three kill switches (XUM_DISABLE_AGENT_TOOLS, XUM_DISABLE_TERMINALS, XUM_DISABLE_PROJECT_AUTOMATION), a local runtime (registration only for local and worktree workspaces, never in a /side chat), project trust, hash trust, a fresh reread of the plugin's own hooks, input up to 64 × 1024 characters, and no user Stop.
  6. Process: the minimal host environment plus the Cursor variables, PATH and HOME. Xum never sets CURSOR_USER_EMAIL or CURSOR_CODE_REMOTE, and runs the command as written. The timeout is at most 30 s. Stdout is capped at 64 KiB, stderr is discarded, and both pipes are read while the hook runs. A call ends at its timeout plus 2 s even when a process that left its group holds stdout open, and it then lets go of the hook's three pipes.
  7. Failures: no failure blocks anything. A failure shows one chat notice per workspace and hook. failClosed is parsed and hashed only. An unreadable trust store skips the call with a notice. Codex hooks keep their old silent behavior.
  8. Trust names the reviewed commit: a Cursor command hook's trust records reviewedSha, the installed commit when the user trusted it. An update this build applies (it reviewed the changed files) moves the binding to the new commit. A binding that does not match the registry's lockedSha is dropped, and a trusted Cursor command hook without a binding reads as "changed": it does not run, and the hooks panel shows the full file review again. This covers an update that a build without this PR applied after a downgrade. reviewedSha is a new optional field of the trust record. No other record tells this build that an older build changed the plugin.
  9. Accepted risks (RFC D1): a script edited on disk outside an update runs unreviewed. A plugin installed before this PR never got the first file review.

Deviations from the RFC

  1. A cursor-prompt handler variant sits beside cursor-command, so a prompt hook also carries declared and shows its Cursor reason.
  2. One function, cursorHookNotAppliedReason (src/constants/pluginHooks.ts), gives the reason to the loader and to the panel. No schema field was added for it.
  3. Discovery parses Cursor hooks through its own file reader into AgentPluginInfo.cursorHooks. A new loadPluginHooks picks the Cursor or the Codex loader by plugin format. The hash and the per-plugin caps moved to a new hookDefinition.ts to avoid an import cycle.
  4. The Cursor hook gate is separate from the Codex one (see Implementation). The Cursor runtime comes from createRuntimeForWorkspace for local and worktree workspaces.
  5. The file review skips only the top-level .git, as the staged-tree quota check does.
  6. Three guards the RFC does not ask for: the timeout + 2 s pipe deadline, a throw in the trust check or the spawn becomes one failed call with a notice, and the 3 MB kept-text limit of the file review.
  7. FakeRuntime gained an optional location. Two PR 1 tests changed, because inline hooks and hooks/hooks.json no longer get the "runs in a later Xum build" row.
  8. The chat notice reads "Plugin : hook stop failed …". The leading "Plugin " comes from the existing shared notice code.

Validation

  • An independent security verifier checked three heads and found each clean: 4ca374abcb (82 mutants, the real install, update and trust path in-process, a live dev server), 5eb136a80e after the first marketplace merge, and 4022057c13 with the first-trust file review. Its findings F1, F3, F3b, F5 (the downgrade gap, fixed after Codex raised it too) and the test gaps F4 and F6 (X3, X4) are fixed in this PR. The rest are listed under Follow-ups.
  • Each guard added after the first review has a test that fails with the guard removed. These include the exit 127 command marking, the side-chat flag, the 64 KiB check on valid JSON, the runnable filter, the warning marks, the first-trust digest, and the "trusted" and current-hook halves of the first-trust trigger.
  • Live proof on a dev-server sandbox: the install preview with deceptive file names, the hooks panel, the exit 127 notice once per hook, and the update review. The stop-loop repro tests/bugbash/repros/cursorStopHookLoop.e2e.ts passes 4/4 with BUGBASH_AI=mock, and it trusts its hooks through the first-trust UI.
  • The bug-bash sandbox image now installs jq, which the ralph-loop plugin's hooks run, so the stop-loop repro also runs in Test / Bug-bash sandbox.
  • At a 390 px viewport, the hooks panel (a 300-character command, a 2 KB declared entry, the Files list), the install preview and the update review show no horizontal overflow. This PR adds no Storybook snapshots.

Risks

  • Severity high if wrong, scope narrow: this is the first plugin code that runs shell commands on the host. Every start condition is checked per call, and each has a test. Codex hooks keep their behavior, except that the hook service now registers even without plugin MCP; the Codex gate still requires it.
  • The file review runs for every install and update preview of a plugin with a runnable Cursor command hook. A large plugin can hit the 3 MB limit and get the existing "too large" error.

Release note

Cursor plugins: Xum runs stop, afterAgentResponse and afterFileEdit command hooks in local and worktree workspaces after you trust each hook in Settings → Plugins, and reviews every plugin file at install (and at the first trust of a plugin's hooks) and every changed file at update. This PR has no row in RFC section 8: nothing changes for users without a Cursor plugin.

Follow-ups

  • F2: a Stop does not shorten the wait for a hook child that left its process group (at most timeout + 2 s).
  • Update recovery and trust: when Xum crashes during an update and journal recovery finishes it, the registry gets the new commit but the trust binding does not move. The trusted Cursor hooks then read "changed" and need the file review again. This fails closed.
  • Unreadable trust store at registration: when the trust file cannot be read at workspace hook setup, no Cursor hook registers and none runs (fail closed), but the user gets no notice. The fix reads the store with readPluginHookTrustChecked during registration and shows one notice.
  • Revoke during exec: the hook gate decides trust after its last await, but runtime.exec then awaits its working-folder check before the spawn. A trust revoke in that window still starts the process. Closing it needs a trust generation the runtime checks before the spawn.
  • Codex Stop hooks and the Stop signal: the turn.stop abort signal stops Cursor command hooks (RFC 5.4). Codex Stop hooks still run their MCP calls to the end after a user Stop, as before this PR. Passing the signal into them changes Codex hook behavior, so it is a separate change.
  • F6 X8: no test fails when the first-trust review skips assertReviewFits (the size cap). The cap is in the code.
  • "Show full text" is enforced only in the renderer. The server checks the digest of the rows it returned, not that the user expanded each cut text.
  • Test gaps the verifier listed (each guard is present in the code): the F1 label when only the old side is hidden, the tree-walk race guards, the mode comparison, link-text marking, event and matcher marking, the unreadable-store notice, the reread failure and the # path refusal.

Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: xhigh • Cost: $91.77

Cursor plugin RFC PR 8, first unit: Cursor hooks.json parsing in discovery
(cursorHooks.ts), the cursor-command/cursor-prompt handler variants, the
per-call trust gate in the plugin's own format, the Cursor command hook
runner (cursorHookRunner.ts) with its own gate, the turn.stop abort signal,
and the LocalBaseRuntime abort race fix. The file review and the renderer
follow in later commits.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh -->
Cursor plugin RFC PR 8.7: cursorHooks.test.ts (ralph-loop and advisor
hooks.json, hashes, loop_limit and declared, reasons, containment and caps),
cursorHookRunner.test.ts (input, environment, working folder, afterFileEdit,
stop output, failure table, kill switches, remote runtimes, trust, abort at
three points with the local runtime, timeouts and full pipes), the Cursor
gate in codexHookService.test.ts, and the turn.stop abort signal in
agentSession.turnStopHooks.test.ts. Formats cursorManifest.ts and
discovery.ts.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh -->
…preview

The user trusts a Cursor hook by the hash of its exact hooks.json entry, so the
review must show every hashed field and say in Cursor terms why a hook does not
run (Cursor plugin RFC 5.1 "Trust display" and "Status", 5.6, 8.6).

- hookStatusNote(hook): a Cursor hook names its own reason
  (cursorHookNotAppliedReason), never the Codex note "Xum runs only mcp_tool
  hooks". The hooks panel and the install preview hook list share it.
- hookReviewDetail(handler): the panel shows a Cursor entry as declared, with
  invisible and bidi controls marked, cut like an mcp_tool input; Trust waits
  until a cut entry is expanded.
- Event, matcher and command summary mark every control
  (showOneLineControls), so a tab or newline cannot make two hashes look alike.
- Each Cursor hook notes it does not run in remote workspaces; a cursor-command
  hook that is not trusted says it runs a command in your workspace.
- Stories: CursorHooksReview and its 390 px phone variant.
The Cursor entry display grew PluginHooksPanel past its CRAP floor (CC 34 -> 37).
HookReviewDetailText renders a hook's hashed text and its "Show full" control,
so the panel is back to CC 34.
The CRAP gate refused the first cut: the entry parser, the start gate, the
exit-code table and the stop output each become their own function, the
hook service's trust filter and per-format registration move out of
ensureWorkspaceHooks, and the two exec abort checks and the hard-Stop hook
abort get named helpers, so no touched function grows.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh -->
…rsor-plugins/hooks

# Conflicts:
#	src/node/services/agentPlugins/discovery.ts
---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh -->
…n throws

A process that leaves the hook's process group (job control, setsid) can
hold stdout open after the hook exits, which held the turn.stop chain. The
call now ends at its timeout plus a short grace, as a failure. A throw from
the trust gate or the spawn is a failed call with a notice, never a broken
hook point.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh -->
Add ralph-loop-cursor to the bug-bash hook fixtures: cursor/plugins
ralph-loop at 4dd1d05 (plugin.json, hooks.json, both hook scripts, the
ralph-loop and cancel-ralph skills), checked against each file's git
blob SHA, with only the two hook commands changed to
`bash "${CURSOR_PLUGIN_ROOT}/hooks/<script>.sh"` (D17). The seed installs
it like the other hook fixtures.

Add repros/cursorStopHookLoop.e2e.ts (bugbash, cursor-stop-loop,
mock-only): after the user trusts both hooks, the stop hook continues
the turn twice and stops once the reply holds <promise>DONE</promise>.
A Stop during a continued turn adds no continuation and leaves the loop
active, and cancel-ralph ends it. The mock runs no tool, so the test
writes and deletes the ralph state file itself, as the skills say.

The repro needs the cursor-plugin install method (RFC PR 2): on this
base a Cursor package installs as Skills and its hooks do not load.
listPluginTreeRecords returns one record per file, symlink and directory of a
plugin tree: the path relative to the plugin folder (forward slashes), the
mode, and the content hash or link text. A file of at most keepBytesUpTo bytes
keeps the bytes that the hashing read returned, so a review shows the hashed
bytes without a second open. skipRootGit skips a staged clone's top-level .git
before the quota counts it. hashPluginTree is now a wrapper over the same walk
and keeps its value on every folder (checked against the old implementation).
A Cursor command hook can run or source any file of its plugin, so a staged
plugin with a runnable cursor-command hook gets a review of its files (RFC
D1, D30). The install preview lists every staged file as added in
fileChanges. The update review appends a row per added, removed or changed
file to changes, against the installed tree when that tree also has a
runnable Cursor command hook, else against the empty tree. A UTF-8 text file
of at most 64 KiB shows its text with invisible controls marked, a symlink
shows its link text, any other file shows only the summary. File names pass
through showOneLineControls. assertReviewFits covers the rows at install and
at update.
PreviewDisclosures lists preview.fileChanges under "Files (n)" with the
update review's row component, and says that a command hook of the plugin
can run any of these files. Install stays disabled until the user shows the
full text of every row text cut at the display bound, as the update review
gates Confirm. The cut-text helpers now take a change list instead of a
whole update review. The phone consent preview story gets file rows.
The CRAP gate refused the new walk (CC 26), fileReviewRows (CC 11) and the
growth of collectCapabilityChanges (CC 38 -> 41). The walk now hashes each
file in hashWalkedFile, and a stat-field table replaces the two comparison
chains. One method, fileReviewChanges, decides the rows for the install
preview and the update review, so collectCapabilityChanges keeps its CC.
fileReviewRow builds one row. hashPluginTree still gives the old value on
every folder the comparison script checked.
…view

hashPluginTree and the file review compared the same "hash, link text or
empty" value through two copies of one expression. treeHash.ts now exports
pluginTreeRecordContent and both use it.
A review whose kept text could never fit its size cap now fails while the
walk runs, before it holds up to the staged-tree quota in memory (it was
up to 100 MB per tree, two trees per update). The tree walk becomes a small
class so no function passes the CRAP limit; hashPluginTree gives the same
value as before on three folders (checked against the old code).

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh -->
---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh -->
Delete comments that restate code, narrate, or name review history in the
Cursor command hooks diff. Comment-only change.
…iew references

Codex and Cursor hook runners share PLUGIN_HOOK_ORDER_BASE instead of two
equal constants. claimKeptBytes names what the walk's byte check does. The
hook service keeps its module overview and the review-thread references of
the comments this change moved.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh -->
… unreviewed

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh -->
…remote note

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh -->
…ctory

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh -->
… cursor-plugins/hooks

# Conflicts:
#	src/browser/features/Settings/Sections/PluginsSettingsSection.tsx
#	src/node/services/agentPlugins/installService.ts
…fields

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh -->
Security verifier finding F1: a binary file or one over 64 KiB showed only
its summary, which read like a harmless change. Its row now says
"contents not shown: binary or larger than 64 KiB", in the install preview
and the update review.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh -->
…27 command

Security verifier finding F3: the hooks panel showed the hooks file path and
the hook warnings as plugin text, and the exit 127 notice quoted the command,
all with control characters unmarked. A bidi override there could reorder the
text the user reads. Each now goes through showOneLineControls, the helper the
file review summaries use, so such a character shows as <U+XXXX>.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh -->
…hat is not runnable

Security verifier finding F4, test-only. Three guards had no test that fails
without them:
- requestHooks passes `sideChat: true` for a side chat, so no Cursor command
  hook runs beside the main chat's work.
- stdout over 64 KiB is refused by its size even when it is valid JSON with a
  followup_message (one byte over: the runner reads a few bytes past the limit).
- a hook the trust gate allows but whose status is not runnable (a matcher)
  starts no process.
Each test fails with its guard removed.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh -->
PR 9 (cursor-plugins/docs, 433e6dc) adds the same two preview fields to
this fixture, with notApplied after codexHooks. The same placement here lets
that branch merge this one without a conflict in the file.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh -->
Delta verifier finding F3b: the install preview showed its warnings raw, and
the Cursor hook warnings there quote plugin text such as an event name. A bidi
override in the name could reorder the warning. The preview now marks it with
showOneLineControls, as the hooks panel does.

Tests: a hook warning with U+202E shows <U+202E> in the install preview, and
the hooks panel marks it in the hooks file path and in a warning. Each test
fails with its mark removed.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh -->
Codex review of the RFC, P2: a hook that the parser drops (a negative,
fractional or non-number loop_limit, no command string, an entry that is not
an object, an event that is not an array) only got a warning, so the plugin's
"Not applied in Xum" list did not name it (CUJ 5). Each now gets a hook row
with its parse reason. The rows stop at 50, as the warnings do, because a
256 KiB file can hold thousands of bad entries. The display marks control
characters in the names, as for every not-applied row.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh -->
The digest check raised setHookTrust from CC 5 to 11 against the PR base,
which the CRAP gate refuses above 10. assertFilesReviewed holds it now; the
checks and their messages are unchanged.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh -->
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

Head: 632b6d0

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 632b6d00ab

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Head 632b6d0 addresses every round 1 thread (each has a reply). The security receipt for this head is clean.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 632b6d00ab

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

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 632b6d00ab

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Codex review of #7846, head 632b6d0, P2 (PRRT_kwDOPxxmWM6yTwSs): when a
hook's child leaves the process group and keeps stdout open, the call ended
at its grace deadline but its stream readers kept reading until the child
exited, so repeated hook events could pile up readers and pipe handles. The
runner now reads both pipes through a stream it cancels when the grace
deadline wins. Xum still cannot kill a process outside the group; the test
checks that the call cancels the pipe.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh -->
Self-review of bc7b469: rebindPluginHookTrust wrote the trust record
after every update, so each updated plugin, Codex and Claude ones included,
got an empty plugin-hook-trust file. The edit now reports whether it moved
a binding, and nothing is written when it did not.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh -->
…review digest

Pre-push review of c5089e5 and 1447278:
- A process past its output grace that never reads a full stdin pipe kept
  the input write pending. The release now aborts the stdin writer as well.
- The first-trust digest hashed directory records, which the review does not
  show: a directory's mode change refused the trust with "files changed"
  and then showed the same rows. The digest now skips directories, as the
  rows do.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh -->
The test set the skills folder to 0700, which can already be its mode, so it
passed with the digest's directory filter removed. It now flips the mode,
and it fails without the filter.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh -->
lint-eslint (no-misused-promises): the abort listener returned the
writer.abort() promise. It now drops it explicitly; nothing waits on it.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh -->

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8fa9bad2df

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

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

Head: 8fa9bad

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 8fa9bad2df

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8fa9bad2df

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

…roject workspace

Codex review of #7846, head 8fa9bad, P2 (PRRT_kwDOPxxmWM6yUAPK): a local
multi-project workspace runs in its container, so workspace_roots held only
the container folder. Cursor defines it as the list of root folders, one per
project. requestHooks now passes a callback that names each project's folder
in the container (ContainerManager links each project under its name), read
again on each call so a project added mid-session counts. A single-project
workspace still sends the call's folder.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh -->
The workspace_roots fallback raised startAndRead to CC 9, above the CRAP
gate's new-function limit of 8. workspaceRootsOf holds it; the input is
unchanged.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh -->
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

Head: 0e7dcdb

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 0e7dcdb919

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

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 0e7dcdb919

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

…hout a sandbox

Codex review of #7846, P1 (PRRT_kwDOPxxmWM6yUCPZ): the prompt said the hook
runs "in your workspace". The process runs as the user with HOME, and
afterAgentResponse and afterFileEdit run in the plugin folder. It now says:
"Once trusted, this hook runs a shell command on this computer as you,
without a sandbox. It can read and change any file you can."

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh -->
Codex review of #7846, P1 (PRRT_kwDOPxxmWM6yUCPa): the gate checked project
trust and the hook's trust, then awaited the plugin's rediscovery, so a
revoke during those reads still let the hook start. The gate now reads the
plugin first and decides trust last: the trust-store read is its last
await, and project trust is checked after it. Tests revoke project trust
or turn the hook off while the gate's rediscovery runs; both fail with the
old order.

Known gap, a follow-up in the PR description: runtime.exec awaits its folder
check before the spawn, so a revoke in that window still starts the process.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh -->

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e829acee95

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

@ThomasK33

Copy link
Copy Markdown
Member Author

The automated review loop on this PR stops here, at head e829acee95. 10 review rounds are used (5 heads, a code review and a security review each). The last rounds kept finding new items in the same area, hook trust, so per the repo's early-stop rule for a loop that does not converge, no more fixes are pushed and no more reviews are requested. The operator decides on any further round.

Fixed during the loop

  • Trust is bound to the reviewed commit (reviewedSha): an update applied by a build without this PR no longer keeps a hook's trust.
  • The first-trust file review digest covers each file's content hash. Rows name symlinks and mode changes.
  • A session shutdown aborts running turn-stop hooks. afterFileEdit reads the edit tool's own result. A hook call past its grace lets go of its pipes.
  • workspace_roots lists each project's folder in a multi-project workspace.
  • The trust prompt says the command runs on this computer as the user, without a sandbox.
  • The hook gate decides trust after its plugin reads.

Rejected, with a reply on each thread

  • No abort gap in LocalBaseRuntime.exec (no await between the last check and the listener).
  • The default loop_limit stays 3 (RFC D3) and loop_count counts the user turn's continuations (RFC D4).
  • A file edited on disk after trust runs unreviewed: an accepted RFC D1 risk (anything that can edit ~/.xum/plugins/<name> already runs as the user).

Deferred, listed under Follow-ups in the description

  • One notice for an unreadable trust store at registration (it fails closed today: no hook runs).
  • A trust revoke during runtime.exec's folder check still starts the process.
  • Codex Stop hooks do not follow the Stop signal; journal recovery after a crash mid-update leaves trusted hooks reading "changed".

Every review thread has a reply and is resolved.


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: xhigh • Cost: $91.77

@ThomasK33
ThomasK33 added this pull request to the merge queue Oct 31, 2026
Merged via the queue into main with commit 70e180e Oct 31, 2026
39 of 40 checks passed
@ThomasK33
ThomasK33 deleted the cursor-plugins/hooks branch October 31, 2026 23:09
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