GeezerVison is showing github.com — mcpx: prompt hooks — effect: ask (#1929 Approach C slice 2) · Issue #15809 · developing-today/code
mcpx: prompt hooks — effect: ask (#1929 Approach C slice 2) #15809Descriptionmcpx: prompt hooks — effect: ask (Approach C slice 2 of the #1929 remainder)
Parent: #1929 (Approach C prompt hooks with declared effects). Design of record: the sequencing design note posted on #1929 by queue task 19661 (2026-11-17), against pkgs/mcpx/docs/decisions/0001-hook-vocabulary.md (hook vocabulary) and pkgs/mcpx/docs/decisions/0002-autonomy-dial.md (effect levels off < advise < ask < propose < apply < run).
Previous slices landed:
effect: advise prompt hooks, Implement prompt-action advise hooks for mcpx exec (#1929 Approach C, first slice) #5276, PR feat(mcpx): prompt-action advise hooks for exec (#5276) #9021 merged 2026-11-13.
effect: propose prompt hooks, mcpx: prompt hooks — effect: propose (#1929 Approach C slice 1) #11141, PR feat(mcpx): prompt hooks effect: propose (#11141, #1929 Approach C slice 1) #11155 merged 2026-11-17 — pkgs/mcpx/internal/execsvc/prompt_hooks.go now implements advise + propose, and validateHooks in pkgs/mcpx/internal/execsvc/hooks.go refuses any other prompt effect, naming mcpx: lifecycle hooks on exec — prePrompt/postPrompt/onError as one declared list, script or prompt, with a declared effect #1929.
- Script-hook dropped-key reporting gap named in the design note: fixed, fix(mcpx): report unsupported script-hook output effect keys #12063 / PR fix(mcpx): report unsupported script hook output effects #12064 merged.
Scope
Implement the ask effect for prompt hooks only:
- Semantics (0002): stop the operation — raise a question through the broker, where an unanswered one refuses, or refuse with a structured reason; may not replace or run anything.
- Phases:
before only. Asking is a gate on an operation that has not run; at onSuccess/onError the operation is already complete and a "question" about it is elicitation-after-the-fact, a different feature. Any other phase refuses the declaration at validation, in the existing refusal style.
- Reply shape: a JSON object with
ask (a question for the broker/elicitation path — the elicit.confirmDestructive precedent: unanswered refuses) or refuse (a structured reason string). The hook frame carries whichever fired; a refusal ends the run with that reason as its error, before the script starts (assertable: no result frame, no calls).
- Fail-closed, deliberately unlike advise/propose: a gate that cannot check must not wave through. No provider configured, an unparseable reply, or a broker question that goes unanswered all refuse the run, with the reason in the frame. This is the one prompt effect where the documented "skipped with a warning" prompt contract does not apply, and the slice must say so in
prompt_hooks.go's header where the advise contract is stated.
Out of scope: apply prompt effect (slice 3, sequenced after this slice on #1929), the run effect (the #1929 design concludes it is not built for prompt hooks), failure: "closed" semantics for script hooks (0001 ties it to effects that may refuse; script hooks' effects are fixed per phase and a refusing before is the #185 policy mechanism, not this slice), script/module hooks' output keys, and any hooks.autonomy / autonomy.max registry ceiling work.
Acceptance
- A
refuse reply: the script never runs, and the run's error names the refusal.
- An
ask reply + broker approval: the run proceeds unchanged.
- An
ask reply that goes unanswered: the run is refused.
- No provider configured: the run is refused, with the frame naming why.
effect: ask declared at any phase other than before is refused at validation with a named reason.
Tests (oracle: an ask hook can only stop or pass the run — never alter its value)
- The four acceptance paths above.
- A pass-through case asserting a proceeding run's result is byte-identical to the no-hook run.
- Tests live alongside the advise/propose tests in
pkgs/mcpx/internal/execsvc/prompt_hooks_test.go; verification is go test ./... in pkgs/mcpx via remote dispatch / CI.
Refs #1929
{
"direct_parent": null,
"links": [],
"lineage": {
"design": null,
"roadmap_item": null,
"priority": null
},
"pm_meta": 1,
"provenance": {
"queue_id": null,
"scheduled_start": null,
"picked_up_at": null,
"work_started_at": null,
"created_at": "2026-11-26T23:49:16Z",
"session_id": null,
"lane": null,
"host": "htch-runtime",
"worktree": "/home/hatch",
"model": null,
"lane_start_issues": [],
"workspace_ref": {
"kind": "worktree",
"id": "/home/hatch",
"repo": "developing-today/code",
"branch": "main",
"sha": "bbfc8aa3a3b4f3e3d399b7e76beb6962c0daa5b9"
},
"auth_subject": "xaltha",
"stamped_by": "fleet 0.1.0 (native)"
}
}
Acceptance criteria
effect: ask prompt hooks validate at the before phase only; any other phase is refused at declaration validation in the existing refusal style.
- A hook reply of
ask raises the question through the broker/elicitation path; an unanswered question refuses the run.
- A hook reply of
refuse ends the run before the script starts, with the structured reason as its error (assertable: no result frame, no calls).
- Fail-closed: no provider configured, an unparseable reply, or an unanswered broker question all refuse the run, with the reason recorded in the hook frame.
- Tests cover ask/refuse/unanswered/unparseable paths; verified in repo CI on the pushed branch.
Activitydeveloping-today-fleet commented on Nov 27, 2026 Intake review
- Related: parent issue mcpx: lifecycle hooks on exec — prePrompt/postPrompt/onError as one declared list, script or prompt, with a declared effect #1929 (Approach C prompt hooks); prior slices issue Implement prompt-action advise hooks for mcpx exec (#1929 Approach C, first slice) #5276 / PR feat(mcpx): prompt-action advise hooks for exec (#5276) #9021 (advise, merged) and issue mcpx: prompt hooks — effect: propose (#1929 Approach C slice 1) #11141 / PR feat(mcpx): prompt hooks effect: propose (#11141, #1929 Approach C slice 1) #11155 (propose, merged); script-hook gap issue fix(mcpx): report unsupported script-hook output effect keys #12063 / PR fix(mcpx): report unsupported script hook output effects #12064 (merged). No merged PR implements the
ask effect — this slice is live.
- Notes: Well-scoped slice against the design of record on issue mcpx: lifecycle hooks on exec — prePrompt/postPrompt/onError as one declared list, script or prompt, with a declared effect #1929 (
pkgs/mcpx/docs/decisions/0001-hook-vocabulary.md, 0002-autonomy-dial.md). The fail-closed semantics are the deliberate difference from advise/propose and should be covered first in tests.
- Risks: Broker/elicitation path availability in non-interactive runs — the unanswered-refuses rule must not hang a headless run; the refusal reason in the frame is the observable.
- Suggested approach: Extend
prompt_hooks.go validation + execution for ask at before only, mirroring the propose slice's structure; land the fail-closed tests with the implementation.
🤖 Agent note · filed
developing-today-fleet commented on Nov 27, 2026 🤖 Agent note · claimed — 1837-J
- Agent: archer (lane 1837-J, queue task 25393)
- Task: Implement
effect: ask prompt hooks (before-only, fail-closed) per this issue's acceptance criteria.
- Plan: extend
prompt_hooks.go (ask parsing + fail-closed refusal), hooks.go (validation before-only, frame ask/refuse fields), execsvc.go (optional PromptAsk broker callback; before-phase gate honoured in RunWith so a refusal never starts the script), tests in prompt_hooks_test.go.
developing-today-fleet commented on Nov 27, 2026 🤖 Agent note · done — 1837-J
Implemented and merged in PR #15831 (#15831), merge commit 43425a2; this issue auto-closed via the PR's closing keyword.
What landed:
effect: ask validates at before only; other phases refused at validation in the existing style.
- Reply parsing: JSON object with exactly one of
ask/refuse; higher-effect keys dropped+named.
- Fail-closed: no provider, provider error, unparseable reply, no broker, broker error, or unanswered/declined broker question all refuse the run, reason in the hook frame — stated as the deliberate exception in
prompt_hooks.go's header.
- New
Service.PromptAsk elicitation-broker callback (nil = unanswered = refuse, the elicit.confirmDestructive precedent).
- RunWith honours a before-phase refusal before
runner.Run: script never starts, no result frame, refusal is the run's error; suffix hooks still run.
- Tests in
prompt_hooks_test.go cover all acceptance paths plus a byte-identical pass-through (oracle: ask can only stop or pass, never alter the value).
Verification (honest limits): fleet Actions exec dispatch failed twice (invalid peer certificate, UnknownIssuer), and a local test run was not possible in this lane, so go test ./... in pkgs/mcpx was not executed by this lane — the new tests are unverified by execution and should be confirmed by the next mcpx test run on main. What was verified: gofmt syntax/format on all four changed files; main-branch CI on the merge commit — container images run 45919618147 success, mcpx-docs nix build job success (the mcpx-docs/atlas-docs run failures are the atlas-book Pages stage, which also fails on neighbouring main commits 1d7a6b1 and 7ba52f3 and is unrelated to this change).
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|