Skip to content

fix: fall back when provider result is empty - #240

Open
FrundlesTian wants to merge 1 commit into
overwirehq:claude/report-run-stop-reason-zfw34ifrom
FrundlesTian:fix/openrouter-empty-result
Open

FrundlesTian wants to merge 1 commit into
overwirehq:claude/report-run-stop-reason-zfw34ifrom
FrundlesTian:fix/openrouter-empty-result

Conversation

@FrundlesTian

Copy link
Copy Markdown
Collaborator

Description

Fixes the empty response shown with OpenRouter and other Anthropic-compatible providers that return ResultMessage.result == "" while still emitting the real response in an AssistantMessage.

The result is now stripped once and used only when it contains text. Empty and whitespace-only provider results take the existing AssistantMessage extraction path; non-empty ResultMessage content keeps its current priority.

This is stacked on #236 because that PR currently owns the same result-extraction block. The only diff relative to #236 is this fix, its regression tests, and the changelog entry. After #236 merges, this PR can be retargeted to main without carrying unrelated commits.

Related issue

Closes #171

Type of change

  • Bug fix
  • New feature
  • Breaking change (documented in CHANGELOG under "Changed" or "Removed")
  • Documentation or tooling only

How it was tested

  • Tests added or updated

  • Equivalent make test and formatting/lint commands pass locally

  • Tested by hand against a running bot

  • pytest --no-cov — 685 passed

  • black --check src tests

  • isort --check-only src tests

  • flake8 src tests

The regression test covers both an empty string and a whitespace-only result while an AssistantMessage contains the OpenRouter response.

Checklist

  • One concern per PR; unrelated changes are split out
  • CHANGELOG.md has an entry under [Unreleased]
  • If pyproject.toml dependencies changed, poetry lock was run and the updated poetry.lock is committed (not applicable)
  • Documentation updated (README.md, docs/, .env.example, CLAUDE.md) where settings or commands changed (not applicable)
  • New settings default to current behaviour (not applicable)
  • If AI tools helped write this change, I reviewed every line and the hand-testing above is mine

@github-actions

Copy link
Copy Markdown

No blocking issues found.

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