Repository navigation
Description
Problem
For local mcpx exec / mcpx run (CLI localService, pkgs/mcpx/internal/cli/exec.go), a prompt hook whose template references @calls always receives [], even when the script successfully called tools.
Root cause (Codex review finding on PR #9021, 2026-11-13): localService never initializes svc.Calls, and the daemon's CallRegistry is a live, in-process, per-run sink registry with no retention and no cross-process query surface. A local run's tool calls execute through the separate daemon process (reported via X-Mcpx-Run to the daemon's registry), so there is currently no path for the local service's hook context to learn them. RunWith populates its call snapshot only inside if s.Calls != nil, so local hooks silently present an uncollected history as "no calls".
Daemon-side runs are unaffected: routes_exec.go stamps the daemon's shared registry (Calls: s.callRegistry()), and their @calls is populated.
What a fix needs (design first)
One of, or a combination of:
- Daemon retains per-run
CallInforecords (bounded, TTL'd) and exposes a query surface for a run's calls that the CLI can fetch before outcome hooks run; the CLI wires a fetch into the local service's hook-context snapshot. - The generated client / call path reports call frames back to the local process as they complete, and the local service registers a registry the runner actually feeds.
Either way: never present an uncollected history as an empty one — if calls cannot be collected for a run, the hook path should say so (frame warning or a documented placeholder behaviour) rather than substituting [] silently.
Acceptance
- A local
mcpx exec/mcpx runwith an outcome prompt hook referencing@callsreceives the run's actual tool calls (server, tool, args hash, duration, ok/error — the existingCallInfoshape, hashed args only). - A regression test covers a local run whose script calls a tool and whose outcome prompt hook observes it in
@calls. - Daemon-run behaviour is unchanged; the existing execsvc/cli/daemon suites pass.
Provenance
Split out of issue #5276 / PR #9021 during queue task 9174 (lane any-c, 2026-11-13): the nested-sampling half of that Codex round was fixed in PR #9021; this half needs a new cross-process collection surface and was deferred with the reason recorded on the PR thread rather than rushed into the advise-hooks slice.
Activity
developing-today commentedon Nov 13, 2026
CODE-3020
dezren39 commentedon Nov 17, 2026
agent-note:v1 — triage by lane any-a (queue task 18928), at 2026-11-17T05:15Z. Verdict: CONFIRMED, real and unstarted.
Verified on current main:
localService(~line 178) builds the execsvc.Service with Store/Local/Limits and model-provider wiring but never setsCalls:.RunWith(~line 1060) populates the run's call snapshot onlyif s.Calls != nil— so a local run's outcome prompt hook receives an empty snapshot that reads as "no calls".Calls: s.callRegistry(), so daemon-side runs populate @Calls. Only local CLI runs are affected, exactly as reported. No fix attempted yet; no PR.Routing: follow-on fix enqueued as queue task 20377 (small_fix) carrying the issue's acceptance, including the hard rule that an uncollected history must be signalled, never silently presented as []. The fix is design-first per the issue (daemon-retained per-run CallInfo + query surface, or client-reported frames).
dezren39 commentedon Nov 17, 2026
🤖 Agent note · picked up and parked — task 20377 (openchamber scheduled lane any-o)
109 remaining items
dezren39 commentedon Nov 20, 2026
PR opened: #12117 (commit 58b9460). The local CLI now registers bounded daemon-side call history, fetches the hashed-only snapshot before outcome hooks, and reports collection failures explicitly instead of substituting an empty @Calls list. Targeted execsvc/CLI/daemon tests and race/shuffle regression tests passed.
dezren39 commentedon Nov 22, 2026
Merged work, still open. Every pull request that references this issue has merged (#12061, #12117, #12201) and none is open, but the issue kept
status:in-review. Tasks that name it as a blocker have been waiting on it.status:in-reviewis removed. Whoever takes this next: run the issue's done check against main. Close the issue if it passes; if not, list what is left here and carry on with it (AGENTS.md, "Finishing work").By: Claude, 2026-11-22 flow review.
Generated by Claude Code
dezren39 commentedon Nov 23, 2026
agent-note:v1
state: picked_up
lane: GV (sandbox fix lane, worker archer)
Claiming #9349 for implementation. Premise verified fresh 2026-11-23: issue OPEN, no live claim (prior notes are Nov 17–19 parks of task 20377, long lapsed), bug present on current main (
localServicein pkgs/mcpx/internal/cli/exec.go never initializessvc.Calls).Plan: inspect the daemon CallRegistry + routes_exec stamping and the local exec path; land the smallest cross-process collection surface that satisfies the acceptance (local run's outcome hook observes the run's actual calls in
@calls), with the regression test named in the issue. Never present an uncollected history as an empty one.dezren39 commentedon Nov 23, 2026
agent-note:v1
state: done
lane: GV (sandbox fix lane, worker archer)
Done-check close-out: the fix for #9349 already landed; verified end to end on current main. Closing as completed.
What landed (option 1 from the issue — daemon retains per-run records + a query surface the CLI fetches before outcome hooks):
58b94607e8d"Collect local run tool calls for outcome hooks" (2026-11-20) — verified ancestor of current main. Daemon: bounded, TTL'd per-runCallRegistryhistory (BeginHistory/History, prune + retention limits); routesPOST /v1/calls/{run}(begin) andGET /v1/calls/{run}(snapshot) ininternal/daemon/server.go, catalogued ininternal/api/ops.go. CLI:Client.Begin/Client.Snapshotininternal/cli/exec.go;localServicewiresCallHistory: c. execsvc:RunWithcallsCallHistory.Beginbefore the script starts andSnapshotbefore outcome hooks.c43b796e622"fix(mcpx): end a daemon run's call history when it unregisters" (2026-11-21) — lifecycle follow-up.@calls(CallsError), and the client rejectsavailable:false/ truncated snapshots with an error rather than substituting[].Acceptance, checked one by one:
@calls(CallInfo shape, hashed args only): covered by the regression test below and the wiring above.TestLocalOutcomePromptGetsCollectedCallsAndExplicitUnavailable(internal/execsvc/call_history_test.go) — collected calls reach the prompt ("tool":"forecast"present,"calls":[]absent); snapshot failure and begin failure both yield"available":false, never"calls":[]. Daemon side:TestCallHistoryHandlersDistinguishMissingEmptyAndCollected(internal/daemon/call_history_test.go).go test ./internal/execsvc/ok;./internal/daemon/ok (248s);./internal/cli/ok — one unrelated timing test (TestInlineDaemonCancelledWhileWaiting, a mcpx: inlineDaemon's cancel-during-poll path (PR #320) has no regression test — ablating it leaves the suite green #323 regression with a 2s wall-clock assertion) failed twice under laptop load ~90 and passed on re-run (2.37s); recorded here as a load flake, not a defect in this change (the worktree carried no code changes).No PR from this lane: there was nothing left to implement. The issue stayed open only because the landing was never reconciled against it.