Skip to content

Preserve provider finish reasons and bounded diagnostics #109

Description

@byapparov

Context

An observed headless execution using CLI 0.4.3 and Gemini 2.5 Flash completed one file-read tool call, then emitted a terminal message with finish: "error". No final text was recorded; there was no session-error event, and the process exited 0. A downstream consumer classified the result as incomplete despite the successful process exit.

The pinned Google SDK 2.0.54 maps only MALFORMED_FUNCTION_CALL to normalized error. This is strong evidence for a malformed generated function call, but the raw response and exact invalid call were not retained. Do not describe the exact offending call or its cause as proven.

Problem / Goal

Normalized finish: "error" loses provider-specific meaning. The pinned Google adapter also omits the raw finish reason/diagnostic from the metadata passed onward. A downstream telemetry field alone cannot recover information discarded at that boundary.

Proposed Approach

Preserve a structured termination diagnostic from the provider adapter through message storage and headless NDJSON. Include provider/model, raw and normalized reason, available provider request ID, and a bounded redacted diagnostic, correlated with invocation/session/message identity. Use an adapter change or dependency update after verifying it retains the needed fields. Missing provider details must be explicit; do not infer a raw reason and report it as observed.

Acceptance Criteria

  • A synthetic Vertex response with MALFORMED_FUNCTION_CALL and a diagnostic survives the actual adapter-to-NDJSON path with both raw and normalized reasons.
  • Capture available request identity and diagnostic text without requiring full prompt/response logging; absent fields have documented availability semantics.
  • Diagnostic capture reports unavailable/redacted/truncated conditions distinctly and documents size bounds.
  • Tests prove credential-shaped values are redacted and oversized diagnostics are bounded. No new default collection of prompts, reasoning, tool arguments, or full responses.
  • Older providers/adapters that expose only normalized reasons remain supported and explicitly report raw details as unavailable.
  • Document additive schema evolution and provide sanitized example events for downstream consumers, including failure without an exception.
  • Capture failure cannot convert the underlying execution outcome to success or replace the original error with an unrelated logging error.

Out of Scope

Raw response archives, a general debug-bundle product, new audit sinks (#33/#34), dashboards, automatic recovery, and changes to Google model behavior.

Roadmap Alignment

  • Pillar: EXEC; Q3 2026 pilot-ready executor reliability and code-review quality.
  • Priority: P1 — prevents repeated investigations from ending at a generic error.
  • Milestone: Enterprise Observability (CLI repository milestone; repository-specific milestone numbering).
  • Uses existing repository labels; priority and pillar are recorded here because matching labels do not exist in this repository.

References

Sequencing

Can proceed alongside the failure-outcome fix; align terminal event fields with #108

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions