diff --git a/src/agent_loop.py b/src/agent_loop.py index ebf9a88b6..4ee3e6dce 100644 --- a/src/agent_loop.py +++ b/src/agent_loop.py @@ -25430,16 +25430,19 @@ async def stream_agent_loop( if schema.get("function", {}).get("name") not in disabled_tools and schema.get("name") not in disabled_tools ] - if _pure_web_turn and tool_surface != "full" and not (route_state.get("spec_surface") and os.getenv("ODYSSEUS_SPEC_MODE", "strict").strip().lower() == "strict"): - allowed = _web_only_route_tools(_last_user, disabled_tools) - schemas = [ - schema for schema in schemas - if ( - schema.get("function", {}).get("name") - or schema.get("name") - ) in allowed - or schema.get("function", {}).get("name") in external_names - ] + if _pure_web_turn and tool_surface != "full": + strict_spec = (route_state.get("spec_surface") and + os.getenv("ODYSSEUS_SPEC_MODE", "strict").strip().lower() == "strict") + if not strict_spec: + allowed = _web_only_route_tools(_last_user, disabled_tools) + schemas = [ + schema for schema in schemas + if ( + schema.get("function", {}).get("name") + or schema.get("name") + ) in allowed + or schema.get("function", {}).get("name") in external_names + ] schemas = _drop_legacy_email_alias_schemas_when_mcp_available(schemas) schemas = _apply_tool_surface_to_schemas(schemas, tool_surface) if ( diff --git a/src/context_compactor.py b/src/context_compactor.py index 1137fe7f6..e90d63420 100644 --- a/src/context_compactor.py +++ b/src/context_compactor.py @@ -634,8 +634,16 @@ async def maybe_compact( ) # Use utility model if configured, otherwise fall back to session model - # Compact with the chat model itself (the one being evaluated), never a separate utility model. - compact_url, compact_model, compact_headers = endpoint_url, model, headers + util_url, util_model, util_headers = resolve_endpoint( + "utility", + fallback_url=endpoint_url, + fallback_model=model, + fallback_headers=headers, + owner=owner, + ) + compact_url = util_url or endpoint_url + compact_model = util_model or model + compact_headers = util_headers if util_url else headers prompt = SELF_SUMMARY_SYSTEM_PROMPT.replace( "{count}", str(len(older))