diff --git a/.gitignore b/.gitignore index 89374c5465..08dd66e705 100644 --- a/.gitignore +++ b/.gitignore @@ -108,3 +108,8 @@ credentials.json # LangGraph API server .langgraph_api/ + +# Reports (generated artifacts only — anchored to repo root) +/report*.md +/report*.json +/report*.sarif diff --git a/README.md b/README.md index c2e7ee4f8d..0446401e19 100644 --- a/README.md +++ b/README.md @@ -293,6 +293,13 @@ skillspector scan ./my-skill/ export SKILLSPECTOR_PROVIDER=codex_cli skillspector scan ./my-skill/ +# Gemini (via OpenAI compatibility layer) +export SKILLSPECTOR_PROVIDER=openai +export OPENAI_API_KEY="YOUR_GEMINI_API_KEY" +export OPENAI_BASE_URL="https://generativelanguage.googleapis.com/v1beta/openai/" +export SKILLSPECTOR_MODEL=gemini-3.5-flash +skillspector scan ./my-skill/ + # Local Ollama — no API key export SKILLSPECTOR_PROVIDER=ollama # export OLLAMA_BASE_URL=http://localhost:11434/v1 # shown default diff --git a/model_registry.yaml b/model_registry.yaml index e1c2b8c696..3c8d6f575f 100644 --- a/model_registry.yaml +++ b/model_registry.yaml @@ -40,3 +40,7 @@ models: "openai/openai/gpt-5.3-chat": context_length: 128000 max_output_tokens: 16384 + + "gemini-3.5-flash": + context_length: 1048576 + max_output_tokens: 65536 diff --git a/src/skillspector/cli.py b/src/skillspector/cli.py index 345dfd8d8e..3293d44163 100644 --- a/src/skillspector/cli.py +++ b/src/skillspector/cli.py @@ -24,9 +24,11 @@ import json import os import sys +import warnings from copy import deepcopy from dataclasses import dataclass, field, replace from enum import StrEnum +from functools import partial from hashlib import sha256 from pathlib import Path from time import monotonic @@ -35,6 +37,9 @@ import typer from langchain_core.runnables import RunnableConfig from rich.console import Console +from rich.progress import BarColumn, Progress, SpinnerColumn, TextColumn, TimeElapsedColumn +from rich.text import Text +from rich.tree import Tree from skillspector import __version__, transitive from skillspector.cleanup import cleanup_result @@ -54,7 +59,7 @@ from skillspector.mcp_registry import scan_registry from skillspector.models import Finding from skillspector.multi_skill import MultiSkillDetectionResult, SkillDirectory, detect_skills -from skillspector.nodes.analyzers import ANALYZER_MODULES +from skillspector.nodes.analyzers import ANALYZER_MODULES, ANALYZER_NODE_IDS from skillspector.nodes.report import report from skillspector.sarif_models import SARIF_SCHEMA_URI, validate_sarif_report from skillspector.semantic_runtime import ( @@ -104,6 +109,8 @@ def _ensure_utf8_streams() -> None: console = Console() err_console = Console(stderr=True) +_PROGRESS_TREE_MAX_PATHS = 200 +_PROGRESS_TREE_MAX_NODES = 1_000 _TRANSITIVE_MAX_TARGETS = 32 _TRANSITIVE_MAX_BYTES = 10 * 1024 * 1024 _TRANSITIVE_MAX_SECONDS = MAX_WORKFLOW_SECONDS @@ -1273,6 +1280,72 @@ def _scope_finding(finding: Finding) -> Finding: ) +def _visible_terminal_text(value: str) -> str: + """Render untrusted path text without passing terminal control characters.""" + visible: list[str] = [] + for character in value: + if character.isprintable(): + visible.append(character) + continue + codepoint = ord(character) + if codepoint <= 0xFF: + visible.append(f"\\x{codepoint:02x}") + elif codepoint <= 0xFFFF: + visible.append(f"\\u{codepoint:04x}") + else: + visible.append(f"\\U{codepoint:08x}") + return "".join(visible) + + +def _discovered_files_tree(paths: list[str]) -> Tree: + """Build a literal, control-safe tree for paths from an untrusted bundle.""" + tree = Tree(Text("Discovered Files to Scan", style="bold blue")) + nodes = {"": tree} + ordered_paths = sorted(dict.fromkeys(paths)) + displayed_paths = 0 + node_count = 1 + for path in ordered_paths[:_PROGRESS_TREE_MAX_PATHS]: + parts = Path(path).parts + current = "" + path_complete = True + for index, part in enumerate(parts): + parent = current + current = f"{current}/{part}" if current else part + if current in nodes: + continue + if node_count >= _PROGRESS_TREE_MAX_NODES: + path_complete = False + break + is_file = index == len(parts) - 1 + icon = "📄 " if is_file else "📁 " + style = "green" if is_file else "cyan" + label = Text(f"{icon}{_visible_terminal_text(part)}", style=style) + nodes[current] = nodes[parent].add(label) + node_count += 1 + if not path_complete: + break + displayed_paths += 1 + + omitted_paths = len(ordered_paths) - displayed_paths + if omitted_paths: + noun = "path" if omitted_paths == 1 else "paths" + tree.add( + Text( + f"… {omitted_paths} additional {noun} omitted", + style="dim yellow", + ) + ) + return tree + + +def _wired_analyzer_node_ids() -> frozenset[str]: + """Return only analyzers present in the compiled graph.""" + graph_nodes = getattr(graph, "nodes", {}) + if not isinstance(graph_nodes, dict): + return frozenset(ANALYZER_NODE_IDS) + return frozenset(node_id for node_id in ANALYZER_NODE_IDS if node_id in graph_nodes) + + def _run_graph_scan( input_path: str, format: FormatChoice, @@ -1283,6 +1356,7 @@ def _run_graph_scan( transitive_traversal: _TransitiveTraversalState | None = None, initial_inspection_ledger: list[dict[str, object]] | None = None, source_local_only: bool = False, + stream_progress: bool = False, ) -> dict[str, object]: state = _scan_state( input_path=input_path, @@ -1298,7 +1372,82 @@ def _run_graph_scan( if initial_inspection_ledger: state["inspection_ledger"] = initial_inspection_ledger trace_config = _build_trace_config(input_path, format, no_llm) - return cast(dict[str, object], graph.invoke(state, config=trace_config)) + if not stream_progress: + return cast(dict[str, object], graph.invoke(state, config=trace_config)) + + analyzer_node_ids = _wired_analyzer_node_ids() + total_analyzers = len(analyzer_node_ids) + total_steps = 5 + total_analyzers + result = dict(state) + + with ( + warnings.catch_warnings(), + Progress( + SpinnerColumn(), + TextColumn("[progress.description]{task.description}"), + BarColumn(), + TextColumn("[progress.percentage]{task.percentage:>3.0f}%"), + TimeElapsedColumn(), + console=err_console, + transient=True, + ) as progress, + ): + warnings.filterwarnings("ignore", category=UserWarning, module="pydantic") + task_id = progress.add_task("Resolving input...", total=total_steps) + num_files = 0 + analyzers_done = 0 + + stream = graph.stream( + state, + config=trace_config, + stream_mode=["updates", "values"], + ) + for stream_mode, chunk in stream: + if stream_mode == "values": + if isinstance(chunk, dict): + result = dict(chunk) + continue + if stream_mode != "updates" or not isinstance(chunk, dict): + continue + + for node_name, node_output in chunk.items(): + progress.advance(task_id) + if not isinstance(node_output, dict): + continue + + if node_name == "resolve_input": + progress.update(task_id, description="Building context...") + elif node_name == "build_context": + raw_components = node_output.get("components") + components = raw_components if isinstance(raw_components, list) else [] + paths = sorted(str(path) for path in components) + num_files = len(paths) + progress.update( + task_id, + description=( + f"Analyzing {num_files} files (0/{total_analyzers} rules applied)..." + ), + ) + + err_console.print(_discovered_files_tree(paths)) + err_console.print() + elif node_name in analyzer_node_ids: + analyzers_done += 1 + progress.update( + task_id, + description=( + f"Analyzing {num_files} files " + f"({analyzers_done}/{total_analyzers} rules applied)..." + ), + ) + err_console.print(f"[dim]✔ Rule completed: {node_name}[/dim]") + elif node_name == "meta_analyzer": + progress.update(task_id, description="Generating report...") + err_console.print( + "[dim]✔ Rule completed: meta_analyzer (filtering findings)[/dim]" + ) + + return result def _run_graph_scan_for_source( @@ -1311,11 +1460,15 @@ def _run_graph_scan_for_source( transitive_traversal: _TransitiveTraversalState | None = None, initial_inspection_ledger: list[dict[str, object]] | None = None, source_local_only: bool = False, + stream_progress: bool = False, ) -> dict[str, object]: """Invoke a scan without widening the legacy call contract for public sources.""" + run_graph_scan = ( + partial(_run_graph_scan, stream_progress=True) if stream_progress else _run_graph_scan + ) if initial_inspection_ledger is not None: if source_local_only: - return _run_graph_scan( + return run_graph_scan( input_path=input_path, format=format, no_llm=no_llm, @@ -1326,7 +1479,7 @@ def _run_graph_scan_for_source( initial_inspection_ledger=initial_inspection_ledger, source_local_only=True, ) - return _run_graph_scan( + return run_graph_scan( input_path=input_path, format=format, no_llm=no_llm, @@ -1337,7 +1490,7 @@ def _run_graph_scan_for_source( initial_inspection_ledger=initial_inspection_ledger, ) if source_local_only: - return _run_graph_scan( + return run_graph_scan( input_path=input_path, format=format, no_llm=no_llm, @@ -1347,7 +1500,7 @@ def _run_graph_scan_for_source( transitive_traversal=transitive_traversal, source_local_only=True, ) - return _run_graph_scan( + return run_graph_scan( input_path=input_path, format=format, no_llm=no_llm, @@ -2009,6 +2162,7 @@ def _scan_skill( ) if transitive_enabled and transitive_traversal is None: transitive_traversal = _TransitiveTraversalState(cache=transitive_cache or {}) + stream_progress = not verbose and err_console.is_terminal if pre_scan_ledger_events: result = _run_graph_scan_for_source( input_path=input_path, @@ -2020,6 +2174,7 @@ def _scan_skill( transitive_traversal=transitive_traversal, initial_inspection_ledger=pre_scan_ledger_events, source_local_only=source_local_only, + stream_progress=stream_progress, ) else: result = _run_graph_scan_for_source( @@ -2031,6 +2186,7 @@ def _scan_skill( show_suppressed=show_suppressed, transitive_traversal=transitive_traversal, source_local_only=source_local_only, + stream_progress=stream_progress, ) if not transitive_enabled: return result diff --git a/src/skillspector/providers/openai/model_registry.yaml b/src/skillspector/providers/openai/model_registry.yaml index a4d2606721..17cde09b39 100644 --- a/src/skillspector/providers/openai/model_registry.yaml +++ b/src/skillspector/providers/openai/model_registry.yaml @@ -12,3 +12,7 @@ models: "gpt-5.4": context_length: 1000000 max_output_tokens: 128000 + + "gemini-3.5-flash": + context_length: 1048576 + max_output_tokens: 65536 diff --git a/tests/integration/test_stream_invoke_parity.py b/tests/integration/test_stream_invoke_parity.py new file mode 100644 index 0000000000..b675d84ef8 --- /dev/null +++ b/tests/integration/test_stream_invoke_parity.py @@ -0,0 +1,84 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Parity test for the interactive stream and direct invoke graph paths. + +The CLI ``scan`` command has two code paths: + - ``--verbose``: uses ``graph.invoke()`` → returns full final state. + - interactive default: uses ``graph.stream()`` for progress and returns the + final ``values`` state. + +The stream path must preserve the complete state because the CLI and transitive +scanner consume much more than the rendered report. +""" + +from __future__ import annotations + +import json +from pathlib import Path + +import pytest + +from skillspector.cli import FormatChoice, _run_graph_scan + +# Keys the CLI reads from the result dict *after* the graph run. +# Derived from cli.py: _write_result, _cleanup_result, exit-code check. +_CLI_CONSUMED_KEYS = frozenset( + { + "report_body", + "sarif_report", + "risk_score", + "temp_dir_for_cleanup", + "execution_successful", + "analysis_completeness", + "findings", + "filtered_findings", + "effective_finding_ids", + } +) + + +@pytest.mark.integration +def test_stream_and_invoke_produce_same_cli_keys(tmp_path: Path) -> None: + """Non-verbose (stream) result contains every key that verbose (invoke) produces and the CLI consumes.""" + (tmp_path / "SKILL.md").write_text( + "---\nname: parity-test\n---\n# Safe skill\n", encoding="utf-8" + ) + invoke_result = _run_graph_scan( + input_path=str(tmp_path), + format=FormatChoice.json, + no_llm=True, + ) + stream_result = _run_graph_scan( + input_path=str(tmp_path), + format=FormatChoice.json, + no_llm=True, + stream_progress=True, + ) + + assert set(stream_result) == set(invoke_result) + + # Every key the CLI consumes must be present in *both* results. + for key in _CLI_CONSUMED_KEYS: + assert key in invoke_result, f"invoke result missing CLI key: {key}" + assert key in stream_result, f"stream result missing CLI key: {key}" + + # Reports carry per-run timestamps, so compare their public structure. + invoke_report = json.loads(invoke_result["report_body"]) + stream_report = json.loads(stream_result["report_body"]) + assert set(invoke_report) == set(stream_report) + + for key in ("risk_score", "sarif_report", "temp_dir_for_cleanup", "execution_successful"): + assert invoke_result.get(key) == stream_result.get(key) diff --git a/tests/nodes/analyzers/test_sc8_shipped_bytecode.py b/tests/nodes/analyzers/test_sc8_shipped_bytecode.py index b004df497a..0485f64a5e 100644 --- a/tests/nodes/analyzers/test_sc8_shipped_bytecode.py +++ b/tests/nodes/analyzers/test_sc8_shipped_bytecode.py @@ -69,7 +69,7 @@ def test_sc8_single_pyc_blocks_install_and_cli_exit(tmp_path: Path) -> None: ) assert result.exit_code == 1, result.output - report = json.loads(result.output) + report = json.loads(result.stdout) assert report["risk_assessment"]["score"] >= 51 assert report["risk_assessment"]["severity"] in {"HIGH", "CRITICAL"} assert report["risk_assessment"]["recommendation"] == "DO_NOT_INSTALL" diff --git a/tests/unit/test_cli.py b/tests/unit/test_cli.py index 75ede38c9f..3f48265919 100644 --- a/tests/unit/test_cli.py +++ b/tests/unit/test_cli.py @@ -23,6 +23,7 @@ from collections.abc import Callable, Iterator from contextlib import AbstractContextManager, ExitStack, contextmanager, nullcontext from importlib import import_module +from io import StringIO from pathlib import Path from types import SimpleNamespace from typing import Any, cast @@ -31,6 +32,7 @@ import pytest import typer import yaml +from rich.console import Console from typer.testing import CliRunner from skillspector import __version__, cli, transitive @@ -92,6 +94,119 @@ def test_cli_version() -> None: assert "v" in result.output +def test_discovered_files_tree_renders_untrusted_names_literally() -> None: + """File names cannot inject Rich markup or terminal control sequences.""" + malicious_name = "\x1b]52;c;SGVsbG8=\x1b\\[conceal]hidden.py" + nested_path = str(Path("folder") / malicious_name) + output = StringIO() + render_console = Console(file=output, force_terminal=True, color_system=None) + + render_console.print(cli._discovered_files_tree([nested_path])) + + rendered = output.getvalue() + assert "\x1b]52" not in rendered + assert "\\x1b]52;c;SGVsbG8=\\x1b\\[conceal]hidden.py" in rendered + assert "📁 folder" in rendered + assert "📄 " in rendered + + +def test_discovered_files_tree_bounds_untrusted_output( + monkeypatch: pytest.MonkeyPatch, +) -> None: + monkeypatch.setattr(cli, "_PROGRESS_TREE_MAX_PATHS", 1) + output = StringIO() + render_console = Console(file=output, force_terminal=True, color_system=None) + + render_console.print(cli._discovered_files_tree(["a.py", "b.py"])) + + rendered = output.getvalue() + assert "a.py" in rendered + assert "b.py" not in rendered + assert "1 additional path omitted" in rendered + + +def test_progress_counts_only_analyzers_wired_into_the_graph( + monkeypatch: pytest.MonkeyPatch, +) -> None: + monkeypatch.setattr(cli, "ANALYZER_NODE_IDS", ["wired", "unavailable"]) + monkeypatch.setattr(cli, "graph", SimpleNamespace(nodes={"wired": object()})) + + assert cli._wired_analyzer_node_ids() == frozenset({"wired"}) + + +def test_stream_progress_returns_complete_values_state( + monkeypatch: pytest.MonkeyPatch, +) -> None: + final_state = { + "report_body": "{}", + "analysis_completeness": {"is_complete": True}, + "filtered_findings": [], + "inspection_ledger": [{"phase": "complete"}], + "provider_cache": {"preserved": True}, + } + + def fake_stream( + state: dict[str, object], + config: object, + stream_mode: list[str], + ) -> Iterator[tuple[str, dict[str, object]]]: + del state, config + assert stream_mode == ["updates", "values"] + yield "updates", {"build_context": {"components": []}} + yield "values", final_state + + monkeypatch.setattr( + cli, + "graph", + SimpleNamespace(nodes={}, stream=fake_stream), + ) + + result = cli._run_graph_scan( + input_path="SKILL.md", + format=FormatChoice.json, + no_llm=True, + stream_progress=True, + ) + + assert result == final_state + + +@pytest.mark.parametrize( + ("terminal", "verbose", "expected"), + [(True, False, True), (False, False, False), (True, True, False)], +) +def test_scan_streams_only_for_interactive_default( + monkeypatch: pytest.MonkeyPatch, + terminal: bool, + verbose: bool, + expected: bool, +) -> None: + calls: list[bool] = [] + + def fake_run_graph_scan_for_source(**kwargs: object) -> dict[str, object]: + calls.append(bool(kwargs["stream_progress"])) + return {"risk_score": 0} + + monkeypatch.setattr(cli, "_run_graph_scan_for_source", fake_run_graph_scan_for_source) + monkeypatch.setattr(cli.err_console, "_force_terminal", terminal) + + cli._scan_skill( + input_path="SKILL.md", + format=FormatChoice.json, + no_llm=True, + baseline=None, + yara_rules_dir=None, + verbose=verbose, + show_suppressed=False, + transitive_enabled=False, + transitive_depth=1, + transitive_allow_prefix=None, + transitive_deny_prefix=None, + ) + + assert calls == [expected] + + def test_cli_scan_help_lists_every_available_provider() -> None: """Built-in help names every provider accepted by the selector.""" result = runner.invoke(app, ["scan", "--help"]) @@ -184,13 +299,15 @@ def test_cli_writes_report_then_exits_two_for_execution_failure( """An incomplete execution preserves the report but takes precedence over risk.""" (tmp_path / "SKILL.md").write_text("# Safe", encoding="utf-8") output = tmp_path / "report.json" + fake_result = { + "report_body": '{"execution_successful": false}', + "execution_successful": False, + "risk_score": 0, + } + monkeypatch.setattr("skillspector.cli.graph.invoke", lambda state, config: fake_result) monkeypatch.setattr( - "skillspector.cli.graph.invoke", - lambda state, config: { - "report_body": '{"execution_successful": false}', - "execution_successful": False, - "risk_score": 0, - }, + "skillspector.cli.graph.stream", + lambda state, config, stream_mode: iter([{"meta_analyzer": fake_result}]), ) result = runner.invoke(app, ["scan", str(tmp_path), "-f", "json", "-o", str(output)]) @@ -580,7 +697,7 @@ def test_cli_scan_slack_p6_pe3_regression(tmp_path: Path) -> None: result = runner.invoke(app, ["scan", str(tmp_path), "--format", "json", "--no-llm"]) assert result.exit_code == 0, result.output - issues = json.loads(result.output)["issues"] + issues = json.loads(result.stdout)["issues"] assert [issue for issue in issues if issue["id"] == "P6"] == [] pe3 = next(issue for issue in issues if issue["id"] == "PE3") assert {"contextual-triage", "likely-benign-context"} <= set(pe3["tags"]) @@ -604,7 +721,7 @@ def test_cli_scan_required_table_keeps_malicious_pe3(tmp_path: Path) -> None: result = runner.invoke(app, ["scan", str(tmp_path), "--format", "json", "--no-llm"]) assert result.exit_code in {0, 1}, result.output - issues = json.loads(result.output)["issues"] + issues = json.loads(result.stdout)["issues"] assert any(issue["id"] == "PE3" for issue in issues) @@ -851,7 +968,7 @@ def test_cli_baseline_generate_then_scan_round_trip(tmp_path: Path) -> None: ], ) assert scan.exit_code == 0 - data = json.loads(scan.output) + data = json.loads(scan.stdout) assert data["issues"] == [] assert data["risk_assessment"]["score"] == 0 @@ -927,7 +1044,7 @@ def test_cli_scan_excludes_selected_baseline_inside_skill(tmp_path: Path) -> Non ) assert result.exit_code == 0, result.output - data = json.loads(result.output) + data = json.loads(result.stdout) assert data["issues"] == [] assert [finding["id"] for finding in data["suppressed"]] == ["PE5"] assert data["suppressed"][0]["location"]["file"] == "SKILL.md" @@ -1010,7 +1127,7 @@ def test_cli_scan_excludes_only_the_selected_baseline(tmp_path: Path) -> None: ) assert result.exit_code in {0, 1}, result.output - data = json.loads(result.output) + data = json.loads(result.stdout) pe5_files = { finding["location"]["file"] for finding in data["issues"] if finding["id"] == "PE5" } @@ -1067,7 +1184,7 @@ def test_recursive_single_skill_scan_still_accepts_baseline(tmp_path: Path) -> N ) assert result.exit_code == 0, result.output - assert [issue for issue in json.loads(result.output)["issues"] if issue["id"] == "P1"] == [] + assert [issue for issue in json.loads(result.stdout)["issues"] if issue["id"] == "P1"] == [] def test_scan_multi_skill_markdown_output_to_file( @@ -2055,31 +2172,39 @@ def test_cli_scan_json_preserves_single_skill_contract( skill_dir.mkdir() (skill_dir / "SKILL.md").write_text("---\nname: single-skill\n---\n# Single", encoding="utf-8") + fake_result = { + "report_body": json.dumps( + { + "skill": { + "name": "single-skill", + "source": str(skill_dir), + "scanned_at": "2026-06-29T13:00:00+00:00", + }, + "risk_assessment": { + "score": 30, + "severity": "LOW", + "recommendation": "SAFE", + }, + "components": [{"path": "root.py", "type": "python"}], + "issues": [{"id": "X-1", "severity": "low"}], + "suppressed_count": 0, + "suppressed": [], + "metadata": {"scan_scope": {"components_scanned": 1}}, + } + ) + } + def fake_invoke(state: dict[str, Any], config: Any = None) -> dict[str, Any]: assert state["input_path"] == str(skill_dir) - return { - "report_body": json.dumps( - { - "skill": { - "name": "single-skill", - "source": str(skill_dir), - "scanned_at": "2026-06-29T13:00:00+00:00", - }, - "risk_assessment": { - "score": 30, - "severity": "LOW", - "recommendation": "SAFE", - }, - "components": [{"path": "root.py", "type": "python"}], - "issues": [{"id": "X-1", "severity": "low"}], - "suppressed_count": 0, - "suppressed": [], - "metadata": {"scan_scope": {"components_scanned": 1}}, - } - ) - } + return fake_result - monkeypatch.setattr("skillspector.cli.graph", SimpleNamespace(invoke=fake_invoke)) + def fake_stream(state: dict[str, Any], config: Any = None, stream_mode: str | None = None): + assert state["input_path"] == str(skill_dir) + yield {"meta_analyzer": fake_result} + + monkeypatch.setattr( + "skillspector.cli.graph", SimpleNamespace(invoke=fake_invoke, stream=fake_stream) + ) out_file = tmp_path / "single.json" result = runner.invoke( diff --git a/tests/unit/test_providers.py b/tests/unit/test_providers.py index 11dd04c384..5c0852bc00 100644 --- a/tests/unit/test_providers.py +++ b/tests/unit/test_providers.py @@ -325,6 +325,8 @@ def test_metadata_known_model(self) -> None: provider = OpenAIProvider() assert provider.get_context_length("gpt-5.4") == 1_000_000 assert provider.get_max_output_tokens("gpt-5.4") == 128_000 + assert provider.get_context_length("gemini-3.5-flash") == 1_048_576 + assert provider.get_max_output_tokens("gemini-3.5-flash") == 65_536 class TestAnthropicProvider: