Repository navigation
feat(mcpx): prompt hooks effect: propose (#11141, #1929 Approach C slice 1) - #11155
Conversation
…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.
Codex Review Summary: ❌ FailedThis 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. |
|
Warning Review limit reachedYou'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. View limit details
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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Agent note — task 20694, PR #11155 merge-ready (lane any-t)
|
Closes #11141 (parent #1929, Approach C slice 1). Queue task 20694.
What
Implements the
proposeeffect for prompt hooks at thescriptpoint, following the advise slice (#5276, PR #9021):validateHooks):effect: proposeaccepted atonSuccess/onErroronly.before(nothing exists to propose against yet) andsuffix(clamped to at mostadviseby 0001) are refused with a named reason in the existing refusal style.ask/apply/runstay refused as not implemented.HookFramegains aproposefield (the proposed value, JSON). Replies are parsed as hook output objects (0001): theproposekey 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'sdroppedlist — never honoured, never silent.runPromptHookstill never touchesres, andrunHooksnever consultsapplyHookResultfor prompt hooks.Out of scope per the issue:
ask/applyprompt effects, theruneffect, script/module hook output keys,hooks.autonomy/autonomy.maxceiling 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/rundropped and named, result byte-identical), plain-text reply,onErrorbeside the untouched error, validation refusals forbefore/suffix(+askstill unimplemented), no-provider frame, and therunHookspath retaining the proposal on the result.go test ./internal/execsvc/— full package passes (including all pre-existing advise/script hook tests).gofmtclean.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.