Skip to content

fix: preserve provider tool-stop failures - #811

Merged
seonghobae merged 2 commits into
ContextualWisdomLab:fix/issue-567-tool-failurefrom
seonghobae:repair/provider-tool-stop-v2203
Aug 21, 2026
Merged

fix: preserve provider tool-stop failures#811
seonghobae merged 2 commits into
ContextualWisdomLab:fix/issue-567-tool-failurefrom
seonghobae:repair/provider-tool-stop-v2203

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • preserve provider-originated 409 tool_execution_stopped through chat and raw passthrough retries
  • map provider terminal tool state to the existing ToolFallbackStoppedError fail-closed contract
  • preserve the same contract when a streaming provider response fails before SSE content starts
  • make the tool fallback test module execute its full pytest collection when run directly

Validation

  • uv run --frozen --with pytest --with ruff python -m pytest -q tests/test_provider_reliability.py tests/test_tool_execution_fallback.py (115 passed)
  • uv run --frozen --with pytest --with ruff python -m compileall -q contextual_orchestrator tests
  • git diff --check

This PR is intentionally stacked on upstream PR #771 and must not be merged independently of that parent.


Open in Devin Review

@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c2a787b5-54a6-4201-b236-e9b0ceb2ce6f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Maintainer exact-head audit for PR 811

Remote exact head: f0b0dd5
Base: cc806cd
Remote state: OPEN, non-Draft, MERGEABLE, BLOCKED; review decision REVIEW_REQUIRED and no formal approval.

The current diff is bounded to the provider tool-stop transport boundary and its regression tests. No unresolved review comments are present on this exact head. Local focused verification on the exact head passed 115 tests:
uv run --with pytest pytest -q tests/test_provider_reliability.py tests/test_tool_execution_fallback.py

Hosted checks currently have 8 skipped/completed runs and 9 queued runs, including the required workflow bootstrap, Strix, Scorecard, dependency review, OSV, Semgrep, Trivy FS, scheduler sweep, and close-empty. Queued runs are not success evidence. The PR is a dependent stack item over PR 771, so mergeability and base identity must be rechecked after the parent changes.

Decision: WAIT_AND_REMEDIATE. No merge, bypass, or approval was performed.

devin-ai-integration[bot]

This comment was marked as resolved.

@seonghobae
seonghobae merged commit d7b4f68 into ContextualWisdomLab:fix/issue-567-tool-failure Aug 21, 2026
1 of 2 checks passed
@seonghobae

Copy link
Copy Markdown
Contributor Author

Exact-head stacked reconciliation completed.

  • Parent PR fix: classify tool-runtime failures and fail safely #771 HEAD: 276ed4f04a065735577ab81e065dad54250b90b3
  • PR fix: preserve provider tool-stop failures #811 HEAD: 809b07a1992bc442e36c9312fe055da2d6a94bd0
  • The stale parent conflict was resolved through a normal merge in the fork branch; no force push or protected bypass was used.
  • The resulting tree preserves provider-originated HTTP 409 tool_execution_stopped mapping, no provider URL/body leakage, no retry/failover after an ambiguous tool result, streaming SSE fail-closed output, and the parent provider response boundary.
  • Focused provider/tool-fallback suite: 116 passed.
  • Full exact-tree suite: 1540 passed in 537.30s.
  • compileall and git diff --check: passed.

The PR remains dependent on #771. Hosted required Checks and an independent formal approval remain authoritative; no merge or approval claim is made while they are pending.

@devin-ai-integration devin-ai-integration 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.

Devin Review found 1 new potential issue.

Open in Devin Review

Comment on lines +1174 to +1177
except urllib.error.HTTPError as exc:
if _is_tool_execution_stopped(exc):
raise _provider_tool_execution_stopped(agent) from None
raise

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.

📝 Info: Streaming error body consumed before re-raise

For a non-tool-stop HTTPError, _is_tool_execution_stopped(exc) reads the error body via exc.read(65536) before raise re-raises it, so any later reader of the body gets an empty stream.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

seonghobae added a commit that referenced this pull request Aug 24, 2026
* fix: add safe tool execution fallback policy

* fix: harden HTTP tool failure classification

* fix: address tool fallback review findings

* docs: specify fail-closed HTTP and SSE contract

* fix: address follow-up tool fallback review

* fix: bound tool fallback retries

* docs: remove plan whitespace

* fix(tools): honor suppressed exception contexts

* fix(security): require object policy for external admin reads

* fix(security): pass principal token to resource policy

* test(tool): preserve structured metadata through wrappers

* fix(tools): preserve structured failures through wrappers

* docs: record external admin resource policy

* refactor: keep tool failure PR focused

* test: repair fallback regression checks

* fix: contain raw provider failures

* fix: sever fail closed tool error causes

* fix: harden tool failure retry boundaries

* fix: stop malformed provider failover

* fix: preserve terminal provider tool failures

* fix: preserve provider tool-stop failures (#811)

* fix: count safe retries in circuit health

* refactor: remove unreachable provider error branch

* fix: remove stale fallback error state

---------

Co-authored-by: contextual-orchestrator-maintainer[bot] <contextual-orchestrator-maintainer[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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