Skip to content

🤖 fix: hook settings revalidate, share one timeout, and cap the payload - #6496

Merged
ThomasK33 merged 6 commits into
mainfrom
fix/mcp-hook-settings-races
Oct 14, 2026
Merged

ThomasK33 merged 6 commits into
mainfrom
fix/mcp-hook-settings-races

Conversation

@ThomasK33

@ThomasK33 ThomasK33 commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Summary

Plugin hooks get settings from their own plugin's MCP servers. This PR fixes five review follow-ups in that path. A hook no longer gets values from a server that an override change is about to disable. A hook no longer gets {} when a save cached newer values. One dispatch waits about one settings timeout, not one per plugin. Large settings payloads are omitted with a flag.

Refs #6186. Items fixed here:

  1. Hook settings during a pending enablement repair (PRRT_kwDOPxxmWM6rPP0t)
  2. Settings waits across plugins (PRRT_kwDOPxxmWM6rPkK5)
  3. Failed hook read ignores a newer cache (PRRT_kwDOPxxmWM6rPkK8)
  4. Bound the hook settings payload (PRRT_kwDOPxxmWM6rPkK9)
  5. Revalidate cached siblings after awaiting misses (PRRT_kwDOPxxmWM6rv4Hq)

Implementation

MCPServerManager.getSettingsForPluginHooks:

  • It waits for a pending repairEnablement, bounded by the hook timeout. On timeout the hook gets no settings. The manager remembers a repair that outlasted one wait, so later hooks fail closed at once instead of waiting again.
  • After a repair wait, the hook gets cached values only. The next hook call reads the misses with the full timeout. No read starts with a partial budget, because a failed read stays memoized for the server instance.
  • A server gives settings only while it is current: the same running instance, enabled, with no override invalidation and no pending repair. This is the same rule as canCallToolForPluginHook. The manager checks it before the reads and again for every collected server after Promise.all, cached servers included.
  • After the reads, each server's value is the current cache first, then the read result, then {}. A save that settled during a failed read now wins.

AgentPluginHookService:

  • The spine runs plugin middleware serially. Before a plugin awaits its own settings, the service now starts the settings reads of every sibling plugin whose hook would run: same hook point, and on a tool hook, a grant for that tool. The siblings' own calls later join the manager's in-flight reads, so the dispatch waits about one timeout.
  • Hook input omits settings above 64 KiB of JSON. The hook gets settings: {} and settingsOmitted: true, like resultOmitted for large tool results. The service logs a warning.

Risks

Low. The change is limited to the hook settings path. Two behavior changes:

  1. While a workspace has an override invalidation marker, hooks get no settings until the next serve or publication clears it. Hook tool calls already fail closed in that state.
  2. A hook that waited on a repair gets cached values only, so an uncached server shows {} for that one call.

Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high • Cost: $1.44

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-14T14:39:37.313284Z fc425e1 New commits
🔒 Security Review ✅ Completed 2026-10-14T14:39:27.816599Z fc425e1 New commits
ℹ️ 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.

@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: e40c179ea3

ℹ️ 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 src/node/services/agentPlugins/hookService.ts
Comment thread src/node/services/mcpServerManager.ts Outdated
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Round 1 findings addressed: one deadline for the repair wait and reads, and no repeated waits on a stuck repair.

@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: f8aad28d8b

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: f8aad28d8b

ℹ️ 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 src/node/services/agentPlugins/hookService.ts Outdated
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Round 2 finding addressed: the sibling prefetch now honors tool grants.

@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: d86cd1d52b

ℹ️ 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 src/node/services/mcpServerManager.ts Outdated
@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: d86cd1d52b

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

Round 3 finding addressed: no settings read starts with a partial budget after a repair wait.

@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: cdb9d0c55b

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

The last code review of cdb9d0c finished without findings but left no verdict. Please confirm.

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: cdb9d0c55b

ℹ️ 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: cdb9d0c55b

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
ThomasK33 added this pull request to the merge queue Oct 14, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 14, 2026

@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: fc425e1922

ℹ️ 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 src/node/services/agentPlugins/hookService.ts
@ThomasK33
ThomasK33 added this pull request to the merge queue Oct 14, 2026
Merged via the queue into main with commit b8106bb Oct 14, 2026
62 of 65 checks passed
@ThomasK33
ThomasK33 deleted the fix/mcp-hook-settings-races branch October 14, 2026 15:40
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