Skip to content

Reject config knobs whose TOML type differs from the knob's declared type - #110

Open
rudycelekli wants to merge 1 commit into
tigerless-labs:mainfrom
rudycelekli:fix/config-knob-types-20261016
Open

rudycelekli wants to merge 1 commit into
tigerless-labs:mainfrom
rudycelekli:fix/config-knob-types-20261016

Conversation

@rudycelekli

@rudycelekli rudycelekli commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Config.load stores whatever TOML value sits under a known knob; only index.vector_enabled and index.vector_model are type-checked afterwards. A mistyped value is therefore accepted silently and misbehaves later:

[manage]
auto_dream = "false"
trigger_min_sessions = "3"
[recall]
default_limit = 2.5

loads on upstream main as 'false', '3', 2.5 (bool(c.manage.auto_dream) is True), so a user who tries to turn automatic dreaming off keeps it on, and the quoted threshold or fractional limit only fails at the first comparison or slice.

Evidence: the new parametrised test test_a_knob_of_the_wrong_type_is_rejected_rather_than_stored fails 6/6 on upstream main (DID NOT RAISE ValueError) and passes with this change.

Change: _load_section rejects a value whose type differs from the knob's declared one (bool only for bool knobs, no bool for numeric knobs, a whole number is still accepted for a decimal knob and stored unchanged so existing recall fingerprints do not move, str for string knobs). The message names the knob (config knob has the wrong type: manage.auto_dream), generalising the existing vector knob checks. Existing configs that match the declared types are unaffected.

Validation: uv run pytest -q tests/unit tests/redteam tests/system -> 883 passed, 4 skipped; ruff check packages tests clean. Not run: mypy, live-host tests; I did not audit third-party stores written by older versions for mistyped knobs, which would now fail to load with the error above instead of being silently misread.

…type

Config.load stored any value under a known knob. A quoted "false" for
manage.auto_dream stayed a truthy string and left automatic dreaming enabled;
a quoted number for a threshold failed later at the first comparison. Only the
two index.vector knobs were type-checked.
@rudycelekli
rudycelekli force-pushed the fix/config-knob-types-20261016 branch from 82d578c to be55bee Compare October 21, 2026 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant