GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — mcpx: config-declared hooks over the event bus, running any command, JS/TS or Python module · Issue #1872 · developing-today/code Closed Labels enhancementNew feature or request DescriptionRelocated from dezren39/darwin-nix#81 on 2026-10-28 (placement audit): mcpx's single source lives in developing-today/code (pkgs/mcpx); re-home tracked at #309. Original body below; issue references inside it are historical (dezren39/nix numbering). Parent: #173 Hook vocabulary (#181 collision 2): this issue carries the one hook vocabulary that Summarymcpx already has hooks in two disconnected places: five The daemon already publishes everything worth hooking ( Original notes
(The third bullet is the programmatic half — a plugin registering its own hooks at runtime — and is answered in the privileged-surface issue. This issue is the declarative half.) Current state (what mcpx does today, with file refs)Script hooks exist and are good, but they are script-shaped and TypeScript-only. So the configuration ergonomics of hooks are already solved: repeatable, inline-or-file, composable, with a search path. What they lack is anything but TypeScript, and anything but a script run. Pool hooks exist and are internal. The bus is the hook source. 17 kinds today: 16 constants in Two structural facts that constrain the design:
ApproachesApproach A — least recommended: a
|
| phase | when | blocking | may veto/rewrite | delivery |
|---|---|---|---|---|
observe (default) |
after the fact | no | no | bus subscriber, queued, replayable by seq |
before |
before the operation | yes, bounded | yes — deny, or return a replacement result | direct call, one per operation |
after |
before the result is returned | yes, bounded | yes — rewrite the result | direct call |
observe is B unchanged and costs the daemon nothing. before/after exist only at a small, enumerated set of points — the same kind of one-table discipline internal/api/ops.go uses for /v1: a table of hook points, each with a declared input and output schema, from which the documentation, the validation and the dispatch are all generated. Start with three points: call (a tools/call about to go upstream), exec (a script about to run), server.start. That is enough for the real uses and small enough to audit.
Why this is the recommendation:
before/after are the same shape as the existing script.before/script.onSuccess/script.onError settings, which means the script hooks can eventually be re-expressed as hook-table entries with phase before/after on point exec — one hook concept instead of two. Do not do that migration in this issue; do make sure the vocabulary does not block it. Input for the decision record: the shipped script.* list has five phases (before, prefix, onSuccess, onError, suffix; internal/settings/registry.go:212-242, run at internal/runner/runner.go:190-205), and the shipped onError runs and then rethrows ("a hook, not a handler"), while Update module gopkg.in/go-jose/go-jose.v2 to v2.6.3 [SECURITY] - autoclosed #112's onError may replace the result. The vocabulary has to name which of the two a hook is.{ "on": "call", "phase": "before", "plugin": "guard", "tool": "check" } is a plugin tool call. That is the composition that makes the plugin system worth having, and it is why hooks and plugins should be designed in the same week even if they ship apart.Cost, stated plainly: an enumerated hook-point table is real work, and a blocking hook point is a new class of daemon hang. Mitigate with a hard timeout (a setting with a low default), fail-open as the default, and a mcpx doctor check that reports slow and failing hooks — internal/cli/doctor.go already does exactly this for adapters and API specs.
before-phase hook get the arguments, and may it rewrite them? Rewriting is the powerful case and the one that makes debugging "why did this tool get called with that" miserable. Possibly: may deny with a reason, may not rewrite, until someone has a concrete need.before hook that times out? Fail-open is safer for availability and is the wrong default for anything guard-shaped. Probably per-hook with fail-open as the default.3a02ea3 to 370cd4d #5 governs the chain; a project config that can declare a hook that runs a command is a notable escalation over a project config that can declare a server./v1 at all — list them, disable one, fire one for testing? mcpx hook ls / mcpx hook test <name> --event <file> are cheap and make the feature debuggable. Listing yes; a runtime-mutable hook table probably belongs to the privileged-plugin issue instead.3a02ea3 to 4371899 #6: if every event lands in an event store, a hook is a trigger on that table, and "replay hooks over history" becomes possible. Worth designing the seq watermark so this stays open.keep today, and is it enough that a hook whose worker pool is saturated for a few seconds does not lose events?events.history, default 1024 (above). A saturated hook pool is gapped, not merely slow; what the hook is told is Bump build/buck/preludes/buck2-prelude from 3a02ea3 to 4371899 #6's gap contract (collision 13), which recommends one explicit gap marker for reconnect, live overflow and replay truncation.Ease: M for the observer table and the three executors; L with phases and the hook-point table. Impact: high — hooks are what let someone extend mcpx without writing a server, and the bus that makes them cheap already exists.
Depends on / related: #6 (event store — the same event vocabulary; a hook is a live trigger, the store is the history; owns gap semantics, collision 13), #112 (exec lifecycle hooks — adopts this issue's vocabulary, collision 2), #82 (runtime hook registration — adopts it too), #80 (a plugin tool is a hook target), #83, #5 (config chain, and what a project-level config may declare; paths.config is still unread), #7 (script.* splicing and placeholders, the existing hook-shaped settings), #79 (per-event work on a latency-sensitive path), #172 (any new MCPX_EVENT_* variable must be declared), #77.
Security/auth deferred; see tracker.
History carried over from dezren39/darwin-nix#81 (verbatim, oldest first):
@dezren39 · 2026-09-30T07:21:25Z
Integration pass. Placed in the DAG rooted at #181.
d956689 to 2901d28 #80 chore(deps): bump build/buck/preludes/buck2-prelude from d956689 to 5f79ad1 #82 chore(deps): bump build/buck/preludes/buck2-prelude from d956689 to 36464cf #83 chore(deps): bump prettier-plugin-toml from 1.0.0 to 2.0.1 #84@dezren39 · 2026-09-30T07:27:47Z
Integration pass -- cross-theme collision. Surfaced only when the themes were put side by side; the authors of these issues could not see each other's work. Recorded at the root in #181.
script.* (shipped), #81's hook-point table, #82's runtime hook registration, and #112's prePrompt/postPrompt/onError list are four vocabularies for one concept. #112 sits in a different theme (#176) from #81/#82 (#173), so nobody currently owns the overlap. Reconciling them after the fact is a breaking config change -- design them as one.
Also on: #82 #112. Nobody currently owns this.
@dezren39 · 2026-09-30T07:28:28Z
Integration pass -- cross-theme collision. Surfaced only when the themes were put side by side; the authors of these issues could not see each other's work. Recorded at the root in #181.
events.history already answers #81's open question, and changes its design#81 asks what keep is today. It is events.history, default 1024 (internal/defaults/defaults.json:52, wired at internal/daemon/server.go:165). That means a saturated hook pool is gapped, not merely slow, which the seq-watermark design has to handle explicitly.
Also on: #6. Nobody currently owns this.
@dezren39 · 2026-09-30T11:05:46Z
Collision ownership (issues pass, 2026-09-30, at 05c78b2). #181 listed these cross-theme collisions with no owner. Each now has one:
| #181 row | Collision | Owner | What the owner decides |
|---|---|---|---|
| 2 | four hook vocabularies (script.* shipped, #81, #82, #112) |
#81, via a decision record SURFACES is writing under pkgs/mcpx/docs/decisions/ (in flight; linked here when it merges) |
The vocabulary is decided in the decision record; #81 is the issue that carries it. #82 and #112 adopt it rather than defining their own. |
| 13 | events.history (default 1024) already answers #81's open question |
#6 | A bounded history means a saturated consumer is gapped, not slow. That is a property of the event store, so #6 defines gap semantics (a seq watermark and an explicit gap marker); #81's hooks consume them. |
Where this issue is the owner, the decision is made here; where it is not, it adopts the owner's decision rather than making its own.
@dezren39 · 2026-09-30T12:12:08Z
Issues pass (2026-09-30, at 05c78b2).
Parent: #173 and a line at the top. chore(deps): bump stefanzweifel/git-auto-commit-action from 4 to 5 #81 carries the hook vocabulary (Phase 3: sync, blob gate, and relays #181 collision 2), and SURFACES is recording the decision under pkgs/mcpx/docs/decisions/ (in flight). The phase/hook-point design is input to that record. The vocabulary sections themselves were not changed.3a02ea3 to 4371899 #6 (collision 13).keep today" is marked answered: events.history, default 1024.events.go:30-51) plus catalog.changed (internal/daemon/consumer.go:236). Re-cited registry.go:201-243/:234. Noted Update Rust crate proc-macro2 to 1.0.81 - autoclosed #75: script.* phases now apply to snippets too.d956689 to 5f79ad1 #82 (they adopt this vocabulary), Bump build/buck/preludes/buck2-prelude from 3a02ea3 to 4371899 #6 (gap owner), chore(deps): bump build/buck/preludes/buck2-prelude from d956689 to 2901d28 #80, chore(deps): bump build/buck/preludes/buck2-prelude from d956689 to 36464cf #83 and Phase 2: membership, delegation, groups, and server config #172. Added the design label.@dezren39 · 2026-09-30T12:16:47Z
Issues pass (2026-09-30, architect follow-up). Added input for the hook-vocabulary decision record (collision 2): the shipped script.* list has five phases (registry.go:212-242, runner.go:190-205), and its onError rethrows while #112's may replace the result; the vocabulary has to name which a hook is. (From the AI-layer worker.)
@dezren39 · 2026-09-30T16:58:13Z
Decided (SURFACES, 0001-hook-vocabulary, merged in #228). #181 collision 2 is settled: the shipped launcher phases are the one vocabulary.
What changes in this issue:
before, prefix, onSuccess, onError, suffix (shipped) plus observe (new, the default: asynchronous, off the bus). after becomes onSuccess/onError (or suffix); async becomes phase: observe.api.Ops(): script, call, server.start. The point this issue calls exec is renamed script, so it visibly matches script.<phase>.{on, phase, action, effect}; actions are source (only via script.<phase>), run (an argv array, never a shell string), module, prompt, plugin. effect takes the autonomy levels of 0002.hooks setting, not endpoints (Phase 3: sync, blob gate, and relays #181 recommendation 6). That needs a JSON setting kind in internal/settings.events.history is 1024 and a subscriber's buffer is 256, so a saturated hook pool is gapped (Phase 3: sync, blob gate, and relays #181 row 13). call.started and task.updated are declared bus kinds nothing publishes; drop them from the hookable list until something does.@dezren39 · 2026-10-28T21:03:09Z
Triage verdict — confirmed, partially decided, unimplemented; mis-homed in this repo.
Verified against current main (2026-10-28):
dezren39/nix@8c42c2c, origin/main) has no mcpx Go source — pkgs/mcpx/ and internal/ were deleted 2026-10-19 (lab-ops-hub container crawler accepts inet_aton IPv4 spellings (127.1, 2130706433, 0x7f.1) — loopback SSRF bypass in validate_crawl_url #468, planning/plans/mcpx-extraction.md steps 4–5); mcpx now lives solely in developing-today/code at pkgs/mcpx/, consumed here as a pinned source-only flake input.developing-today/code@528886e, origin/main): the internal half this issue describes still exists exactly as described — pool.Hooks at pkgs/mcpx/internal/pool/pool.go:1069, wired to the bus by Registry.InstallHooks in pkgs/mcpx/internal/daemon/hooks.go — and it is explicitly "not a user vocabulary; the source of bus events" (pkgs/mcpx/docs/decisions/0001-hook-vocabulary.md, Mapping table).git grep "hooks." pkgs/mcpx/internal/settings/registry.go at code HEAD returns no config-declared hook settings (only the unrelated hooks.autonomy consumer entry at internal/settings/consumer.go:145); there is no hooks: [{on, phase, run|module|plugin}] declaration surface.run: must be an argv array (a string is refused/forbidden), phase: after splits into onSuccess/onError, and several items are explicitly Deferred → chore(deps): bump stefanzweifel/git-auto-commit-action from 4 to 5 #81 (e.g. mcpx hook test, script.started/script.finished bus kinds). So the design input landed, the feature did not.Route: no small_fix packet in the nix queue — implementing config hooks here would recreate the vendored mcpx copy the extraction removed, and a duplicate filing in code would violate the one-issue-per-change rule while code#309 owns the transfer. Keep open here until code#309 re-files it in developing-today/code (carrying decision 0001 as its vocabulary), then close here with that link.
agent-note:v1 · agent: repo-queue-worker-shift-nix (lane A) · task 2064 · kind: triage · outcome: confirmed, decision 0001 landed in code, feature unimplemented; routed to #309 re-home; no nix follow-up packet
Agent note — triage verdict (queue task 2765): NOT a duplicate; scope confirmed with corrections; implementation follow-up enqueued
Dedupe (checked 2026-10-29, code issues, all states): no existing issue covers config-declared hooks over the event bus. Named neighbours, none a duplicate: tracker #1885 (extensibility — plugins, hooks, tool sources, embedding) is the parent; #1873 is the programmatic/privileged half, explicitly split from this declarative half by this issue's own body; #1929 is the exec-lifecycle list (the #112 successor) which adopts this issue's vocabulary — a consumer, not a cover; #1870 (a plugin is an MCP server) defines one hook target type; #1842 (paths.config governs the config chain) owns the config-chain question this issue's open questions point at.
Scope vs current main (origin/main 42796be) — corrections to the issue's stated current state:
docs/decisions/0001-hook-vocabulary.md (dated 2026-09-30; covers chore(deps): bump stefanzweifel/git-auto-commit-action from 4 to 5 #81/chore(deps): bump build/buck/preludes/buck2-prelude from d956689 to 5f79ad1 #82/Update module gopkg.in/go-jose/go-jose.v2 to v2.6.3 [SECURITY] - autoclosed #112/Bump checkmarx/ast-github-action from 2.0.19 to 2.0.23 #111) is on main — the issue's "in flight; linked here when it merges" is stale. The follow-up builds to decision 0001, not to Approach C as raw input.call.started no longer exists (declared but published by nothing; removed and recorded in decision 0001 — a hook table must not offer it), resource.watching exists but is never on the bus, and events.go now declares 18 kind constants. The issue's "17 kinds" list needs the follow-up to re-derive the hookable set from current internal/events/events.go.script.* family), no declarative subscriber table, no executors — internal/daemon/hooks.go (pool.Hooks → bus) remains the only hook code. The bus, its prefix Filter, Seq replay, and events.history (default 1024) are all in place as the issue describes.Follow-up: implementation packet enqueued on this queue with acceptance: hookable event set re-derived from current events.go + decision 0001; declarative hook table in config (respecting #1842's config-chain ruling on what project config may declare); command / JS-TS module / Python module executors (no Go loading); hard timeout + fail-open default per-hook; mcpx doctor reporting of slow/failing hooks; pkgs/mcpx go test ./... green in CI.
Agent note — triage closed (queue task 2765)
🤖 Agent note · parked
TestEveryDocumentHasAChapter fails on clean main too — pre-existing, documented on the PR), then complete the task.queue/3097-1872-config-hooks🤖 Agent note · parked
awaiting_ci, still awaiting_ci; parked 20 minqueue/3097-1872-config-hooks, head eb4cabc6) is OPEN; basic: proxy port fallbacks and basic: spec parity pass, basic: test is red with 4 package failures: internal/defaults, internal/settings (the two pre-existing doc-drift reds, tracked in mcpx docs: 13 pages missing from compendium.manifest.json — TestEveryDocumentHasAChapter red on main #2552 / main-broken main-broken: developing-today/code id @281d999 — basic: nix flake check (cargo-check) #2554/main-broken: developing-today/code mcpx @9f3c829 — basic: test #2534) plus internal/hooks, which is this diff's own package — the job log does not carry the per-test output, so the failing assertion must be read from run 40997046260's job page or reproduced with cd pkgs/mcpx && go test ./internal/hooks/.has_any_findings:true, has_unresolved_findings:true on the PR — findings are not yet dispositioned.go test ./internal/hooks/ at eb4cabc6, fix the hooks failure, dispose the Codex findings with fix replies, push, rerun ./internal/hooks/ ./internal/settings/ ./internal/defaults/, then merge if the only remaining reds are the two pre-existing doc-drift tests.Merge pull request #2541 from developing-today/queue/3097-1872-config…
🤖 Agent note · parked
pkgs/mcpx.docs/decisions/0001-hook-vocabulary.md.Agent note — resumed, verifying merged PR (queue task 3097, Lane D)
queue/3097-1872-config-hooks, single commit eb4cabc) is MERGED to main at 2026-10-30T04:31:13Z, merge commit 1aef00e; pkgs/mcpx/internal/hooks is present on main. mcpx: config-declared hooks over the event bus, running any command, JS/TS or Python module #1872 stayed open because the PR body said "Closes the declarative half", not an auto-close keyword.basic: test run was red — internal/defaults + internal/settings are the pre-existing doc-drift reds tracked in mcpx docs: 13 pages missing from compendium.manifest.json — TestEveryDocumentHasAChapter red on main #2552, but internal/hooks (this PR's own new package) also FAILed in 0.159s; (2) the Codex review on mcpx: config-declared hooks over the event bus (#1872) #2541 (2026-10-30T03:27:58Z) left 4 findings (1 P1, 3 P2) with no disposition on the PR before merge.Agent note — done, closing (queue task 3097, Lane D)
hooks/hooks.timeout), events.Bus subscriber with prefix Filter semantics, command + JS/TS + Python module executors, hard timeout with fail-open default, mcpx hook ls, and doctor checks. Hookable set matches current events.go (no call.started; resource.watching and hook.* excluded). The privileged/programmatic half stays in mcpx: the privileged plugin surface -- runtime hooks, variables, internal commands, detachment #1873, as scoped.go test ./internal/hooks/ -count=1 on the laptop at the merged commit eb4cabc passes 11/11.basic: test run was red and its Codex review (4 findings: 1 P1, 3 P2) undispositioned. The defaults/settings reds are pre-existing (mcpx docs: 13 pages missing from compendium.manifest.json — TestEveryDocumentHasAChapter red on main #2552); the CI-only internal/hooks failure (unreproducible on the laptop; per-test detail is not retained in the workflow log) and all 4 Codex findings are filed as mcpx hooks (#2541 follow-up): bound descendant processes on timeout, cap retained output, count bus-level drops, real interpreter readiness — plus CI-only internal/hooks failure #2573 with a queued fix task (3823) — the P1 is real: a hook spawning descendants is not bounded by the timeout today.