mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-10-07 23:42:21 +02:00
refactor(runtime): one compact-runtime selection rule for route and dispatch
The chat route repeated the compact (clean v3) eligibility decision inline to prepare the turn's context resolution, while the agent loop dispatched on the contract stamp set by a separate, later condition. The two could drift, and already disagreed for a user whose privileges demote the turn to plain chat: the route prepared a compact resolution that no compact runtime used. src/agent_runtime/runtime_selection.py (no imports) now owns the rule: - uses_compact_preview_runtime(): clean route requested, contract policy enabled, agent mode, agent permitted, not an image generation session. - is_compact_preview_contract() and COMPACT_PREVIEW_MODE for the stamp. The route evaluates the rule once, before context preparation, where all of its facts are final (the agent privilege is read through the same _request_privileges helper the later enforcement uses). That one value gates the typed context resolution and is the _clean_v3_preview flag that stamps the contract; inside the agent-contract branch it equals the previous condition, so stamping behavior is unchanged. The agent loop dispatches through is_compact_preview_contract(), and the compact runtime's MODE is the shared constant. A route-level matrix drives the real agent loop and asserts that route preparation and compact dispatch agree for compact, escalated, configured compact/full, regular, TUI, privilege-denied and image-generation turns.
This commit is contained in:
@@ -21,6 +21,7 @@ import httpx
|
||||
import jsonschema
|
||||
|
||||
from src.context_compactor import prune_multimodal_images, trim_for_context
|
||||
from src.agent_runtime.runtime_selection import COMPACT_PREVIEW_MODE
|
||||
from src import agent_runs
|
||||
from src.agent_evidence import command_has_mutation_effect, workspace_artifact_is_usable
|
||||
from src.tool_capabilities import ToolEffect, ToolRunSecurityContext, capabilities_for_action
|
||||
@@ -47,7 +48,7 @@ from src.model_profiles import (
|
||||
)
|
||||
|
||||
ENDPOINT_ID = 'cleanv3'
|
||||
MODE = 'clean_compact_v3_preview'
|
||||
MODE = COMPACT_PREVIEW_MODE
|
||||
|
||||
|
||||
class ProviderStreamError(Exception):
|
||||
|
||||
Reference in New Issue
Block a user