argus-code-review 0.4.0__tar.gz → 0.4.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/CHANGELOG.md +15 -1
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/PKG-INFO +1 -1
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/gemini_runner.py +169 -20
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/graph.py +21 -14
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_gemini_runner.py +120 -7
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_graph_get_llm_temperature.py +9 -8
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_multi_round.py +43 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/.gitignore +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/LICENSE +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/README.md +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/__init__.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/bench.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/bench_default.toml +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/cli.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/config.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/coverage.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/dotenv_utils.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/gemini_cache.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/github_client.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/helpers.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/llm/models.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/llm/output_models.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/llm/pricing.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/llm/usage.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/models.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/openai_client.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/openai_runner.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/pipeline_models.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/precheck/__init__.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/precheck/actions_scanner.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/precheck/engine.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/precheck/eslint_bundle/.gitignore +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/precheck/eslint_bundle/README.md +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/precheck/eslint_bundle/eslint.config.js +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/precheck/eslint_bundle/package-lock.json +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/precheck/eslint_bundle/package.json +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/precheck/js_scanner.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/precheck/migration_scanner.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/precheck/rules/README.md +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/precheck/sarif.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/precheck/scanner_utils.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/precheck/secrets_scanner.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/precheck/shadow.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/precheck/terraform_scanner.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/precheck/workflow_lint_scanner.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/prompts/__init__.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/prompts/pr-review-blocking-validator.md +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/prompts/pr-review-coverage-check.md +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/prompts/pr-review-cross-cutting.md +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/prompts/pr-review-feedback-verifier.md +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/prompts/pr-review-lite.md +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/prompts/pr-review-planner.md +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/prompts/pr-review-preflight-router.md +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/prompts/pr-review-prior-art.md +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/prompts/pr-review-scope.md +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/prompts/pr-review-specialist-deployment.md +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/prompts/pr-review-specialist-frontend.md +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/prompts/pr-review-specialist-infra.md +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/prompts/pr-review-specialist-llm-patterns.md +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/prompts/pr-review-specialist-observability.md +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/prompts/pr-review-specialist-orchestration.md +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/prompts/pr-review-specialist-security.md +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/prompts/pr-review-specialist-slackbot.md +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/prompts/pr-review-specialist-sql.md +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/prompts/pr-review-subagent.md +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/prompts/pr-review-tests-and-docs.md +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/prompts/pr-review-writer.md +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/prompts_runtime.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/repo_provision.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/review_tools.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/runners.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/scope.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/storage/__init__.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/storage/http.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/storage/models.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/storage/precheck.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/storage/resolver.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/storage/session.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/storage/sql.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/storage/sqlite.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/pyproject.toml +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/schema/008_add_code_reviews.sql +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/schema/009_add_reviewer_version.sql +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/schema/010_add_review_patterns.sql +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/schema/011_add_review_progress_columns.sql +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/schema/015_create_agent_runs.sql +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/schema/016_add_agent_runs_failure_reason.sql +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/schema/017_add_precheck_rules.sql +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/schema/018_widen_agent_runs_failure_reason.sql +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/__init__.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/conftest.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/golden/review_response.schema.json +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/storage/__init__.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/storage/test_backend_contract.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/storage/test_http.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/storage/test_models.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/storage/test_resolver.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/storage/test_session.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/storage/test_sql.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/storage/test_sqlite_backend.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_actions_scanner.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_argus_review_local.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_bench.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_bench_config_guard.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_catchup_gate.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_cli_args.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_cli_output_contract.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_cli_post_review.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_cli_preflight.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_cli_prompts.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_config.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_conftest.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_dotenv_utils.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_failure_diagnostics.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_gemini_cache.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_gemini_http_retry.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_github_client_checks_signal.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_github_client_write.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_graph_fetch_diff.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_graph_http_guards.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_graph_precheck.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_graph_preflight_image_bump.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_graph_progress.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_graph_storage_resolution.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_graph_timeout_surfacing.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_js_scanner.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_llm_models.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_llm_models_override.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_llm_pricing.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_migration_scanner.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_models.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_openai_client.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_openai_runner.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_output_models.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_packaging.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_plan_review.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_precheck_engine.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_precheck_engine_integration.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_precheck_sarif.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_precheck_shadow.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_precheck_shadow_integration.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_prompts.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_repo_provision.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_review_patterns_integration.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_review_tools.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_runners_context7.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_runners_context_usage.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_runners_helpers.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_runners_new.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_runners_turn_budget.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_scanner_utils.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_scope.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_scope_gate.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_sdk_bundled_cli_version.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_secrets_scanner.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_specialist_validation.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_stage_costs.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_storage_precheck.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_structured_output_methods.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_terraform_scanner.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_terraform_scanner_integration.py +0 -0
- {argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_workflow_lint_scanner.py +0 -0
|
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.4.2] - 2026-10-29
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- A Gemini `400 INVALID_ARGUMENT` no longer ends the reviewer session on the first occurrence. Argus now logs a key-free, text-free summary of the failing request (message count, approximate size, part kinds and sizes for the last four turns, and anomalies such as empty parts or function calls with no matching result) plus any error `details` the API returned, then retries the same request once after a short pause (`ARGUS_GEMINI_RETRY_INVALID_ARGUMENT_MIN_S` / `_MAX_S`, default 2-5 s). The log records whether the retry recovered, which separates a transient fault from a malformed request. Other 4xx errors still fail immediately.
|
|
15
|
+
|
|
16
|
+
## [0.4.1] - 2026-10-28
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- Rounds that carry dismissals no longer abort with `temperature: Extra inputs are not permitted` (HTTP 400). The `dismiss_match` call (the small Claude Haiku call that maps `--dismiss` text to prior findings) no longer sends `temperature`: with the current `langchain-anthropic`, structured output rejects it, and a failure there aborts the whole review. First-round reviews were unaffected.
|
|
21
|
+
|
|
10
22
|
## [0.4.0] - 2026-10-28
|
|
11
23
|
|
|
12
24
|
### Changed
|
|
@@ -463,7 +475,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
463
475
|
packaged set.
|
|
464
476
|
- `argus --version`, `argus prompts list`, and `argus prompts export`.
|
|
465
477
|
|
|
466
|
-
[Unreleased]: https://github.com/redesignhealth/argus-review/compare/v0.4.
|
|
478
|
+
[Unreleased]: https://github.com/redesignhealth/argus-review/compare/v0.4.1...HEAD
|
|
479
|
+
[0.4.2]: https://github.com/redesignhealth/argus-review/compare/v0.4.1...v0.4.2
|
|
480
|
+
[0.4.1]: https://github.com/redesignhealth/argus-review/compare/v0.4.0...v0.4.1
|
|
467
481
|
[0.4.0]: https://github.com/redesignhealth/argus-review/compare/v0.3.4...v0.4.0
|
|
468
482
|
[0.3.4]: https://github.com/redesignhealth/argus-review/compare/v0.3.3...v0.3.4
|
|
469
483
|
[0.3.3]: https://github.com/redesignhealth/argus-review/compare/v0.3.2...v0.3.3
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: argus-code-review
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.2
|
|
4
4
|
Summary: Self-orchestrated PR review agent using LangGraph + Claude Agent SDK
|
|
5
5
|
Project-URL: Repository, https://github.com/redesignhealth/argus-review
|
|
6
6
|
Project-URL: Issues, https://github.com/redesignhealth/argus-review/issues
|
|
@@ -426,6 +426,113 @@ def _failure_detail(exc: BaseException) -> str:
|
|
|
426
426
|
return detail
|
|
427
427
|
|
|
428
428
|
|
|
429
|
+
_INVALID_ARGUMENT_RETRY_MIN_S = 2.0
|
|
430
|
+
_INVALID_ARGUMENT_RETRY_MAX_S = 5.0
|
|
431
|
+
_SHAPE_TAIL_CONTENTS = 4
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
def _is_invalid_argument(exc: BaseException) -> bool:
|
|
435
|
+
"""True for a Gemini ``400 INVALID_ARGUMENT`` API answer."""
|
|
436
|
+
code, status = _error_code_status(exc)
|
|
437
|
+
return code == 400 and (status or "").upper() == "INVALID_ARGUMENT"
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
def _part_shape(part: Any) -> str:
|
|
441
|
+
"""Kind and size of one content part -- never its text."""
|
|
442
|
+
call = getattr(part, "function_call", None)
|
|
443
|
+
if call is not None:
|
|
444
|
+
size = len(json.dumps(call.args or {}, default=str))
|
|
445
|
+
return f"call:{call.name}({size})"
|
|
446
|
+
resp = getattr(part, "function_response", None)
|
|
447
|
+
if resp is not None:
|
|
448
|
+
# An empty result reports size 0 so _describe_request can flag it. The
|
|
449
|
+
# runner wraps every tool output as {"result": output}, so unwrap it.
|
|
450
|
+
payload = resp.response
|
|
451
|
+
if isinstance(payload, dict) and set(payload) == {"result"}:
|
|
452
|
+
payload = payload["result"]
|
|
453
|
+
size = len(json.dumps(payload, default=str)) if payload else 0
|
|
454
|
+
return f"result:{resp.name}({size})"
|
|
455
|
+
text = getattr(part, "text", None)
|
|
456
|
+
if text is not None:
|
|
457
|
+
tag = "thought" if getattr(part, "thought", False) else "text"
|
|
458
|
+
return f"{tag}({len(text)})"
|
|
459
|
+
return type(part).__name__
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
def _describe_request(contents: list[Any], config: Any = None) -> str:
|
|
463
|
+
"""Key-free, text-free summary of a request for diagnosing a 400.
|
|
464
|
+
|
|
465
|
+
Gemini's INVALID_ARGUMENT body carries no field name, so this records the
|
|
466
|
+
structure that could make a request malformed: roles, part kinds and sizes
|
|
467
|
+
for the last few turns, plus anomalies (empty parts, unanswered function
|
|
468
|
+
calls, consecutive same-role turns).
|
|
469
|
+
"""
|
|
470
|
+
total = 0
|
|
471
|
+
biggest = 0
|
|
472
|
+
anomalies: list[str] = []
|
|
473
|
+
prev_role = None
|
|
474
|
+
for i, content in enumerate(contents):
|
|
475
|
+
parts = list(content.parts or [])
|
|
476
|
+
if not parts:
|
|
477
|
+
anomalies.append(f"empty-content@{i}")
|
|
478
|
+
calls = results = 0
|
|
479
|
+
for part in parts:
|
|
480
|
+
shape = _part_shape(part)
|
|
481
|
+
size = int(m.group(1)) if (m := re.search(r"\((\d+)\)$", shape)) else 0
|
|
482
|
+
total += size
|
|
483
|
+
biggest = max(biggest, size)
|
|
484
|
+
if shape.startswith("call:"):
|
|
485
|
+
calls += 1
|
|
486
|
+
elif shape.startswith("result:"):
|
|
487
|
+
results += 1
|
|
488
|
+
if size == 0 and shape.startswith(("text", "thought", "result")):
|
|
489
|
+
anomalies.append(f"zero-size-{re.split(r'[:(]', shape)[0]}@{i}")
|
|
490
|
+
if prev_role is not None and content.role == prev_role:
|
|
491
|
+
anomalies.append(f"repeated-role-{content.role}@{i}")
|
|
492
|
+
prev_role = content.role
|
|
493
|
+
nxt = contents[i + 1] if i + 1 < len(contents) else None
|
|
494
|
+
if calls and nxt is not None:
|
|
495
|
+
answered = sum(
|
|
496
|
+
1 for p in (nxt.parts or []) if getattr(p, "function_response", None) is not None
|
|
497
|
+
)
|
|
498
|
+
if answered != calls:
|
|
499
|
+
anomalies.append(f"calls({calls})!=results({answered})@{i}")
|
|
500
|
+
tail = contents[-_SHAPE_TAIL_CONTENTS:]
|
|
501
|
+
first = len(contents) - len(tail)
|
|
502
|
+
tail_desc = "; ".join(
|
|
503
|
+
f"#{first + j} {c.role}[{', '.join(_part_shape(p) for p in (c.parts or []))}]"
|
|
504
|
+
for j, c in enumerate(tail)
|
|
505
|
+
)
|
|
506
|
+
cfg = ""
|
|
507
|
+
if config is not None:
|
|
508
|
+
cfg = (
|
|
509
|
+
f" tools={len(getattr(config, 'tools', None) or [])}"
|
|
510
|
+
f" system_instruction={bool(getattr(config, 'system_instruction', None))}"
|
|
511
|
+
f" cached_content={bool(getattr(config, 'cached_content', None))}"
|
|
512
|
+
)
|
|
513
|
+
return (
|
|
514
|
+
f"contents={len(contents)} approx_chars={total} largest_part={biggest}{cfg} "
|
|
515
|
+
f"anomalies={anomalies or 'none'} tail: {tail_desc}"
|
|
516
|
+
)
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
def _safe_describe_request(contents: list[Any], config: Any) -> str:
|
|
520
|
+
"""``_describe_request`` that can never mask the error being diagnosed."""
|
|
521
|
+
try:
|
|
522
|
+
return _describe_request(contents, config)
|
|
523
|
+
except Exception as exc: # noqa: BLE001 - diagnostics must not replace the 400
|
|
524
|
+
return f"unavailable ({type(exc).__name__})"
|
|
525
|
+
|
|
526
|
+
|
|
527
|
+
def _error_details(exc: BaseException) -> str:
|
|
528
|
+
"""Scrubbed ``details`` payload of an API error (may name the bad field)."""
|
|
529
|
+
details = getattr(exc, "details", None)
|
|
530
|
+
try:
|
|
531
|
+
return _scrub(json.dumps(details, default=str)) if details else ""
|
|
532
|
+
except (TypeError, ValueError):
|
|
533
|
+
return ""
|
|
534
|
+
|
|
535
|
+
|
|
429
536
|
# Matches the fenced-json extraction argus.helpers.parse_review_result
|
|
430
537
|
# already applies for the Claude path.
|
|
431
538
|
_FENCED_JSON_RE = re.compile(r"```(?:json)?\s*(\{.*?\})\s*```", re.DOTALL)
|
|
@@ -965,26 +1072,68 @@ async def _run_turns(
|
|
|
965
1072
|
_turn,
|
|
966
1073
|
_scrub(str(exc)),
|
|
967
1074
|
)
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
1075
|
+
if not _is_invalid_argument(exc):
|
|
1076
|
+
raise
|
|
1077
|
+
# A 400 INVALID_ARGUMENT names no field, so record the
|
|
1078
|
+
# request's shape, then retry this SAME request once:
|
|
1079
|
+
# whether it recovers tells a transient fault from a
|
|
1080
|
+
# deterministic one.
|
|
1081
|
+
logger.error(
|
|
1082
|
+
"Gemini 400 request shape [%s] (turn=%d) details=%s: %s",
|
|
1083
|
+
label or "unlabeled",
|
|
1084
|
+
_turn,
|
|
1085
|
+
_error_details(exc) or "none",
|
|
1086
|
+
_safe_describe_request(contents, config),
|
|
1087
|
+
)
|
|
1088
|
+
lo = _env_float(
|
|
1089
|
+
"ARGUS_GEMINI_RETRY_INVALID_ARGUMENT_MIN_S",
|
|
1090
|
+
_INVALID_ARGUMENT_RETRY_MIN_S,
|
|
1091
|
+
)
|
|
1092
|
+
hi = _env_float(
|
|
1093
|
+
"ARGUS_GEMINI_RETRY_INVALID_ARGUMENT_MAX_S",
|
|
1094
|
+
_INVALID_ARGUMENT_RETRY_MAX_S,
|
|
1095
|
+
)
|
|
1096
|
+
await asyncio.sleep(
|
|
1097
|
+
random.uniform(lo, max(lo, hi)) # noqa: S311 - jitter, not security
|
|
1098
|
+
)
|
|
1099
|
+
try:
|
|
1100
|
+
response = await client.aio.models.generate_content(
|
|
1101
|
+
model=model, contents=contents, config=config
|
|
1102
|
+
)
|
|
1103
|
+
except Exception as retry_exc:
|
|
1104
|
+
logger.error(
|
|
1105
|
+
"Gemini 400 retry failed [%s] (turn=%d): %s",
|
|
1106
|
+
label or "unlabeled",
|
|
1107
|
+
_turn,
|
|
1108
|
+
_scrub(str(retry_exc)),
|
|
1109
|
+
)
|
|
1110
|
+
raise
|
|
1111
|
+
logger.warning(
|
|
1112
|
+
"Gemini 400 recovered on retry [%s] (turn=%d): the failure "
|
|
1113
|
+
"was transient, not a malformed request",
|
|
1114
|
+
label or "unlabeled",
|
|
1115
|
+
_turn,
|
|
1116
|
+
)
|
|
1117
|
+
else:
|
|
1118
|
+
logger.warning(
|
|
1119
|
+
"Gemini cache [%s] appears invalid upstream (role=%s); "
|
|
1120
|
+
"invalidating the local record and retrying this turn "
|
|
1121
|
+
"uncached: %s",
|
|
1122
|
+
label or "unlabeled",
|
|
1123
|
+
entry.role,
|
|
1124
|
+
exc,
|
|
1125
|
+
)
|
|
1126
|
+
await asyncio.to_thread(
|
|
1127
|
+
_invalidate_cache_record,
|
|
1128
|
+
entry=entry,
|
|
1129
|
+
model=model,
|
|
1130
|
+
system_prompt=system_prompt,
|
|
1131
|
+
)
|
|
1132
|
+
cached_content_name = None
|
|
1133
|
+
config = _build_config(None)
|
|
1134
|
+
response = await client.aio.models.generate_content(
|
|
1135
|
+
model=model, contents=contents, config=config
|
|
1136
|
+
)
|
|
988
1137
|
|
|
989
1138
|
progress.responses += 1
|
|
990
1139
|
usage = response.usage_metadata
|
|
@@ -522,8 +522,12 @@ async def _apply_dismissals(
|
|
|
522
522
|
"or -1 if it doesn't match any finding."
|
|
523
523
|
)
|
|
524
524
|
|
|
525
|
+
# No `temperature`: with langchain-anthropic 1.7.7 (anthropic 2.3.0), structured output on this
|
|
526
|
+
# call sends it in a way the Anthropic API rejects ("temperature: Extra inputs are not
|
|
527
|
+
# permitted", HTTP 400), and a failure here aborts the whole review. The matching task
|
|
528
|
+
# is deterministic enough without it.
|
|
525
529
|
llm = _get_llm(
|
|
526
|
-
f"anthropic:{CLAUDE_MINI}", "dismiss_match", max_tokens=1024
|
|
530
|
+
f"anthropic:{CLAUDE_MINI}", "dismiss_match", max_tokens=1024
|
|
527
531
|
).with_structured_output(DismissMatches)
|
|
528
532
|
result = await llm.ainvoke([{"role": "user", "content": prompt}])
|
|
529
533
|
|
|
@@ -1037,7 +1041,8 @@ _TEMPERATURE_UNSUPPORTED_MODELS: frozenset[str] = (
|
|
|
1037
1041
|
# set on the assumption Anthropic's temperature deprecation
|
|
1038
1042
|
# applies across the Sonnet line, not per-checkpoint; re-verify
|
|
1039
1043
|
# empirically and correct this comment if that assumption turns
|
|
1040
|
-
# out wrong. claude-haiku-4-5 (CLAUDE_MINI) accepts it fine
|
|
1044
|
+
# out wrong. claude-haiku-4-5 (CLAUDE_MINI) accepts it fine on plain
|
|
1045
|
+
# requests (not with structured output, see _apply_dismissals), so
|
|
1041
1046
|
# is deliberately not included here -- see the explicit
|
|
1042
1047
|
# exclusion below for why "not included" alone isn't enough.
|
|
1043
1048
|
ALIAS_MAP["claude-frontier"],
|
|
@@ -1046,18 +1051,20 @@ _TEMPERATURE_UNSUPPORTED_MODELS: frozenset[str] = (
|
|
|
1046
1051
|
CLAUDE_DEFAULT,
|
|
1047
1052
|
}
|
|
1048
1053
|
)
|
|
1049
|
-
# Explicit exclusion, not just an absent literal: without this, an
|
|
1050
|
-
#
|
|
1051
|
-
#
|
|
1052
|
-
#
|
|
1053
|
-
#
|
|
1054
|
-
#
|
|
1055
|
-
#
|
|
1056
|
-
#
|
|
1057
|
-
#
|
|
1058
|
-
#
|
|
1059
|
-
#
|
|
1060
|
-
#
|
|
1054
|
+
# Explicit exclusion, not just an absent literal: without this, an override that
|
|
1055
|
+
# happens to land CLAUDE_DEFAULT/CLAUDE_FRONTIER on CLAUDE_MINI's own resolved value
|
|
1056
|
+
# (e.g. `--specialist-model claude-haiku-4-5`, used directly by this suite's own
|
|
1057
|
+
# tests) would pull that value into the union above via the
|
|
1058
|
+
# CLAUDE_DEFAULT/CLAUDE_FRONTIER terms, silently stripping `temperature` from any plain
|
|
1059
|
+
# `_get_llm(f"anthropic:{CLAUDE_MINI}", ..., temperature=...)` call that has nothing
|
|
1060
|
+
# to do with the override. `- {CLAUDE_MINI}` guarantees CLAUDE_MINI's resolved value
|
|
1061
|
+
# can never end up in this set.
|
|
1062
|
+
#
|
|
1063
|
+
# `_apply_dismissals`, the former user of such a call, no longer passes `temperature`
|
|
1064
|
+
# at all: structured output on Haiku is rejected with langchain-anthropic 1.7.7
|
|
1065
|
+
# (HTTP 400, "temperature: Extra inputs are not permitted"). `langchain-anthropic` is
|
|
1066
|
+
# unpinned above 1.2.0, so re-check this before relying on `temperature` together
|
|
1067
|
+
# with structured output.
|
|
1061
1068
|
- {CLAUDE_MINI}
|
|
1062
1069
|
)
|
|
1063
1070
|
|
|
@@ -33,7 +33,12 @@ from google.genai import errors as genai_errors # noqa: E402
|
|
|
33
33
|
from google.genai import types # noqa: E402
|
|
34
34
|
|
|
35
35
|
from argus.bench import BenchEntry # noqa: E402
|
|
36
|
-
from argus.gemini_runner import
|
|
36
|
+
from argus.gemini_runner import ( # noqa: E402
|
|
37
|
+
_MAX_TURNS_GEMINI,
|
|
38
|
+
_describe_request,
|
|
39
|
+
_safe_describe_request,
|
|
40
|
+
run_session_gemini,
|
|
41
|
+
)
|
|
37
42
|
from argus.llm.models import resolve as resolve_alias # noqa: E402
|
|
38
43
|
from argus.runners import _TURN_BUDGET_SYSTEM_PROMPT_LINE # noqa: E402
|
|
39
44
|
|
|
@@ -65,7 +70,7 @@ def _isolate_gemini_cache_dir(tmp_path: Any, monkeypatch: pytest.MonkeyPatch) ->
|
|
|
65
70
|
|
|
66
71
|
monkeypatch.setenv("ARGUS_GEMINI_CACHE_DIR", str(tmp_path / "gemini-cache"))
|
|
67
72
|
# Existing tests must not sleep through the real retry cooldown.
|
|
68
|
-
for name in ("RATE_LIMIT", "COOLDOWN"):
|
|
73
|
+
for name in ("RATE_LIMIT", "COOLDOWN", "INVALID_ARGUMENT"):
|
|
69
74
|
monkeypatch.setenv(f"ARGUS_GEMINI_RETRY_{name}_MIN_S", "0")
|
|
70
75
|
monkeypatch.setenv(f"ARGUS_GEMINI_RETRY_{name}_MAX_S", "0")
|
|
71
76
|
clear_settings_cache()
|
|
@@ -1601,10 +1606,13 @@ class TestCacheInvalidatedUpstreamDegradesGracefully:
|
|
|
1601
1606
|
repo_root="/tmp/does-not-need-to-exist",
|
|
1602
1607
|
)
|
|
1603
1608
|
|
|
1604
|
-
# Not retried uncached
|
|
1605
|
-
#
|
|
1606
|
-
#
|
|
1607
|
-
|
|
1609
|
+
# Not retried uncached: the one retry a 400 INVALID_ARGUMENT gets
|
|
1610
|
+
# re-sends the exact same request (cache reference included), unlike
|
|
1611
|
+
# the cache-invalid-recovery test above, which drops the cache.
|
|
1612
|
+
calls = fake_client.aio.models.generate_content.await_args_list
|
|
1613
|
+
assert len(calls) == 2
|
|
1614
|
+
assert calls[0].kwargs["config"].cached_content == "cachedContents/abc123"
|
|
1615
|
+
assert calls[1].kwargs["config"].cached_content == "cachedContents/abc123"
|
|
1608
1616
|
assert result.failure_reason == "worker_crashed"
|
|
1609
1617
|
assert result.result_text == ""
|
|
1610
1618
|
|
|
@@ -1807,7 +1815,7 @@ class TestTransientRetry:
|
|
|
1807
1815
|
[
|
|
1808
1816
|
(401, "UNAUTHENTICATED"),
|
|
1809
1817
|
(403, "PERMISSION_DENIED"),
|
|
1810
|
-
(400, "
|
|
1818
|
+
(400, "FAILED_PRECONDITION"),
|
|
1811
1819
|
(404, "NOT_FOUND"),
|
|
1812
1820
|
],
|
|
1813
1821
|
)
|
|
@@ -1818,6 +1826,49 @@ class TestTransientRetry:
|
|
|
1818
1826
|
assert result.failure_reason == "worker_crashed"
|
|
1819
1827
|
assert result.failure_detail == f"{code} {status}, turn 0"
|
|
1820
1828
|
|
|
1829
|
+
async def test_invalid_argument_logs_request_shape_and_retries_once(
|
|
1830
|
+
self, caplog: pytest.LogCaptureFixture
|
|
1831
|
+
) -> None:
|
|
1832
|
+
ok = _make_response(calls=[], usage=_make_usage(1, 1), text="fine")
|
|
1833
|
+
client = _make_fake_client([_api_error(400, "INVALID_ARGUMENT"), ok])
|
|
1834
|
+
with caplog.at_level("INFO", logger="argus.gemini_runner"):
|
|
1835
|
+
result = await _run(client)
|
|
1836
|
+
assert result.failure_reason is None
|
|
1837
|
+
assert client.aio.models.generate_content.await_count == 2
|
|
1838
|
+
messages = [r.message for r in caplog.records]
|
|
1839
|
+
assert any("Gemini 400 request shape [retry-test] (turn=0)" in m for m in messages)
|
|
1840
|
+
assert any("Gemini 400 recovered on retry [retry-test]" in m for m in messages)
|
|
1841
|
+
|
|
1842
|
+
async def test_describer_failure_does_not_skip_the_retry(self) -> None:
|
|
1843
|
+
ok = _make_response(calls=[], usage=_make_usage(1, 1), text="fine")
|
|
1844
|
+
client = _make_fake_client([_api_error(400, "INVALID_ARGUMENT"), ok])
|
|
1845
|
+
with patch("argus.gemini_runner._describe_request", side_effect=ValueError("odd args")):
|
|
1846
|
+
result = await _run(client)
|
|
1847
|
+
assert result.failure_reason is None
|
|
1848
|
+
assert client.aio.models.generate_content.await_count == 2
|
|
1849
|
+
|
|
1850
|
+
async def test_inverted_retry_bounds_do_not_crash(
|
|
1851
|
+
self, monkeypatch: pytest.MonkeyPatch
|
|
1852
|
+
) -> None:
|
|
1853
|
+
monkeypatch.setenv("ARGUS_GEMINI_RETRY_INVALID_ARGUMENT_MIN_S", "0.02")
|
|
1854
|
+
monkeypatch.setenv("ARGUS_GEMINI_RETRY_INVALID_ARGUMENT_MAX_S", "0")
|
|
1855
|
+
ok = _make_response(calls=[], usage=_make_usage(1, 1), text="fine")
|
|
1856
|
+
client = _make_fake_client([_api_error(400, "INVALID_ARGUMENT"), ok])
|
|
1857
|
+
result = await _run(client)
|
|
1858
|
+
assert result.failure_reason is None
|
|
1859
|
+
|
|
1860
|
+
async def test_invalid_argument_failing_twice_fails_session_after_one_retry(
|
|
1861
|
+
self, caplog: pytest.LogCaptureFixture
|
|
1862
|
+
) -> None:
|
|
1863
|
+
err = _api_error(400, "INVALID_ARGUMENT")
|
|
1864
|
+
client = _make_fake_client([err, err, err])
|
|
1865
|
+
with caplog.at_level("INFO", logger="argus.gemini_runner"):
|
|
1866
|
+
result = await _run(client)
|
|
1867
|
+
assert client.aio.models.generate_content.await_count == 2
|
|
1868
|
+
assert result.failure_reason == "worker_crashed"
|
|
1869
|
+
assert result.failure_detail == "400 INVALID_ARGUMENT, turn 0"
|
|
1870
|
+
assert any("Gemini 400 retry failed [retry-test]" in r.message for r in caplog.records)
|
|
1871
|
+
|
|
1821
1872
|
async def test_httpx_connect_error_is_retried(self) -> None:
|
|
1822
1873
|
ok = _make_response(calls=[], usage=_make_usage(1, 1), text="fine")
|
|
1823
1874
|
client = _make_fake_client([httpx.ConnectError("reset"), ok])
|
|
@@ -1988,3 +2039,65 @@ class TestTransientRetry:
|
|
|
1988
2039
|
text = " ".join(r.getMessage() for r in caplog.records)
|
|
1989
2040
|
assert secret not in text
|
|
1990
2041
|
assert len(text) < 1200
|
|
2042
|
+
|
|
2043
|
+
|
|
2044
|
+
class TestDescribeRequest:
|
|
2045
|
+
async def test_summarises_shape_without_leaking_text(self) -> None:
|
|
2046
|
+
contents = [
|
|
2047
|
+
types.Content(role="user", parts=[types.Part.from_text(text="SECRETBODY" * 50)]),
|
|
2048
|
+
types.Content(
|
|
2049
|
+
role="model",
|
|
2050
|
+
parts=[types.Part.from_function_call(name="grep", args={"pattern": "x"})],
|
|
2051
|
+
),
|
|
2052
|
+
types.Content(role="user", parts=[types.Part.from_text(text="")]),
|
|
2053
|
+
]
|
|
2054
|
+
out = _describe_request(contents)
|
|
2055
|
+
assert "SECRETBODY" not in out
|
|
2056
|
+
assert "contents=3" in out
|
|
2057
|
+
assert "call:grep(" in out
|
|
2058
|
+
assert "calls(1)!=results(0)@1" in out # the call was never answered
|
|
2059
|
+
assert "zero-size-text@2" in out
|
|
2060
|
+
|
|
2061
|
+
async def test_clean_request_reports_no_anomalies(self) -> None:
|
|
2062
|
+
contents = [
|
|
2063
|
+
types.Content(role="user", parts=[types.Part.from_text(text="hi")]),
|
|
2064
|
+
types.Content(
|
|
2065
|
+
role="model",
|
|
2066
|
+
parts=[types.Part.from_function_call(name="grep", args={"pattern": "x"})],
|
|
2067
|
+
),
|
|
2068
|
+
types.Content(
|
|
2069
|
+
role="user",
|
|
2070
|
+
parts=[types.Part.from_function_response(name="grep", response={"output": "ok"})],
|
|
2071
|
+
),
|
|
2072
|
+
]
|
|
2073
|
+
assert "anomalies=none" in _describe_request(contents)
|
|
2074
|
+
|
|
2075
|
+
async def test_empty_tool_result_is_flagged(self) -> None:
|
|
2076
|
+
contents = [
|
|
2077
|
+
types.Content(
|
|
2078
|
+
role="model",
|
|
2079
|
+
parts=[types.Part.from_function_call(name="grep", args={"pattern": "x"})],
|
|
2080
|
+
),
|
|
2081
|
+
types.Content(
|
|
2082
|
+
role="user",
|
|
2083
|
+
parts=[types.Part.from_function_response(name="grep", response={})],
|
|
2084
|
+
),
|
|
2085
|
+
]
|
|
2086
|
+
assert "zero-size-result@1" in _describe_request(contents)
|
|
2087
|
+
|
|
2088
|
+
async def test_empty_wrapped_tool_result_is_flagged(self) -> None:
|
|
2089
|
+
contents = [
|
|
2090
|
+
types.Content(
|
|
2091
|
+
role="user",
|
|
2092
|
+
parts=[types.Part.from_function_response(name="grep", response={"result": ""})],
|
|
2093
|
+
),
|
|
2094
|
+
]
|
|
2095
|
+
assert "zero-size-result@0" in _describe_request(contents)
|
|
2096
|
+
|
|
2097
|
+
async def test_first_turn_without_role_is_not_a_repeat(self) -> None:
|
|
2098
|
+
contents = [types.Content(role=None, parts=[types.Part.from_text(text="hi")])]
|
|
2099
|
+
assert "repeated-role" not in _describe_request(contents)
|
|
2100
|
+
|
|
2101
|
+
async def test_safe_describe_never_raises(self) -> None:
|
|
2102
|
+
out = _safe_describe_request(object(), None)
|
|
2103
|
+
assert out.startswith("unavailable (")
|
|
@@ -188,14 +188,15 @@ def test_temperature_guard_does_not_swallow_claude_mini_when_specialist_model_co
|
|
|
188
188
|
was over-inclusive. Setting ARGUS_SPECIALIST_MODEL=claude-haiku-4-5 makes
|
|
189
189
|
CLAUDE_DEFAULT resolve to the SAME value as CLAUDE_MINI, pulling
|
|
190
190
|
CLAUDE_MINI's own resolved value into _TEMPERATURE_UNSUPPORTED_MODELS via
|
|
191
|
-
the CLAUDE_DEFAULT term of the union.
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
invariant this set's own comment
|
|
196
|
-
(CLAUDE_MINI) accepts it fine
|
|
197
|
-
|
|
198
|
-
what prevents
|
|
191
|
+
the CLAUDE_DEFAULT term of the union. A plain
|
|
192
|
+
`_get_llm(f"anthropic:{CLAUDE_MINI}", ..., temperature=0)` call (this was
|
|
193
|
+
the dismissal-index matcher, which no longer passes temperature because
|
|
194
|
+
Haiku structured output rejects it) would then have its temperature
|
|
195
|
+
silently stripped, breaking the invariant this set's own comment
|
|
196
|
+
documents ("claude-haiku-4-5 (CLAUDE_MINI) accepts it fine on plain
|
|
197
|
+
requests, so is deliberately not included here"). The explicit
|
|
198
|
+
`- {CLAUDE_MINI}` exclusion in the set's construction is what prevents
|
|
199
|
+
this.
|
|
199
200
|
"""
|
|
200
201
|
overridden_set = _temperature_unsupported_models_under_override(CLAUDE_MINI)
|
|
201
202
|
assert CLAUDE_MINI not in overridden_set
|
|
@@ -7,6 +7,7 @@ round 2 writer messages, and model contracts.
|
|
|
7
7
|
from __future__ import annotations
|
|
8
8
|
|
|
9
9
|
import importlib
|
|
10
|
+
import inspect
|
|
10
11
|
import json
|
|
11
12
|
import sys
|
|
12
13
|
from unittest.mock import AsyncMock, MagicMock, patch
|
|
@@ -1174,6 +1175,48 @@ class TestApplyDismissals:
|
|
|
1174
1175
|
assert matched[0].description == "except Exception"
|
|
1175
1176
|
assert matched[0].dismissed_by == "user1"
|
|
1176
1177
|
|
|
1178
|
+
@pytest.mark.asyncio
|
|
1179
|
+
async def test_dismiss_match_call_sends_no_temperature(self) -> None:
|
|
1180
|
+
"""The dismiss_match LLM call must not pass `temperature`.
|
|
1181
|
+
|
|
1182
|
+
With structured output, the current langchain-anthropic request is rejected by the
|
|
1183
|
+
Anthropic API when a temperature is set ("temperature: Extra inputs are not
|
|
1184
|
+
permitted", HTTP 400), and a failure here aborts the whole review.
|
|
1185
|
+
"""
|
|
1186
|
+
_reload_graph()
|
|
1187
|
+
from argus.graph import _apply_dismissals
|
|
1188
|
+
from argus.graph import _get_llm as _get_llm_fn
|
|
1189
|
+
|
|
1190
|
+
from pydantic import BaseModel
|
|
1191
|
+
|
|
1192
|
+
class DismissMatch(BaseModel):
|
|
1193
|
+
dismiss_index: int
|
|
1194
|
+
finding_index: int
|
|
1195
|
+
|
|
1196
|
+
class DismissMatches(BaseModel):
|
|
1197
|
+
matches: list[DismissMatch]
|
|
1198
|
+
|
|
1199
|
+
findings = [PriorFinding(severity="BLOCKING", description="issue")]
|
|
1200
|
+
dismissals = [DismissedFinding(description="issue", dismissed_by="u", reason="r")]
|
|
1201
|
+
|
|
1202
|
+
mock_structured = MagicMock()
|
|
1203
|
+
mock_structured.ainvoke = AsyncMock(
|
|
1204
|
+
return_value=DismissMatches(matches=[DismissMatch(dismiss_index=0, finding_index=0)])
|
|
1205
|
+
)
|
|
1206
|
+
mock_llm = MagicMock()
|
|
1207
|
+
mock_llm.with_structured_output = MagicMock(return_value=mock_structured)
|
|
1208
|
+
|
|
1209
|
+
with patch("argus.graph._get_llm", return_value=mock_llm) as mock_get_llm:
|
|
1210
|
+
await _apply_dismissals(findings, dismissals)
|
|
1211
|
+
|
|
1212
|
+
mock_get_llm.assert_called_once()
|
|
1213
|
+
mock_llm.with_structured_output.assert_called_once()
|
|
1214
|
+
bound = inspect.signature(_get_llm_fn).bind(
|
|
1215
|
+
*mock_get_llm.call_args.args, **mock_get_llm.call_args.kwargs
|
|
1216
|
+
)
|
|
1217
|
+
assert bound.arguments["stage"] == "dismiss_match"
|
|
1218
|
+
assert "temperature" not in bound.arguments
|
|
1219
|
+
|
|
1177
1220
|
@pytest.mark.asyncio
|
|
1178
1221
|
async def test_out_of_range_indices_ignored(self) -> None:
|
|
1179
1222
|
"""Matches with out-of-range indices are silently skipped."""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/precheck/eslint_bundle/eslint.config.js
RENAMED
|
File without changes
|
{argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/precheck/eslint_bundle/package-lock.json
RENAMED
|
File without changes
|
{argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/precheck/eslint_bundle/package.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/prompts/pr-review-blocking-validator.md
RENAMED
|
File without changes
|
{argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/prompts/pr-review-coverage-check.md
RENAMED
|
File without changes
|
{argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/prompts/pr-review-cross-cutting.md
RENAMED
|
File without changes
|
{argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/prompts/pr-review-feedback-verifier.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/prompts/pr-review-preflight-router.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/prompts/pr-review-specialist-deployment.md
RENAMED
|
File without changes
|
{argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/prompts/pr-review-specialist-frontend.md
RENAMED
|
File without changes
|
{argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/prompts/pr-review-specialist-infra.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/prompts/pr-review-specialist-security.md
RENAMED
|
File without changes
|
{argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/prompts/pr-review-specialist-slackbot.md
RENAMED
|
File without changes
|
{argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/prompts/pr-review-specialist-sql.md
RENAMED
|
File without changes
|
|
File without changes
|
{argus_code_review-0.4.0 → argus_code_review-0.4.2}/argus/prompts/pr-review-tests-and-docs.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{argus_code_review-0.4.0 → argus_code_review-0.4.2}/schema/011_add_review_progress_columns.sql
RENAMED
|
File without changes
|
|
File without changes
|
{argus_code_review-0.4.0 → argus_code_review-0.4.2}/schema/016_add_agent_runs_failure_reason.sql
RENAMED
|
File without changes
|
|
File without changes
|
{argus_code_review-0.4.0 → argus_code_review-0.4.2}/schema/018_widen_agent_runs_failure_reason.sql
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/golden/review_response.schema.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_github_client_checks_signal.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_graph_preflight_image_bump.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_precheck_engine_integration.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_precheck_shadow_integration.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_review_patterns_integration.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{argus_code_review-0.4.0 → argus_code_review-0.4.2}/tests/test_terraform_scanner_integration.py
RENAMED
|
File without changes
|
|
File without changes
|