mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-08-27 03:10:41 +02:00
Completes the reviewer requirement from PR #1190 review that was carried over but not implemented in #1230: > "The hard max is a function-local constant. For this setting, the ceiling > should be configurable or at least represented as a named setting/default > with tests." — review on #1190 #1230 shipped the adaptive auto-derivation but left `DEFAULT_HARD_MAX = 200_000` as a hardcoded module constant in src/context_budget.py. Admins on premium APIs with large context windows (kimi-k2 / minimax-m3 at 1M, etc.) can use their full window today only by setting `agent_input_token_budget` explicitly — which then takes them off the adaptive auto-path entirely. ## What this PR changes - src/settings.py: register `agent_input_token_hard_max` in DEFAULT_SETTINGS, default 200_000 (matches `DEFAULT_HARD_MAX`). Inline comment documents the no-op semantics in the explicit branch. - src/agent_loop.py: read the setting at the call site and pass it as the `hard_max` kwarg of `compute_input_token_budget`. Defensive parsing — missing / non-int / zero values fall back to `DEFAULT_HARD_MAX`, so a misconfig cannot silently zero the budget. - src/tool_implementations.py: three friendly aliases for `manage_settings`: - "hard max" -> agent_input_token_hard_max - "token budget cap" -> agent_input_token_hard_max - "input budget cap" -> agent_input_token_hard_max Plus the existing "token budget" -> agent_input_token_budget keeps a matching shorter alias "input budget". - tests/test_context_budget.py: 6 new tests on top of the existing 6: - hard_max raises the auto ceiling (1M ctx + raised cap -> 85% of ctx) - hard_max lowers the auto ceiling (128K ctx + 50K cap -> 50K) - hard_max has no effect on the explicit branch - DEFAULT_SETTINGS contains the new key - manage_settings aliases are registered - the live get_setting path returns the override value, and malformed values fall back per the agent_loop defensive parsing 12 passed in 0.04s. No changes to the pure helper signature or semantics; #1230's behavior is the default when the new setting is unset. ## How it lets users drop the explicit override Before this PR, on a 1M-context model: agent_input_token_budget = 900_000 (explicit) -> 900K [user override] agent_input_token_budget = <unset> (auto) -> 200K [HARD_MAX] After this PR, same model: agent_input_token_budget = <unset> agent_input_token_hard_max = 900_000 -> min(1M * 0.85, 900K) = 850K [auto, no override needed] The explicit-override path keeps working unchanged for users who prefer it. |
||
|---|---|---|
| .. | ||
| search | ||
| action_intents.py | ||
| agent_loop.py | ||
| agent_runs.py | ||
| agent_tools.py | ||
| ai_interaction.py | ||
| api_key_manager.py | ||
| app_helpers.py | ||
| app_initializer.py | ||
| assistant_log.py | ||
| auth_helpers.py | ||
| bg_jobs.py | ||
| bg_monitor.py | ||
| builtin_actions.py | ||
| builtin_mcp.py | ||
| caldav_sync.py | ||
| chat_handler.py | ||
| chat_helpers.py | ||
| chat_processor.py | ||
| chroma_client.py | ||
| cleanup_service.py | ||
| config.py | ||
| constants.py | ||
| context_budget.py | ||
| context_compactor.py | ||
| database.py | ||
| deep_research.py | ||
| document_actions.py | ||
| document_processor.py | ||
| email_thread_parser.py | ||
| embeddings.py | ||
| endpoint_resolver.py | ||
| event_bus.py | ||
| exceptions.py | ||
| goal_based_extractor.py | ||
| integrations.py | ||
| llm_core.py | ||
| markitdown_runtime.py | ||
| mcp_manager.py | ||
| memory.py | ||
| memory_vector.py | ||
| model_context.py | ||
| model_discovery.py | ||
| pdf_form_doc.py | ||
| pdf_forms.py | ||
| pdf_runtime.py | ||
| personal_docs.py | ||
| preset_manager.py | ||
| prompt_security.py | ||
| rag_manager.py | ||
| rag_singleton.py | ||
| rag_vector.py | ||
| rate_limiter.py | ||
| readiness.py | ||
| request_models.py | ||
| research_handler.py | ||
| research_utils.py | ||
| secret_storage.py | ||
| session_actions.py | ||
| settings.py | ||
| settings_scrub.py | ||
| task_endpoint.py | ||
| task_scheduler.py | ||
| teacher_escalation.py | ||
| text_helpers.py | ||
| tool_execution.py | ||
| tool_implementations.py | ||
| tool_index.py | ||
| tool_parsing.py | ||
| tool_schemas.py | ||
| tool_security.py | ||
| topic_analyzer.py | ||
| upload_handler.py | ||
| url_safety.py | ||
| visual_report.py | ||
| webhook_manager.py | ||
| youtube_handler.py | ||