Liking cljdoc? Tell your friends :D

com.blockether.vis.internal.config.runtime-settings

Per-eval / per-call runtime knobs for the loop: Python-sandbox eval timeouts (with clamping and a widener for HTTP calls and sleeps), the svar/ask-code! stream watchdog defaults, and the dynamic vars the loop binds per call.

Also the HOST half of the cancel contract: park-blocking-wall stops a wall's clock while host code legitimately blocks.

A LEAF — depends on nothing else in the engine, so the loop and its tests read these settings from one place instead of carrying them in the loop namespace.

Per-eval / per-call runtime knobs for the loop: Python-sandbox eval timeouts
(with clamping and a widener for HTTP calls and sleeps), the `svar/ask-code!` stream
watchdog defaults, and the dynamic vars the loop binds per call.

Also the HOST half of the cancel contract: [[park-blocking-wall]] stops a
wall's clock while host code legitimately blocks.

A LEAF — depends on nothing else in the engine, so the loop and its tests read
these settings from one place instead of carrying them in the loop namespace.
raw docstring

*blocking-wall-hold*clj

Hold hook installed by the innermost enclosing timeout wall: (fn [] release).

*blocking-wall-park* for work that ENTERS and LEAVES on separate calls. A live view opens on one crossing of the Python bridge and closes on another — there is no thunk to wrap around the watching — so a run SHOWING its work takes a release token at open and spends it at close.

Hold hook installed by the innermost enclosing timeout wall: `(fn [] release)`.

[[*blocking-wall-park*]] for work that ENTERS and LEAVES on separate calls.
A live view opens on one crossing of the Python bridge and closes on another
— there is no thunk to wrap around the watching — so a run SHOWING its work
takes a release token at `open` and spends it at `close`.
sourceraw docstring

*blocking-wall-park*clj

Park hook installed by the innermost enclosing timeout wall: (fn [thunk]).

Extension dispatch and blocking user-input operations call park-blocking-wall. Enclosing execution clocks stop for the complete invocation, including hooks. The final concurrent or nested exit restores the full execution budget; cancellation and the operation's own timeout remain independent of this clock.

Park hook installed by the innermost enclosing timeout wall: `(fn [thunk])`.

Extension dispatch and blocking user-input operations call
[[park-blocking-wall]]. Enclosing execution clocks stop for the complete
invocation, including hooks. The final concurrent or nested exit restores
the full execution budget; cancellation and the operation's own timeout
remain independent of this clock.
sourceraw docstring

*eval-timeout-ms*clj

Dynamic timeout in milliseconds for Python code evaluation.

Dynamic timeout in milliseconds for Python code evaluation.
sourceraw docstring

*rlm-context*clj

Dynamic context for RLM debug logging.

Dynamic context for RLM debug logging.
sourceraw docstring

ASK_CODE_IDLE_TIMEOUT_MSclj

Default inter-chunk idle timeout for Vis svar/ask-code! calls (ms).

Fires when the transport itself goes silent — not one byte, not even an SSE keepalive comment. 300s = CODEX PARITY with DEFAULT_STREAM_IDLE_TIMEOUT_MS. Model-progress silence while keepalives continue is different and does not time out by default; see ASK_CODE_SEMANTIC_TIMEOUT_MS.

The FIRST byte has its own svar watchdog. Provider-scoped policy may widen that prefill window independently; this 300s default governs gaps after the first byte.

Default inter-chunk idle timeout for Vis `svar/ask-code!` calls (ms).

Fires when the transport itself goes silent — not one byte, not even an
SSE keepalive comment. 300s = CODEX PARITY with
`DEFAULT_STREAM_IDLE_TIMEOUT_MS`. Model-progress silence while keepalives
continue is different and does not time out by default; see
`ASK_CODE_SEMANTIC_TIMEOUT_MS`.

The FIRST byte has its own svar watchdog. Provider-scoped policy may widen
that prefill window independently; this 300s default governs gaps after the
first byte.
sourceraw docstring

ASK_CODE_SEMANTIC_TIMEOUT_MSclj

Default model/progress timeout for Vis svar/ask-code! streams (ms).

240 seconds without text, reasoning, tool-input progress or a terminal event means the model is stalled even if SSE keepalives still prove transport liveness. This exceeds Anthropic's documented ~185-second worst observed extended-thinking silence while bounding a live-but-unproductive stream.

Explicit nil disables it per call. OpenAI Responses sessions intentionally ignore this setting and retain their transport-specific idle policy.

Default model/progress timeout for Vis `svar/ask-code!` streams (ms).

240 seconds without text, reasoning, tool-input progress or a terminal event
means the model is stalled even if SSE keepalives still prove transport
liveness. This exceeds Anthropic's documented ~185-second worst observed
extended-thinking silence while bounding a live-but-unproductive stream.

Explicit nil disables it per call. OpenAI Responses sessions intentionally
ignore this setting and retain their transport-specific idle policy.
sourceraw docstring

ASK_CODE_TTFT_TIMEOUT_MSclj

Default time-to-first-token timeout for Vis svar/ask-code! calls (ms).

200s. The wait for the FIRST response header, and nothing else: no bytes arrived, no tool ran, no output was streamed, so the request can simply be made again.

Deliberately WIDER than svar's own router/DEFAULT_TTFT_TIMEOUT_MS (two minutes). That number is tuned for a router holding a second candidate to cross to; Vis pins the route to one provider+model, so the header a cold start or a deep provider queue would have produced at 130s has nowhere else to come from and must not be called dead at 120s. It still sits under svar's router/DEFAULT_TIMEOUT_MS (the 300s whole-request cap Vis leaves at its default), so this watchdog — not the HTTP client — is what names the failure and the abort keeps its type (:svar.core/stream-ttft-timeout) for Svar's stream recovery to recognize. A project that lowers network.timeout_ms under 200s reaches the client's own timeout first.

Measured: a pinned zai-coding-plan turn spent its last 120s waiting for headers that never came and died with ten iterations of finished work behind it, because svar's router had no second candidate to cross to. The re-send is what fixed that; this number only decides how long one try waits. Because the abort is raised while no output exists, Svar re-sends it to the same provider on its :stream-recovery-delays-ms schedule, so a wedged endpoint is named by three visible tries — about ten minutes at 200s, where 60s bought three — instead of by one silent gap. Never shorten this without that re-send in place: alone it would only kill healthy slow-queue turns faster.

Model-progress silence while keepalives continue is a separate, opt-in semantic watchdog below.

Default time-to-first-token timeout for Vis `svar/ask-code!` calls (ms).

200s. The wait for the FIRST response header, and nothing else: no bytes
arrived, no tool ran, no output was streamed, so the request can simply be
made again.

Deliberately WIDER than svar's own `router/DEFAULT_TTFT_TIMEOUT_MS` (two
minutes). That number is tuned for a router holding a second candidate to
cross to; Vis pins the route to one provider+model, so the header a cold
start or a deep provider queue would have produced at 130s has nowhere
else to come from and must not be called dead at 120s. It still sits under
svar's `router/DEFAULT_TIMEOUT_MS` (the 300s whole-request cap Vis leaves
at its default), so this watchdog — not the HTTP client — is what names the
failure and the abort keeps its type (`:svar.core/stream-ttft-timeout`)
for Svar's stream recovery to recognize. A project that lowers
`network.timeout_ms` under 200s reaches the client's own timeout first.

Measured: a pinned zai-coding-plan turn spent its last 120s waiting for
headers that never came and died with ten iterations of finished work
behind it, because svar's router had no second candidate to cross to. The
re-send is what fixed that; this number only decides how long one try
waits. Because the abort is raised while no output exists, Svar re-sends it
to the same provider on its `:stream-recovery-delays-ms` schedule, so a
wedged endpoint is named by three visible tries — about ten minutes at
200s, where 60s bought three — instead of by one silent gap. Never shorten
this without that re-send in place: alone it would only kill healthy
slow-queue turns faster.

Model-progress silence while keepalives continue is a separate, opt-in
semantic watchdog below.
sourceraw docstring

await-wallclj

(await-wall fut deadline timeout-value)

Wait for fut until the CURRENT value of deadline passes, re-reading the atom on every wake so a park that MOVED the wall extends the wait instead of expiring. Returns timeout-value once the wall is really reached.

A nil deadline disables this watchdog while an extension executes, a human is being asked, or a live view is watched. Polling observes the full budget restored after the final park or hold is released.

Wait for `fut` until the CURRENT value of `deadline` passes, re-reading the
atom on every wake so a park that MOVED the wall extends the wait instead of
expiring. Returns `timeout-value` once the wall is really reached.

A nil deadline disables this watchdog while an extension executes, a human
is being asked, or a live view is watched. Polling observes the full budget
restored after the final park or hold is released.
sourceraw docstring

clamp-eval-timeout-msclj

(clamp-eval-timeout-ms candidate)

Clamp a candidate eval timeout to [MIN_EVAL_TIMEOUT_MS, MAX_EVAL_TIMEOUT_MS].

