Skip to content

feat(mcpx): prompt hooks effect: propose (#11141, #1929 Approach C slice 1) - #11155

Merged
dezren39 merged 1 commit into
mainfrom
queue/20694-11141-propose
Nov 17, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/20694-11141-propose

Conversation

@dezren39

@dezren39 dezren39 commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Closes #11141 (parent #1929, Approach C slice 1). Queue task 20694.

What

Implements the propose effect for prompt hooks at the script point, following the advise slice (#5276, PR #9021):

  • Validation (validateHooks): effect: propose accepted at onSuccess/onError only. before (nothing exists to propose against yet) and suffix (clamped to at most advise by 0001) are refused with a named reason in the existing refusal style. ask/apply/run stay refused as not implemented.
  • Frame: HookFrame gains a propose field (the proposed value, JSON). Replies are parsed as hook output objects (0001): the propose key carries the proposed replacement (any JSON value); a non-object reply is a plain-text proposal (a plan is a legitimate proposal per 0002) carried as a string value; an object naming no control keys is itself the proposal. Keys above the declared effect (apply, run) are dropped and named in the frame's dropped list — never honoured, never silent.
  • Invariant: the run's result and error are never modified by a propose hook in any phase — the proposal rides in the frame beside the original, unapplied (0002's definition of the level). runPromptHook still never touches res, and runHooks never consults applyHookResult for prompt hooks.
  • System text: propose gets its own (the reply is a proposal carried beside the original), keeping advise's data-not-instructions guard for placeholder values.
  • No provider: the frame reports the proposal as unavailable and the run continues — propose is not a gate and keeps prompt hooks' fail-soft contract.

Out of scope per the issue: ask/apply prompt effects, the run effect, script/module hook output keys, hooks.autonomy/autonomy.max ceiling work.

Tests

Oracle: a propose hook can never change the outcome — only add a frame-carried proposal beside it.

New in prompt_hooks_test.go: object reply (proposal parsed, apply/run dropped and named, result byte-identical), plain-text reply, onError beside the untouched error, validation refusals for before/suffix (+ ask still unimplemented), no-provider frame, and the runHooks path retaining the proposal on the result.

go test ./internal/execsvc/ — full package passes (including all pre-existing advise/script hook tests). gofmt clean.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…ice 1)

Implements the `propose` effect for prompt hooks at the script
point, the second #1929 Approach C prompt slice after advise
(#5276, PR #9021):

- Validation: `effect: propose` is accepted at onSuccess and
  onError only. At before (nothing exists to propose against yet)
  and suffix (clamped to at most advise by 0001) it is refused with
  a named reason, in the existing refusal style. ask/apply/run
  stay refused as not implemented.
- HookFrame gains a `propose` field (the proposed value, JSON).
  The reply is parsed as a hook output object: the `propose` key
  carries the proposed replacement (any JSON value); a reply that
  is not a JSON object is a plain-text proposal (a plan is a
  legitimate proposal per 0002) carried as a string value; an
  object naming no control keys is itself the proposal. Keys above
  the declared effect (apply, run) are dropped and named in the
  frame's `dropped` list — never honoured, never silent.
- The run's result and error are never modified by a propose hook
  in any phase: the proposal rides in the frame beside the
  original, unapplied — the whole definition of the level (0002).
- Propose gets its own system text (the reply is a proposal,
  carried beside the original), keeping advise's
  data-not-instructions guard for placeholder values.
- No provider configured: the frame reports the proposal as
  unavailable and the run continues, exactly like advise —
  propose is not a gate and keeps the fail-soft contract.

Tests (oracle: a propose hook can never change the outcome — only
add a frame-carried proposal beside it): object reply with
dropped apply/run keys, plain-text reply, onError beside the
untouched error, validation refusals for before/suffix,
no-provider frame, and the runHooks path retaining the proposal
on the result with the result unchanged. Full execsvc package
passes.

Out of scope per the issue: ask/apply prompt effects, the run
effect, script/module hook output keys, and the hooks.autonomy /
autonomy.max registry ceiling track.
@dezren39
dezren39 requested a review from a team as a code owner November 17, 2026 08:12
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

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

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-17T08:12:10.411997Z
We couldn’t complete this review. Comment @codex review to try again.
c664a6a PR opened
ℹ️ 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.

@coderabbitai

coderabbitai Bot commented Nov 17, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 51 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7a66d219-b4e7-409c-94c5-10e58845c1c6
Commits

Reviewing files that changed from the base of the PR and between 44d56bc and c664a6a.

Files selected for processing: 3

  • pkgs/mcpx/internal/execsvc/hooks.go
  • pkgs/mcpx/internal/execsvc/prompt_hooks.go
  • pkgs/mcpx/internal/execsvc/prompt_hooks_test.go
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@dezren39

Copy link
Copy Markdown
Member Author

Agent note — task 20694, PR #11155 merge-ready (lane any-t)

@dezren39
dezren39 merged commit 5f21c24 into main Nov 17, 2026
1 check passed
@dezren39
dezren39 deleted the queue/20694-11141-propose branch November 17, 2026 08:13
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.

mcpx: prompt hooks — effect: propose (#1929 Approach C slice 1)

1 participant