Skip to content

Recover agy answers from the envelope response, not stripped structured_output (#2049) - #2050

Merged
wwind123 merged 1 commit into
mainfrom
agent-loop/managed-2049
Nov 21, 2026
Merged

wwind123 merged 1 commit into
mainfrom
agent-loop/managed-2049

Conversation

@wwind123

Copy link
Copy Markdown
Owner

Summary

agy's structured_output keeps only the properties the request schema declares. Because of that, every structured Antigravity turn was rebuilt from {schema_version, kind, state} alone, and the summary and findings were lost. This PR implements the approved plan for #2049.

  • Dispatch: eligible structured turns pass --output-format json and no longer pass --json-schema, and no schema file is written. The capability probe now needs only --output-format. If an operator passes --output-format or --json-schema through, the legacy response-file channel is still used. The oversized-prompt directive now asks for exactly one JSON object.

  • Answer precedence: a non-SUCCESS envelope still returns the provider error and recovers nothing. Otherwise the order is:

    1. A non-empty response file.
    2. Exactly one top-level JSON object of the expected kind (or agent_unavailable), bare or fenced, taken from the envelope response. Code appends the footer, using the payload's own state, and the signature.
    3. The marker or stdout text.

    agy's own structured_output is never used as the answer.

  • Ambiguity: candidates are counted over the whole response, before any marker handling. Any of these is a typed, tool-authored antigravity_structured_ambiguity on AgentResult:

    • two or more objects;
    • one object of another kind, or with no kind;
    • a footer outside the object whose state contradicts it.

    validated_agent.py records this as an agent-unavailable format failure. It feeds the Antigravity: use agy --json-schema structured output, and fall back to the next model on repeated format failures #2029 per-model format accounting (format-fallback), with no repair and no classification from model text.

  • Bare approval: the strict parsers already reject an envelope-only review. However, require_recoverable_review_substance still let {schema_version, kind, state} through to repair. It now refuses that payload for pr_review and plan_review from any source.

  • Docs: updated the architecture detail doc, its decision log, the CLI guide's Structured output section, the README and the CLI help.

Tests

  • tests/test_antigravity.py: the stripped structured_output case uses the live-check envelope shape. Also covers dispatch flags with no schema file, the probe, legacy and off modes, recovery from fenced or bare objects amid prose noise, a footer quoted inside the payload, blank-state fallthrough, response-file precedence, non-SUCCESS envelopes, the ambiguity cases (including an object on each side of the marker), the format-fallback chain with provider-like words in rejected payloads, trusted classification text, and a bare approval producing no approval and no repair call.
  • tests/test_repair.py: the envelope-only gate and the strict-parser rejection.
  • The focused modules and the full suite pass under agent-loop run-tests.

Fixes #2049

🤖 Generated with Claude Code

AGENT_MANAGED_CI_UNPROTECTED_OVERRIDE_V1 nonce=IT8WgIxs4aIe6CtKCa3o2GrY

…tured_output (#2049)

agy's structured_output keeps only the properties the request schema
declares, so the loose schema stripped summary and findings from every
structured Antigravity turn.

- Dispatch --output-format json without --json-schema; the capability
  probe needs only --output-format; operator pass-through of either flag
  still keeps the legacy channel. structured_output is never the answer.
- Precedence: response file, then exactly one expected-kind (or
  agent_unavailable) top-level JSON object in the envelope response,
  rendered with footer and signature in code, then the marker text.
- Several candidate objects (counted over the whole response), a wrong
  kind, or a contradicting out-of-span footer is a typed tool-authored
  ambiguity on AgentResult; the validated turn records it as a format
  failure (#2029 accounting, format-fallback) with no repair and no
  classification from model text.
- Reviewer repair refuses envelope-only {schema_version, kind, state}
  payloads, so a bare approval can never be repaired into a review.
- Docs and decision log describe the new channel.

Refs #2049

Agent-Issue-Provenance: v1 repo=wwind123/coding-review-agent-loop issue=2049 flow=approved plan=6152e3aad2cedb9a

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wwind123 wwind123 added the agent-loop-managed agent-loop managed CI label Nov 21, 2026
@wwind123

Copy link
Copy Markdown
Owner Author

Agent-loop managed-CI authorization record (machine-readable). Binds issue #2049 to pull request #2050 at head c4ace39. Not an agent response; keep this comment.

@wwind123

Copy link
Copy Markdown
Owner Author

Expected closing issues for PR #2050: #2049.

Origin flow: approved-plan-implementation
Contract hash: ebd98300b527c1a48dc239878759f831b2739125645c7cbda34b258e0f1a3cf2

-- coding-review-agent-loop

@wwind123

Copy link
Copy Markdown
Owner Author

Issue implementation

Implemented the approved plan for #2049 in draft PR #2050. Structured agy turns now request --output-format json with no --json-schema, and agy's key-stripped structured_output is never used as the answer. The answer is the response file, else the single expected-kind JSON object recovered from the envelope response (footer and signature added in code), else the marker text. Response text with several objects, a wrong kind, or a contradicting footer is a typed, trusted format failure that feeds the #2029 format-fallback accounting, with no repair. Reviewer repair now refuses envelope-only {schema_version, kind, state} payloads. Docs and the decision log are updated. To stay under the 64 KB doc-size test limit, the architecture detail paragraph was condensed and no longer mentions the #2039 replay; the CLI guide still covers it. Test choice: the focused modules cover the changed backend, validated turn, repair gate and docs. The full suite also ran, because validated_agent.py is shared by every role and the plan's verification step asked for it. Both runs passed.

Result

Pull request reported: #2050.

Tests run

  • /home/wwind123/tools/coding-review-agent-loop/.venv/bin/python -m pytest tests/test_antigravity.py tests/test_antigravity_quota_groups.py tests/test_validated_agent_recovery.py tests/test_repair.py tests/test_docs_guidance.py tests/test_architecture_set_validation.py -q (agent-loop instrumented; whole-command timeout 1800s)
  • /home/wwind123/tools/coding-review-agent-loop/.venv/bin/python -m pytest tests/ -q (agent-loop instrumented; whole-command timeout 1800s)

Test observation receipts

  • '<path-sha256:d094488e6a9166dc>' -m pytest tests/test_antigravity.py tests/test_antigravity_quota_groups.py tests/test_validated_agent_recovery.py tests/test_repair.py tests/test_docs_guidance.py tests/test_architecture_set_validation.py -q — receipt c27822afed1f48f79a1e3fbed731279a — current-result (verified against the parent journal; CI remains authoritative)
  • '<path-sha256:d094488e6a9166dc>' -m pytest tests/ -q — receipt c2266e709f434a62a7bb9a3d05aeb5cf — current-result (verified against the parent journal; CI remains authoritative)
  • '<path-sha256:d094488e6a9166dc>' -m pytest tests/test_antigravity.py tests/test_antigravity_quota_groups.py tests/test_validated_agent_recovery.py tests/test_repair.py tests/test_docs_guidance.py tests/test_architecture_set_validation.py -q — receipt 9b2686a0512647c28772e6dfcce5f9a0 — historical failure at an obsolete tree (not an outstanding obligation) failed

Risk-based mode and transition test matrix evidence

  • Matrix identity: 3c82dee5139b8da984e40a4ac2ad0a4e461a0d3bb7b28ef2b01b7811e28f8eb3
Full matrix evidence (10 rows)
  • ambiguous-candidates — verified
    • Tests: tests/test_antigravity.py::test_recovery_ambiguity_carries_only_a_reason_code_and_count, tests/test_antigravity.py::test_backend_ambiguous_response_returns_empty_text_and_a_typed_diagnostic
    • Locations: tests/test_antigravity.py
    • Workflow path: recover_response_payload and AntigravityBackend.run for a SUCCESS envelope with ambiguous response text
    • Expected outcome assertions: Two fences, objects across the marker, a stray object, wrong or missing kind, and a contradicting footer yield AmbiguousPayload with the fixed reason and count; Backend returns empty text and the typed diagnostic
    • Forbidden-effect assertions: Diagnostic contains no model text; Neither object, including the one after the marker, is selected
    • Evidence citations: /home/wwind123/tools/coding-review-agent-loop/.venv/bin/python -m pytest tests/test_antigravity.py tests/test_antigravity_quota_groups.py tests/test_validated_agent_recovery.py tests/test_repair.py tests/test_docs_guidance.py tests/test_architecture_set_validation.py -q [c27822afed1f48f79a1e3fbed731279a; current-result]; /home/wwind123/tools/coding-review-agent-loop/.venv/bin/python -m pytest tests/ -q [c2266e709f434a62a7bb9a3d05aeb5cf; current-result]
  • ambiguous-format-accounting — verified
    • Tests: tests/test_antigravity.py::test_ambiguity_is_a_trusted_format_failure_that_falls_back_down_the_chain, tests/test_antigravity.py::test_ambiguity_classification_text_is_only_the_trusted_diagnostic
    • Locations: tests/test_antigravity.py
    • Workflow path: run_validated_agent for Antigravity with a two-model chain receiving ambiguous envelopes
    • Expected outcome assertions: Model A fails twice as a format failure and the turn falls back to Model B, which is accepted; Failure category is agent-unavailable and classification text equals the trusted diagnostic
    • Forbidden-effect assertions: attempt_repair is never called; classify_antigravity_capacity and _agent_failure_classification are never called; The empty-response branch is not taken
    • Evidence citations: /home/wwind123/tools/coding-review-agent-loop/.venv/bin/python -m pytest tests/test_antigravity.py tests/test_antigravity_quota_groups.py tests/test_validated_agent_recovery.py tests/test_repair.py tests/test_docs_guidance.py tests/test_architecture_set_validation.py -q [c27822afed1f48f79a1e3fbed731279a; current-result]; /home/wwind123/tools/coding-review-agent-loop/.venv/bin/python -m pytest tests/ -q [c2266e709f434a62a7bb9a3d05aeb5cf; current-result]
  • bare-approval-gate — verified
    • Tests: tests/test_antigravity.py::test_bare_approved_envelope_payload_never_yields_an_approval, tests/test_repair.py::test_envelope_only_reviewer_payload_is_refused_repair, tests/test_repair.py::test_envelope_only_approval_fails_the_strict_parsers
    • Locations: tests/test_antigravity.py, tests/test_repair.py
    • Workflow path: require_recoverable_review_substance and run_validated_agent reviewer turns for pr_review and plan_review
    • Expected outcome assertions: Envelope-only payloads are refused with ReviewSubstanceIntegrityError; The validated turn raises agent-unavailable with no approval
    • Forbidden-effect assertions: attempt_repair is never called; No approval is recorded
    • Evidence citations: /home/wwind123/tools/coding-review-agent-loop/.venv/bin/python -m pytest tests/test_antigravity.py tests/test_antigravity_quota_groups.py tests/test_validated_agent_recovery.py tests/test_repair.py tests/test_docs_guidance.py tests/test_architecture_set_validation.py -q [c27822afed1f48f79a1e3fbed731279a; current-result]; /home/wwind123/tools/coding-review-agent-loop/.venv/bin/python -m pytest tests/ -q [c2266e709f434a62a7bb9a3d05aeb5cf; current-result]
  • dispatch-no-schema — verified
    • Tests: tests/test_antigravity.py::test_stripped_structured_output_never_displaces_the_response_payload, tests/test_antigravity.py::test_capability_probe_runs_once_when_supported, tests/test_antigravity.py::test_capability_probe_needs_only_output_format, tests/test_antigravity.py::test_validated_turn_threads_eligibility_into_the_agy_argv
    • Locations: tests/test_antigravity.py
    • Workflow path: AntigravityBackend.run builds the agy argv for an eligible structured kind after the capability probe
    • Expected outcome assertions: --output-format json is present before --print; --json-schema is absent; probe accepts help advertising only --output-format
    • Forbidden-effect assertions: No .json schema file exists in the private response directory during or after the run
    • Evidence citations: /home/wwind123/tools/coding-review-agent-loop/.venv/bin/python -m pytest tests/test_antigravity.py tests/test_antigravity_quota_groups.py tests/test_validated_agent_recovery.py tests/test_repair.py tests/test_docs_guidance.py tests/test_architecture_set_validation.py -q [c27822afed1f48f79a1e3fbed731279a; current-result]; /home/wwind123/tools/coding-review-agent-loop/.venv/bin/python -m pytest tests/ -q [c2266e709f434a62a7bb9a3d05aeb5cf; current-result]
  • docs-sync — verified
    • Tests: tests/test_docs_guidance.py, tests/test_architecture_set_validation.py
    • Locations: tests/test_docs_guidance.py, tests/test_architecture_set_validation.py
    • Workflow path: docs guidance and architecture-set validation tests over updated docs
    • Expected outcome assertions: Updated architecture detail doc and CLI guide pass shape, size and set validation
    • Forbidden-effect assertions: Root ARCHITECTURE.md is unchanged
    • Evidence citations: /home/wwind123/tools/coding-review-agent-loop/.venv/bin/python -m pytest tests/test_antigravity.py tests/test_antigravity_quota_groups.py tests/test_validated_agent_recovery.py tests/test_repair.py tests/test_docs_guidance.py tests/test_architecture_set_validation.py -q [c27822afed1f48f79a1e3fbed731279a; current-result]; /home/wwind123/tools/coding-review-agent-loop/.venv/bin/python -m pytest tests/ -q [c2266e709f434a62a7bb9a3d05aeb5cf; current-result]
  • file-precedence — verified
    • Tests: tests/test_antigravity.py::test_non_empty_response_file_wins_over_the_envelope_payload
    • Locations: tests/test_antigravity.py
    • Workflow path: AntigravityBackend.run with a non-empty response file and a payload in the SUCCESS envelope response
    • Expected outcome assertions: text_source is response_file and the text is the file
    • Forbidden-effect assertions: Prose-derived payload text is not merged or substituted
    • Evidence citations: /home/wwind123/tools/coding-review-agent-loop/.venv/bin/python -m pytest tests/test_antigravity.py tests/test_antigravity_quota_groups.py tests/test_validated_agent_recovery.py tests/test_repair.py tests/test_docs_guidance.py tests/test_architecture_set_validation.py -q [c27822afed1f48f79a1e3fbed731279a; current-result]; /home/wwind123/tools/coding-review-agent-loop/.venv/bin/python -m pytest tests/ -q [c2266e709f434a62a7bb9a3d05aeb5cf; current-result]
  • legacy-channel-modes — verified
    • Tests: tests/test_antigravity.py::test_capability_gate_keeps_legacy_args
    • Locations: tests/test_antigravity.py
    • Workflow path: AntigravityBackend.run with structured output off, an old agy, or operator --output-format/--json-schema pass-through
    • Expected outcome assertions: Legacy stdout/response-file text is returned verbatim, even when stdout is an envelope with a payload
    • Forbidden-effect assertions: --output-format is not added and no envelope recovery or ambiguity occurs
    • Evidence citations: /home/wwind123/tools/coding-review-agent-loop/.venv/bin/python -m pytest tests/test_antigravity.py tests/test_antigravity_quota_groups.py tests/test_validated_agent_recovery.py tests/test_repair.py tests/test_docs_guidance.py tests/test_architecture_set_validation.py -q [c27822afed1f48f79a1e3fbed731279a; current-result]; /home/wwind123/tools/coding-review-agent-loop/.venv/bin/python -m pytest tests/ -q [c2266e709f434a62a7bb9a3d05aeb5cf; current-result]
  • non-success-envelope — verified
    • Tests: tests/test_antigravity.py::test_backend_non_success_envelope_never_recovers_from_prose, tests/test_antigravity.py::test_non_success_envelope_error_is_a_typed_provider_diagnostic
    • Locations: tests/test_antigravity.py
    • Workflow path: AntigravityBackend.run with a non-SUCCESS envelope whose response holds prose JSON
    • Expected outcome assertions: provider_error_text carries the decoded error
    • Forbidden-effect assertions: No payload is recovered or rendered from the failed envelope's prose
    • Evidence citations: /home/wwind123/tools/coding-review-agent-loop/.venv/bin/python -m pytest tests/test_antigravity.py tests/test_antigravity_quota_groups.py tests/test_validated_agent_recovery.py tests/test_repair.py tests/test_docs_guidance.py tests/test_architecture_set_validation.py -q [c27822afed1f48f79a1e3fbed731279a; current-result]; /home/wwind123/tools/coding-review-agent-loop/.venv/bin/python -m pytest tests/ -q [c2266e709f434a62a7bb9a3d05aeb5cf; current-result]
  • single-fenced-recovery — verified
    • Tests: tests/test_antigravity.py::test_recovery_counts_one_object_amid_prose_scalars_and_arrays, tests/test_antigravity.py::test_recovery_ignores_a_footer_quoted_inside_the_object, tests/test_antigravity.py::test_backend_recovers_a_fenced_payload_when_no_response_file_exists, tests/test_antigravity.py::test_backend_blank_state_object_falls_through_to_the_marker_path, tests/test_antigravity.py::test_validated_turn_accepts_a_single_recovered_object_amid_noise
    • Locations: tests/test_antigravity.py
    • Workflow path: recover_response_payload, AntigravityBackend.run, and run_validated_agent for a SUCCESS envelope with no response file
    • Expected outcome assertions: One candidate is recovered amid numbers, true/null and bracketed lists; Rendered text carries the code-added footer and signature and parses; A blank-state object falls through to stdout text unrendered
    • Forbidden-effect assertions: Recovered payload equals the original object (no edits); No state footer or signature is invented for a blank-state object
    • Evidence citations: /home/wwind123/tools/coding-review-agent-loop/.venv/bin/python -m pytest tests/test_antigravity.py tests/test_antigravity_quota_groups.py tests/test_validated_agent_recovery.py tests/test_repair.py tests/test_docs_guidance.py tests/test_architecture_set_validation.py -q [c27822afed1f48f79a1e3fbed731279a; current-result]; /home/wwind123/tools/coding-review-agent-loop/.venv/bin/python -m pytest tests/ -q [c2266e709f434a62a7bb9a3d05aeb5cf; current-result]
  • stripped-structured-output — verified
    • Tests: tests/test_antigravity.py::test_stripped_structured_output_never_displaces_the_response_payload
    • Locations: tests/test_antigravity.py
    • Workflow path: AntigravityBackend.run structured auto with a SUCCESS envelope whose structured_output holds only schema_version/kind/state
    • Expected outcome assertions: text_source is structured_output and the rendered payload equals the full response JSON with summary and blocking items
    • Forbidden-effect assertions: The stripped structured_output object is never the rendered payload
    • Evidence citations: /home/wwind123/tools/coding-review-agent-loop/.venv/bin/python -m pytest tests/test_antigravity.py tests/test_antigravity_quota_groups.py tests/test_validated_agent_recovery.py tests/test_repair.py tests/test_docs_guidance.py tests/test_architecture_set_validation.py -q [c27822afed1f48f79a1e3fbed731279a; current-result]; /home/wwind123/tools/coding-review-agent-loop/.venv/bin/python -m pytest tests/ -q [c2266e709f434a62a7bb9a3d05aeb5cf; current-result]

Risk-matrix coverage map

Orchestrator completeness check (existence and level only; whether each cited test really exercises its row is for the reviewer to judge).

  • stripped-structured-output: tests tests/test_antigravity.py::test_stripped_structured_output_never_displaces_the_response_payload, tests/test_antigravity.py; declared level unit vs required unit
  • dispatch-no-schema: tests tests/test_antigravity.py::test_stripped_structured_output_never_displaces_the_response_payload, tests/test_antigravity.py::test_capability_probe_runs_once_when_supported, tests/test_antigravity.py::test_capability_probe_needs_only_output_format, tests/test_antigravity.py::test_validated_turn_threads_eligibility_into_the_agy_argv, tests/test_antigravity.py; declared level unit vs required unit
  • legacy-channel-modes: tests tests/test_antigravity.py::test_capability_gate_keeps_legacy_args, tests/test_antigravity.py; declared level unit vs required unit
  • single-fenced-recovery: tests tests/test_antigravity.py::test_recovery_counts_one_object_amid_prose_scalars_and_arrays, tests/test_antigravity.py::test_recovery_ignores_a_footer_quoted_inside_the_object, tests/test_antigravity.py::test_backend_recovers_a_fenced_payload_when_no_response_file_exists, tests/test_antigravity.py::test_backend_blank_state_object_falls_through_to_the_marker_path, tests/test_antigravity.py::test_validated_turn_accepts_a_single_recovered_object_amid_noise, tests/test_antigravity.py; declared level unit vs required unit
  • ambiguous-candidates: tests tests/test_antigravity.py::test_recovery_ambiguity_carries_only_a_reason_code_and_count, tests/test_antigravity.py::test_backend_ambiguous_response_returns_empty_text_and_a_typed_diagnostic, tests/test_antigravity.py; declared level unit vs required unit
  • ambiguous-format-accounting: tests tests/test_antigravity.py::test_ambiguity_is_a_trusted_format_failure_that_falls_back_down_the_chain, tests/test_antigravity.py::test_ambiguity_classification_text_is_only_the_trusted_diagnostic, tests/test_antigravity.py; declared level unit vs required unit
  • file-precedence: tests tests/test_antigravity.py::test_non_empty_response_file_wins_over_the_envelope_payload, tests/test_antigravity.py; declared level unit vs required unit
  • non-success-envelope: tests tests/test_antigravity.py::test_backend_non_success_envelope_never_recovers_from_prose, tests/test_antigravity.py::test_non_success_envelope_error_is_a_typed_provider_diagnostic, tests/test_antigravity.py; declared level unit vs required unit
  • bare-approval-gate: tests tests/test_antigravity.py::test_bare_approved_envelope_payload_never_yields_an_approval, tests/test_repair.py::test_envelope_only_reviewer_payload_is_refused_repair, tests/test_repair.py::test_envelope_only_approval_fails_the_strict_parsers, tests/test_antigravity.py, tests/test_repair.py; declared level unit vs required unit
  • docs-sync: tests tests/test_docs_guidance.py, tests/test_architecture_set_validation.py, tests/test_docs_guidance.py, tests/test_architecture_set_validation.py; declared level unit vs required unclassified (no level check)
  • Status: complete at c4ace39 (deterministic completeness check passed)

-- Anthropic Claude: claude-opus-5-5 (medium)

@wwind123

Copy link
Copy Markdown
Owner Author

Agent-loop managed-CI resume provenance audit record (machine-readable). Records resume provenance for managed CI on pull request #2050 at head c4ace39. Not an agent response; keep this comment.

AGENT_MANAGED_CI_UNPROTECTED_OVERRIDE_V1 nonce=zyPwMAc2K0cLeDU6FfRUQfTHdqGLqsxS repo=wwind123/coding-review-agent-loop base=main head=c4ace39d63936492a16d3f8d5f50a016e7edfe84 protection=voluntary active_label_event_id=36830026942 resume_from=7055337121 provenance_head=c4ace39d63936492a16d3f8d5f50a016e7edfe84 generation=rwqdyNRT6kC_l9wv

Resume provenance only: the prior issue-created audit is not an authorization token.

@wwind123

Copy link
Copy Markdown
Owner Author

PR review scheduling audit: selected Codex; paused Claude, Antigravity; reason: strict pre-panel fallback: architecture identity changed; scheduler metadata recovery: latest scheduler metadata is missing or invalid; scheduler metadata recovery: current-head records lack scheduler metadata; scheduler metadata is missing or invalid; primary re-invoked with full context; phase: primary; head: c4ace39; primary: Codex; active owners: (none); force-full: False (source: none); scheduler-policy calls avoided cumulatively: 2.

@wwind123

Copy link
Copy Markdown
Owner Author

Review verdict: Approved

Reviewed the complete origin/main...HEAD diff at c4ace39. No blocking defects found. Implementation and test assertions cover all ten approved risk-matrix rows, including trusted ambiguity classification, format fallback without repair, file precedence, and bare-approval refusal. Supplied current-head focused and full-suite receipts passed, and GitHub checks are passing. No tests were executed during this read-only review.

-- OpenAI Codex: gpt-6.1-sol (medium)

@wwind123

Copy link
Copy Markdown
Owner Author

PR review round 1 reconciliation: settled reviewers: Codex. Finalization continues after reconciliation. Historical approvals remain exact-head-bound; scheduler-policy calls avoided cumulatively: 2. Phase: primary; force-full: False (source: none).

@wwind123

Copy link
Copy Markdown
Owner Author

PR review scheduling audit: selected Claude, Antigravity; paused Codex; reason: independent secondary audit after exact-head primary approval; phase: secondary-audit; head: c4ace39; primary: Codex; active owners: (none); force-full: False (source: none); scheduler-policy calls avoided cumulatively: 2.

@wwind123

Copy link
Copy Markdown
Owner Author

Review verdict: Approved

Independent secondary audit of the full base-to-head diff at c4ace39. The PR follows the approved plan. Dispatch now passes only --output-format json, with no schema file, no --json-schema, and a probe that requires only --output-format; operator pass-through of either flag still selects the legacy channel. _select_structured_turn_text never uses agy's structured_output as the answer. A non-SUCCESS envelope still returns the provider error without recovering anything from prose. A non-empty response file wins. Otherwise recover_response_payload counts top-level decoded dicts over the whole CRLF/ANSI-normalized response, before any marker handling, so nested objects are consumed and scalars and arrays are ignored. It renders exactly one object of the expected kind or agent_unavailable. Several objects, a wrong or missing kind, or an out-of-span footer whose state differs are reported as a typed AmbiguousPayload, which carries only a reason code and a count. A blank-state object falls through to the marker/stdout path, so no state is invented. In validated_agent.py the new ambiguity branch sits after the timeout, agy-log quota and nonzero-exit branches and before the empty-response branch. It sets the classification text only from the trusted diagnostic, with category agent-unavailable, format_failure=True, no capacity classifier and no repair, then reaches the existing next_after_failure format-fallback. _QUOTA_RATE_LIMIT_RE cannot match the diagnostic. is_silent_antigravity_attempt does not treat a non-empty ambiguous envelope as silent, so the agy-log quota path is not triggered by mistake. In repair.require_recoverable_review_substance, payloads whose keys are a subset of {schema_version, kind, state} are now refused, so a bare approval can no longer be repaired into one; the strict parsers already rejected it. Tests cover every risk-matrix row through the real backend and validated-turn paths: the stripped-envelope rendering, the dispatch argv and the absent schema file, prose-noise recovery, all ambiguity reasons including objects on both sides of the marker, two-model format-fallback with spies showing no capacity or failure classification, file precedence, a non-SUCCESS envelope, and a bare approval in pr_review and plan_review. The README, CLI guide, architecture detail doc and decision log are updated; the #2039 replay remains documented in the CLI guide. GitHub checks are passing.

Future follow-ups

  • Recovery counts any decodable top-level object in the envelope prose, even incidental snippets such as {} or {"note": 1} that a model quotes outside its payload. Such a turn becomes a format failure and falls back down the chain. The approved plan chose this conservative behaviour. If live runs show frequent false ambiguity, consider recording reason-code counts per model and revisiting the rule.

-- Anthropic Claude: claude-opus-5-5 (medium)

@wwind123

Copy link
Copy Markdown
Owner Author

Review verdict: Approved

Independent secondary review of pull request #2050 at head c4ace39. The implementation correctly stops passing --json-schema and instead requests agy --output-format json, preventing agy from stripping non-schema fields into structured_output. A single expected-kind JSON object in envelope response prose is safely recovered with footer and signature added in code when the response file is missing, while multiple objects, incorrect kinds, or contradictory out-of-span footers trigger typed format failures without repair. In addition, require_recoverable_review_substance now rejects envelope-only payloads, closing the bare-approval loophole. All ten approved risk-matrix rows are covered by verified passing tests and documentation is updated.

-- Google Antigravity: Gemini 3.8 Flash (High)

@wwind123

Copy link
Copy Markdown
Owner Author

PR review round 2 reconciliation: settled reviewers: Antigravity, Claude. Finalization continues after reconciliation. Historical approvals remain exact-head-bound; scheduler-policy calls avoided cumulatively: 2. Phase: secondary-audit; force-full: False (source: none).

@wwind123

Copy link
Copy Markdown
Owner Author

Created approved-review future follow-up issues for PR #2050:

Reconciliation: 1 filed, 0 deduplicated, 0 skipped by cap.
Tracker reuse: 0 reused; 0 uncertain.

These were mentioned as future work and did not block merge readiness.

-- coding-review-agent-loop

@wwind123

wwind123 commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner Author

Managed CI authorization for exact head c4ace39.

@wwind123
wwind123 marked this pull request as ready for review November 21, 2026 02:00
@wwind123
wwind123 merged commit f40b0b5 into main Nov 21, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

agy structured_output keeps only declared schema keys, so structured Antigravity turns lose summary and findings

1 participant