Repository navigation
The decision extractor reads its output cap and tunables from the settings catalog - #181
Merged
Merged
Conversation
…tings catalog The model call's cap is LLM_MAX_TOKENS["decision_extract"]. How many earlier decisions the prompt lists and how many close keys the restatement check reads are live settings. The caption length, the outcome limit that mirrors decision.record and the --window-chars floor say why they are not settings. Tests control provider inference through Settings.llm_provider_inferred instead of a private attribute. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…etch bounds it Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
zlareb1
force-pushed
the
fix/decision-extract-gates
branch
from
November 2, 2026 18:21
ca7664e to
527c174
Compare
8 of 9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog category (leave one):
Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):
loom decisions extractreads its reply cap fromLLM_MAX_TOKENS(decision_extract, overridable throughLOOM_LLM_MAX_TOKENS_OVERRIDES), and two new live settings,LOOM_MEMORY_DECISION_EXTRACT_KNOWN_MAXandLOOM_MEMORY_DECISION_EXTRACT_RESTATEMENT_TOP_K, set how many earlier decisions its prompt lists and how many close decision keys its restatement check reads.Why
The decision extractor kept its model output cap and its tunables as module constants, which three unit gates refuse:
test_llm_max_tokens.py(an LLM call's cap is aLLM_MAX_TOKENSentry),test_tunable_constants.py(a tunable number is a setting, or says on its line why it is not one) andtest_tests_patch_only_real_settings.py(a test patches only real settings attributes). Each constant, and what it became:server/memory/app/decision_extract.py::_REPLY_TOKENS(4000)LLM_MAX_TOKENS["decision_extract"], read withllm_max_tokens(...)llm_stage, like every other LLM call's cap; a deployment can override it live. The cap is read once per call; a reply cut at it reports that cap and names the override.server/memory/app/decision_extract.py::_RESTATEMENT_TOP_K(20)memory_decision_extract_restatement_top_k, LIVE, default 20 (the fetch is capped at 500 rows, so a large value ormemory_search_per_key_cap = 0can read fewer keys)server/memory/domain/decision_extract.py::MAX_KNOWN_DECISIONS(30)memory_decision_extract_known_max, LIVE, default 30_known_decisions, which reads the setting.server/memory/domain/decision_extract.py::CAPTION_MAX_CHARS(80)# not a setting:server/memory/domain/decision_extract.py::OUTCOME_MAX_CHARS(1000)# not a setting:DecisionRecordInput.outcome'smax_length;test_the_outcome_limit_is_decision_recordspins the two together.server/cli/decisions.py::_MIN_WINDOW_CHARS(500)# not a setting:--window-charsflag, which the operator already sets per run.The two tests that patched the private
_llm_provider_sourcemeant to control whether the provider was named byLOOM_LLM_PROVIDERor inferred. They now patchSettings.llm_provider_inferred, the method_fake_chosenreads, so a renamed or removed method fails the patch instead of passing silently.Scope and risk
The extractor and its tests, the settings catalog and its generated reference, schema and example file, the live-settings and settings-defaults snapshots and the feature page. Defaults equal the old constants, so behaviour is unchanged. No wire change, no stored data, no tenant-scoping change.
Compatibility, rollout and rollback
LOOM_MEMORY_DECISION_EXTRACT_KNOWN_MAX(30) andLOOM_MEMORY_DECISION_EXTRACT_RESTATEMENT_TOP_K(20), and a newdecision_extractkey forLOOM_LLM_MAX_TOKENS_OVERRIDES. A build that lacks the key logs and ignores it, as does N-1 with the two new settings, so either set during a rolling upgrade is harmless.Tests
pytest tests/unit/test_decision_extract.py tests/unit/test_llm_max_tokens.py tests/unit/test_tunable_constants.py tests/unit/test_tests_patch_only_real_settings.py tests/unit/test_live_settings.py: pass. Newtest_the_prompt_lists_at_most_the_configured_known_decisionsruns the extractor over three recorded decisions with the setting at 2 and checks the prompt lists two;test_a_deployment_cap_reaches_the_call_and_the_cut_reply_names_itsets adecision_extractoverride and checks the call and the cut-reply message both use it; the restatement test sets its top_k to 6 and 5 and checks both the fetch and the key walk read it (a confirmed sixth key blocks at 6, not at 5).make format lint typecheck: clean.pytest tests/unit -q -p no:randomly):25013 passed, 20 skipped, 1 xfailed.scripts.codegen.settings_reference,settings_schema,settings_exampleanddocs_reference.AI assistance in the code (leave one; writing this description with AI is fine):
AI-generated (an agent wrote most of the diff): Claude Code; each constant's use was read before choosing setting or fixed value.
I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist
make format-check,make lint,make typecheckandmake test-unitpass; the integration suite passes if server behaviour changed.docs/reference/configuration.mdand thedocs/reference/tables (python scripts/codegen/docs_reference.py), the reach manifest,schemas/schema.sql(make schema-dump) and the Codex plugin copies (python3 scripts/codegen/agent_plugin_sync.py).main; no merged migration is edited.hooks/,lib/,bin/,skills/,.mcp.json, the Codexplugin-defaults.json) bumps both plugin manifests' version, and no other open PR uses that version.npm --prefix frontend run build) and its tests pass, iffrontend/changed.docs/describe the system as it now is, and this description names any operator steps and wire changes.tests/unit/test_public_copy.py).git commit -s), as CONTRIBUTING.md asks.🤖 Generated with Claude Code