Clamp a candidate eval timeout to [MIN_EVAL_TIMEOUT_MS, MAX_EVAL_TIMEOUT_MS].
sourceraw docstring

DEFAULT_EVAL_TIMEOUT_MSclj

Default wall-clock backstop around ONE python_execution block — five minutes.

It stops guest code that never ends on its own, such as while True: or a regex with catastrophic backtracking. Tool calls (shell, MCP, extensions) park this clock, so they do not use this budget. It bounds the compute inside the sandbox: a large parse, an image pass, a loop over many files.

At two minutes that work was killed where it got expensive. At five minutes, a wedged block costs five minutes of a turn.

Default wall-clock backstop around ONE `python_execution` block — five minutes.

It stops guest code that never ends on its own, such as `while True:` or a regex
with catastrophic backtracking. Tool calls (shell, MCP, extensions) park this
clock, so they do not use this budget. It bounds the compute inside the sandbox:
a large parse, an image pass, a loop over many files.

At two minutes that work was killed where it got expensive. At five minutes, a
wedged block costs five minutes of a turn.
sourceraw docstring

DEFAULT_SHELL_TIMEOUT_SECSclj

Default per-command and per-wait budget of the shell tool, in seconds. foundation.shell reads it here.

Thirty minutes, the same as MAX_SHELL_TIMEOUT_SECS. The budget is a CEILING on the WAIT, never a delay: a fast command returns when it exits. At two minutes, long builds and full test suites were killed where their output started to matter.

A shell call parks the wall of its block (see park-blocking-wall), so this budget never races the eval watchdog.

Default per-command and per-wait budget of the `shell` tool, in seconds.
`foundation.shell` reads it here.

Thirty minutes, the same as [[MAX_SHELL_TIMEOUT_SECS]]. The budget is a
CEILING on the WAIT, never a delay: a fast command returns when it exits. At
two minutes, long builds and full test suites were killed where their output
started to matter.

A shell call parks the wall of its block (see [[park-blocking-wall]]), so this
budget never races the eval watchdog.
sourceraw docstring

eval-timeout-ms-for-codeclj

(eval-timeout-ms-for-code base-timeout-ms code)

Eval watchdog for ONE Python block: the configured base, raised so it sits a grace period ABOVE the longest call that blocks inside the guest.

Only HTTP calls and literal sleeps raise it. A tool call (shell, MCP, an extension) parks the wall, so its budget never needs room here. Raising the wall for a tool call also gave the CPU work in the same block that time.

A literal sleep that alone reaches the base raises it the same way: await asyncio.sleep(420) cannot finish inside five minutes. A shorter sleep already fits, and a text scan cannot tell how much other work shares its block, so the base stays.

Eval watchdog for ONE Python block: the configured base, raised so it sits a
grace period ABOVE the longest call that blocks inside the guest.

Only HTTP calls and literal sleeps raise it. A tool call (shell, MCP, an
extension) parks the wall, so its budget never needs room here. Raising the
wall for a tool call also gave the CPU work in the same block that time.

A literal sleep that alone reaches the base raises it the same way:
`await asyncio.sleep(420)` cannot finish inside five minutes. A shorter sleep
already fits, and a text scan cannot tell how much other work shares its
block, so the base stays.
sourceraw docstring

hold-blocking-wall!clj

(hold-blocking-wall!)

LIFT every enclosing wall until the returned thunk is called, and answer that thunk.

Not a bigger budget — no budget. The wall is the backstop for code that fell SILENT, and a run painting a picture a human is watching is the opposite of silent: it is billed nothing at all, for as long as it shows its work. The base budget comes back, measured from the release, when the last hold is spent.

Releasing twice is a no-op, so a finally releasing what a close already released cannot collapse the clock under work that is still running. With no wall installed (a host-side call, tests) both halves are no-ops.

LIFT every enclosing wall until the returned thunk is called, and answer that
thunk.

Not a bigger budget — no budget. The wall is the backstop for code that fell
SILENT, and a run painting a picture a human is watching is the opposite of
silent: it is billed nothing at all, for as long as it shows its work. The
base budget comes back, measured from the release, when the last hold is
spent.

Releasing twice is a no-op, so a `finally` releasing what a close already
released cannot collapse the clock under work that is still running. With no
wall installed (a host-side call, tests) both halves are no-ops.
sourceraw docstring

HTTP_CALL_FLOOR_SECSclj

Floor for an eval that reaches the NETWORK through the HTTP shims (requests, httpx, urllib3, urlopen).

A request's budget is invisible to a text scan in the way that matters: the shim's own per-call default is 30s, the block usually loops over N hosts, and the helper doing the fetching is typically defined in an EARLIER block. So a perfectly ordinary crawl raced the watchdog — two minutes, then — and the watchdog won: a bare Timeout for work that was progressing normally, which is the defect DEFAULT_SHELL_TIMEOUT_SECS describes, spelled in sockets.

Unlike shell's, this floor does NOT drop when the block spells a literal timeout=: that number bounds ONE request, never the loop around it.

Floor for an eval that reaches the NETWORK through the HTTP shims (`requests`,
`httpx`, `urllib3`, `urlopen`).

A request's budget is invisible to a text scan in the way that matters: the
shim's own per-call default is 30s, the block usually loops over N hosts, and
the helper doing the fetching is typically defined in an EARLIER block. So a
perfectly ordinary crawl raced the watchdog — two minutes, then — and the
watchdog won: a bare `Timeout` for work that was progressing normally, which is
the defect `DEFAULT_SHELL_TIMEOUT_SECS` describes, spelled in sockets.

Unlike shell's, this floor does NOT drop when the block spells a literal
`timeout=`: that number bounds ONE request, never the loop around it.
sourceraw docstring

literal-sleep-msclj

(literal-sleep-ms code)

Longest sleep in Python code whose duration is a literal number, in milliseconds rounded up and capped at MAX_EVAL_TIMEOUT_MS, or nil when the code has none.

Longest sleep in Python code whose duration is a literal number, in
milliseconds rounded up and capped at [[MAX_EVAL_TIMEOUT_MS]], or nil when
the code has none.
sourceraw docstring

MAX_EVAL_TIMEOUT_MSclj

Hard ceiling for :eval-timeout-ms — 35 minutes.

It caps the configured base and the floors that a literal sleep or an HTTP timeout in the block adds.

Hard ceiling for :eval-timeout-ms — 35 minutes.

It caps the configured base and the floors that a literal sleep or an HTTP
timeout in the block adds.
sourceraw docstring

MAX_SHELL_TIMEOUT_SECSclj

Hard ceiling that foundation.shell clamps EVERY run and wait budget to: thirty minutes.

Hard ceiling that `foundation.shell` clamps EVERY `run` and `wait` budget to:
thirty minutes.
sourceraw docstring

MIN_EVAL_TIMEOUT_MSclj

Floor for :eval-timeout-ms.

Floor for :eval-timeout-ms.
sourceraw docstring

park-blocking-wallclj

(park-blocking-wall thunk)

Run thunk with every enclosing timeout wall parked. With no wall installed (plain JVM call, tests) this is just (thunk).

Run `thunk` with every enclosing timeout wall parked. With no wall installed
(plain JVM call, tests) this is just `(thunk)`.
sourceraw docstring

parkable-wallclj

(parkable-wall start timeout-ms)

One MOVABLE wall clock for a bounded execution that began at start with timeout-ms of budget.

Returns {:deadline <atom epoch-ms or nil> :park (fn [thunk]) :hold (fn [] release)}, where a NIL deadline is NO wall at all (see await-wall).

park is re-entrant and safe for concurrent calls. Only the final exit restores the full timeout-ms budget, measured from that exit, even when the call throws. Time spent executing extensions or awaiting user input does not consume the enclosing execution budget.

It composes with *blocking-wall-park*, so parking an inner wall parks every enclosing wall too. hold takes and releases the same clock on separate calls (see *blocking-wall-hold*). Parks and holds share depth and nest in either order.

One MOVABLE wall clock for a bounded execution that began at `start` with
`timeout-ms` of budget.

Returns `{:deadline <atom epoch-ms or nil> :park (fn [thunk]) :hold (fn [] release)}`,
where a NIL deadline is NO wall at all (see [[await-wall]]).

`park` is re-entrant and safe for concurrent calls. Only the final exit
restores the full `timeout-ms` budget, measured from that exit, even when
the call throws. Time spent executing extensions or awaiting user input
does not consume the enclosing execution budget.

It composes with [[*blocking-wall-park*]], so parking an inner wall parks
every enclosing wall too. `hold` takes and releases the same clock on
separate calls (see [[*blocking-wall-hold*]]). Parks and holds share depth
and nest in either order.
sourceraw docstring

with-default-ask-code-idle-timeoutclj

(with-default-ask-code-idle-timeout opts)
(with-default-ask-code-idle-timeout opts provider-network)

Merge streaming limits with precedence: explicit call opts, provider policy, Vis runtime defaults, then svar defaults for keys Vis leaves absent.

Merge streaming limits with precedence: explicit call opts, provider policy,
Vis runtime defaults, then svar defaults for keys Vis leaves absent.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close