fix(core): fail content-filtered and outputless length settlements by clopca · Pull Request #46602 · anomalyco/opencode · GitHub
Skip to content

fix(core): fail content-filtered and outputless length settlements - #46602

Closed
clopca wants to merge 1 commit into
anomalyco:v2from
clopca:length-settlement
Closed

fix(core): fail content-filtered and outputless length settlements#46602
clopca wants to merge 1 commit into
anomalyco:v2from
clopca:length-settlement

Conversation

@clopca

@clopca clopca commented Sep 1, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #46596

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Steps ending in content_filtered, or in max_tokens without any text or tool call, settled as succeeded with empty output. Users saw blank responses recorded as success, and the terminal filtered segment stayed in history, causing subsequent generations on the session to return empty text as well.

Two changes:

  • session.generate raises ContentPolicyError on content-filter and InvalidProviderOutputError on length with no text/tool call, instead of returning empty text with HTTP 200.
  • The runner publisher tracks useful output (text or tool call) separately from durable output: reasoning-only length keeps its reasoning and rawFinish for diagnosis but settles as provider.invalid-output. Truncated responses with partial text remain successful, so no valid output is lost.

How did you verify your code works?

  • Regression tests in session-generate.test.ts (content-filter, output-less length, partial text) and session-runner-tool-events.test.ts (reasoning-only length settlement).
  • Full packages/core suite green (4,106 tests, 0 fail).
  • Live with a private build: replaying a real session whose history ends in content_filtered now returns a visible 503 (Provider blocked the response) instead of a silent empty success; healthy sessions and the same history with the filtered segment removed still respond normally.

Steps ending in content_filtered, or in max_tokens without any text or
tool call, settled as succeeded with empty output. Users saw blank
responses recorded as success, and the terminal filtered segment stayed
in history, causing subsequent generations on the session to return
empty text as well.

Session generate now raises ContentPolicyError on content-filter and
InvalidProviderOutputError on outputless length. The runner publisher
tracks useful output (text or tool call) separately from durable output:
reasoning-only length keeps its reasoning and rawFinish for diagnosis
but settles as provider.invalid-output, while truncated responses with
partial text remain successful.
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Sep 1, 2026
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Sep 1, 2026
@github-actions github-actions Bot closed this Sep 1, 2026
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.

1 participant