Skip to content

fix(api): return float zero after async reward timeout - #1541

Open
harooos wants to merge 1 commit into
areal-project:mainfrom
harooos:bugfix/async-reward-timeout-float
Open

fix(api): return float zero after async reward timeout#1541
harooos wants to merge 1 commit into
areal-project:mainfrom
harooos:bugfix/async-reward-timeout-float

Conversation

@harooos

@harooos harooos commented Jul 14, 2026

Copy link
Copy Markdown

Description

AsyncRewardWrapper.__call__ declares a float result, but its
wrapper-owned timeout fallbacks return the integer 0. This can be rejected
by the v1 OpenAI proxy workflow; v2 happens to normalize numeric rewards,
but switching controller versions is not a drop-in fix and v1 remains the
default.

Return 0.0 from both fallback paths and strengthen the existing timeout
tests to verify the result type. Successful user reward values are unchanged.

Related Issue

No issue filed.

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 💥 Breaking change
  • 📝 Documentation update
  • ♻️ Refactoring
  • ⚡ Performance improvement
  • ✅ Test coverage improvement

Checklist

  • I have read the
    Contributing Guide
  • Pre-commit hooks pass (pre-commit run --all-files)
  • Relevant tests pass; existing regression tests were strengthened
  • Documentation updated (not applicable)
  • Branch is up to date with main
  • Self-reviewed via /review-pr
  • This PR was created by a coding agent via /create-pr
  • This PR is a breaking change

Breaking Change Details (if applicable):

Not applicable.

Additional Context

Validation:

  • python -m pytest -q tests/test_async_reward_wrapper.py — 15 passed
  • SKIP=generate-cli-docs pre-commit run --all-files

AsyncRewardWrapper returned an integer zero when reward computation timed
out, despite declaring a float result. The v1 OpenAI proxy only accepts
dictionary or float rewards, so the fallback could raise ValueError instead
of recording a zero reward.

Return 0.0 from both wrapper-owned fallback paths and strengthen the
existing timeout tests to verify the result type.

Signed-off-by: Bo Yang <yb550079@antgroup.com>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request updates the return values in AsyncRewardWrapper from integer 0 to float 0.0 to align with the declared float return type. It also updates the corresponding unit tests to verify that the returned value is of type float and equals 0.0. I have no feedback to provide as the changes are correct and consistent.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had recent activity within the last 14 days.

Please add a comment or push new commits to keep it active.

Thank you for your contribution!

@github-actions github-actions Bot added the stale label Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant