Skip to main content

Module debug_switches

Module debug_switches 

Source
Expand description

The GGLIB_DISABLE_* environment switches, and which are in effect here.

Each one turns off a compensation so its effect can be measured — the deletion-criterion discipline ADR 0001 describes, reachable at runtime without a rebuild.

§Why they need a roster

Every one of them is read with std::env::var in the process that does the work, and for gglib that process is the daemon. So

GGLIB_DISABLE_AGENTIC_SAMPLING=1 gglib benchmark agentic --model m

sets the variable on a CLI process which resolves no sampling at all. The daemon does, and it never saw it. The switch is silently ignored, the run completes, and the numbers look like an answer.

That is not a hypothetical: it produced two identical arms of an A/B eval that were meant to differ, and the only reason it was caught is that the arms were checked against /proc/<pid>/environ before the run rather than after it. A debugging switch whose failure mode is “quietly changes nothing” is worse than no switch, because it manufactures confident wrong conclusions from real work.

So the daemon reports which of these it actually has in effect, and the CLI compares that against its own environment before handing a command over. A mismatch is stated, not swallowed.

§Why a name list and not typed constants

The switches live in three crates — request_pipeline here, canonicalization/repair in gglib-proxy, command/cache_ram/ kv_cache_type in gglib-runtime — and this crate sits below all of them. Names are the only thing they share. ALL is therefore a hand-written list, which is exactly the shape that rotted in model_service’s AUTO_TAG_NAMES, so all_lists_every_switch_the_tree_reads greps the source tree and fails if the two disagree in either direction.

Constants§

ALL
Every GGLIB_DISABLE_* switch the tree reads.

Functions§

active
The switches set truthy in this process.
describe_mismatch
What the CLI should say when its switches differ from the daemon’s.
enabled
Whether the named environment switch is set to a truthy value now.
is_truthy
Whether an environment value reads as “on”.