feat(interceptors): per-interceptor wall-clock timeout (§9.4 M5)
A [[interceptors]] marker can set timeout_ms (migration 0075, CHECK > 0); a
runaway guard (loop {}) is interrupted and the op DENIED (fail closed) within
budget rather than hanging the write path. The effective deadline is
min(caller-remaining, now + timeout) — a hook can only tighten, never extend,
its caller's deadline. NULL uses PICLOUD_INTERCEPTOR_TIMEOUT_MS (default 5s).
Wiring: run_resolved_blocking splits into a core + a _with_timeout variant that
computes the effective deadline from engine::ambient_deadline() and runs via
execute_ast_with_deadline; run_one_hook passes the marker's timeout_ms (or the
env default). timeout_ms threaded end to end — manifest, plan, BundleInterceptor,
the reconcile diff (part of the mutable body: a timeout change is an Update),
insert_interceptor_tx, resolve_chain/list_for_owner/list_on_app_chain +
SealedInterceptor/InterceptorMarker, and interceptor_service → ResolvedInterceptor.
Schema snapshot re-blessed. Pinned by a journey: a loop{} guard with
timeout_ms=100 is denied and its write does not persist.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
10
crates/manager-core/migrations/0075_interceptor_timeout.sql
Normal file
10
crates/manager-core/migrations/0075_interceptor_timeout.sql
Normal file
@@ -0,0 +1,10 @@
|
||||
-- §9.4 Service Interceptors M5 — per-interceptor wall-clock timeout.
|
||||
--
|
||||
-- An optional per-marker `timeout_ms` bounds how long ONE interceptor hook may
|
||||
-- run before it is denied (a runaway guard, e.g. `loop {}`, must not hang the
|
||||
-- guarded write path). NULL means "use the instance default"
|
||||
-- (`PICLOUD_INTERCEPTOR_TIMEOUT_MS`). The effective deadline is always tightened
|
||||
-- to at most the caller's remaining budget — a hook can never EXTEND it.
|
||||
ALTER TABLE interceptors
|
||||
ADD COLUMN timeout_ms INTEGER
|
||||
CHECK (timeout_ms IS NULL OR timeout_ms > 0);
|
||||
Reference in New Issue
Block a user