You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mino_pcall: expose raw thrown value; STM propagates validator throws
Two coupled changes follow on from the previous pcall catch-arm fix:
1. mino_pcall's signature gains an out_ex parameter. When the call
throws, *out_ex receives the raw thrown value (the cell passed to
(throw ...) -- typically an ex-info map or similar payload).
Callers like agent dispatch and STM validator handling that want
to surface the user's exception unchanged read from out_ex
directly. Breaking ABI change for existing pcall callers; mino
is alpha so no compat shim.
2. The agent code's agent_try_call workaround is removed.
agent.c now calls mino_pcall(..., &new_state, &thrown_ex) for
actions, validators, and watches, getting the same exception
capture in 1 line where agent_try_call took 30. The custom try
frame is gone.
3. run_ref_validator in stm.c uses out_ex, threading the captured
exception through tx_state_t's new validator_thrown_ex slot.
tx_commit sets validator_rejected for both throws and falsy-
rejects (both are hard failures, distinct from read-set-
conflict retries) and parks the captured exception on tx.
dosync_run consumes it: if validator_thrown_ex is set, it
propagates the user's original payload via mino_throw;
otherwise it raises the canonical MCT001 "Invalid reference
state".
Net behavior change: a validator that throws now aborts the
transaction with the validator's own exception (matching JVM
Clojure's "propagate the validator's exception" semantic). The
previous code retried until the retry cap and then threw
MST004 "transaction retry limit exceeded".
GC: tx->validator_thrown_ex is traced in gc_mark_ctx_tx so the
captured exception stays reachable across collections that may
fire between commit and dosync_run's re-throw.
tests/stm_test.clj covers both cases:
- validator-throw-propagates-original-exception checks that
(ex-data e) returns the original ex-info data.
- validator-falsy-reject-throws-MCT001 pins the falsy-reject path.
Internal suite 1514 / 7171 / 0. External baseline unchanged. The
upstream add_watch.cljc / remove_watch.cljc agent arms still pass
cleanly.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments