Skip to content

feat(session): persist retry reports in session end - #1083

Open
Gongyl01 wants to merge 1 commit into
alibaba:mainfrom
Gongyl01:feat/retry-report-session-persist
Open

feat(session): persist retry reports in session end#1083
Gongyl01 wants to merge 1 commit into
alibaba:mainfrom
Gongyl01:feat/retry-report-session-persist

Conversation

@Gongyl01

Copy link
Copy Markdown
Contributor

Description

Retry reports are currently available only in the CLI output. They are frozen after Agent.Run returns, but session_end is written inside Agent.Run, so the report is unavailable when the session is finalized.

This PR persists the existing retry report in session_end.llm_retry_report:

  • passes the per-run RetryCollector to the review agent;
  • freezes the report before session finalization on every terminal path;
  • waits for background requests before freezing on the normal path;
  • stores the optional report in SessionHistory and embeds it in session_end;
  • keeps the CLI's existing post-run Freeze and output path unchanged;
  • omits llm_retry_report for clean runs with nothing to report;
  • suppresses invalid reports without changing warnings, terminal state, or exit code.

RetryCollector.Freeze remains a deterministic read. The agent and CLI take independent snapshots with the same run ID, and tests verify that their serialized values are equal.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Refactoring (no functional changes)
  • Documentation update
  • CI / Build / Tooling

How Has This Been Tested?

  • make test passes locally
  • Manual testing (describe below)

Additional verification:

  • make check
  • full test suite with race detection
  • retry report is embedded in session_end
  • absent reports are omitted rather than serialized as empty objects
  • persisted and CLI-equivalent snapshots are fully equal
  • invalid reports are suppressed without entering Run errors or agent warnings
  • nil collector paths remain unchanged

Checklist

  • My code follows the project's coding style (go fmt, go vet)
  • I have performed a self-review of my code
  • I have added tests that prove my fix is effective or my feature works
  • New and existing unit tests pass locally with my changes
  • Documentation is not required because this reuses the existing retry report schema

@github-actions

Copy link
Copy Markdown
Contributor

OpenCodeReview: Review complete: 0 finding(s) across 6 selected item(s).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant