Skip to content

test(devin): assert which error the refused send raises and what the caller sees - #5170

Merged
lidge-jun merged 1 commit into
devfrom
codex/devin-send-budget-error-assertions
Sep 19, 2026
Merged

lidge-jun merged 1 commit into
devfrom
codex/devin-send-budget-error-assertions

Conversation

@lidge-jun

@lidge-jun lidge-jun commented Sep 19, 2026

Copy link
Copy Markdown
Owner

Summary

Two test-only follow-ups to #5152. Nothing in production changes, and the merged branch is untouched.

The adapter-direct case for a refused initial send caught the refusal with a bare .catch(() => {}) and discarded it. That passed for any error at all: if the adapter had thrown an ordinary upstream failure instead of the budget refusal, the case would still have been green while the turn reached the operator as a provider problem rather than a budget decision. The case now captures what escaped and asserts SendBudgetExhaustedError, alongside its existing assertions that no inference request was made and no permit was spent.

The outer case reported the HTTP status only inside its failure message. It is now asserted. The refusal reaches the client as an error code on a buffered failed response, so the outer status is 200, not 429. That is worth pinning precisely because 429 is the obvious guess and this path does not use it; a future change that turned the refusal into a transport-level status would now be caught here rather than discovered downstream.

Relates to #5122.

Verification

  • Local checks: NOT RUN. This lane is prohibited from running local suites, focused tests, typecheck, builds, installs or any live ocx command. Hosted CI on this PR is the executable evidence.
  • Static screen: both changed files parse cleanly under an AST error-node check, and neither is near a file-size cap.
  • No assertion was removed or relaxed; both changes are additive checks on existing cases.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

Summary by CodeRabbit

  • Tests
    • Strengthened coverage for send-budget exhaustion scenarios.
    • Verified that budget refusals return the expected error type.
    • Confirmed zero-budget requests return a successful HTTP response containing the appropriate buffered error.
    • Ensured no upstream requests, observations, or budget usage occur after refusal.

…caller sees

Two follow-ups to #5152, both test-only. Nothing in production changes and the
merged branch is untouched.

The adapter-direct case caught the refusal with a bare catch that discarded it,
so it passed for any error at all. If the adapter had thrown an ordinary upstream
failure instead of the budget refusal, the case would still have been green while
the turn was reported to the operator as a provider problem rather than a budget
decision. It now pins SendBudgetExhaustedError.

The outer case reported the HTTP status only inside its failure message. It is
now asserted: the refusal reaches the client as an error code on a buffered
failed response, so the status is 200. That is worth stating, because the
obvious guess is 429 and this path does not use it.

Local checks: NOT RUN. Hosted CI on this PR is the executable evidence.
@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner September 19, 2026 12:47
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 19, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-19T12:50:01.492584Z 825d4ed PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: lidge-jun/opencodex/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 1704c095-032c-4185-bf88-293bb12d12d9

📥 Commits

Reviewing files that changed from the base of the PR and between d1745ee and 825d4ed.

📒 Files selected for processing (2)
  • tests/adapters/adapter-inner-send-budget-wiring.test.ts
  • tests/responses/responses-send-budget-counts.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The tests now verify that Devin send-budget refusal exposes SendBudgetExhaustedError and returns HTTP 200 with a buffered refusal error. Existing assertions still verify that no upstream sends occur.

Changes

Send budget refusal contract

Layer / File(s) Summary
Adapter refusal error assertion
tests/adapters/adapter-inner-send-budget-wiring.test.ts
The test captures the error from adapter.runTurn and asserts that it is a SendBudgetExhaustedError. Existing checks for absent requests, observations, and budget use remain.
Response status assertion
tests/responses/responses-send-budget-counts.test.ts
The zero-budget Devin test now verifies HTTP status 200 and the buffered request_send_budget_exhausted error while preserving the no-send assertion.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Other

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main test changes: it identifies the Devin scenario, the refused-send error, and the caller-visible response behavior.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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.

@github-actions

Copy link
Copy Markdown
Contributor

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature). label Sep 19, 2026
@lidge-jun

Copy link
Copy Markdown
Owner Author

Maintainer integration into dev under MAINTAINERS.md, by the authenticated project owner. This is an integration decision, not a self-approval.

Reviewed head: 825d4ed9c72233bc862668fec6010862bcddadea. The two-file diff pins the actual typed send-budget refusal and the existing HTTP 200 buffered-failure response, with zero physical sends retained. Independent static review passed; no open review threads or maintainer objections were found. The merge with current dev 19b42c5b08f56a309a1b54f2ceb2c188bcfd71cf is clean.

Exact-head applicable hosted CI and aggregate passed: https://github.com/lidge-jun/opencodex/actions/runs/35443894116 . Target enforcement passed at the same head in run 35443894094; a separate canceled duplicate is not used as proof. Event-inapplicable jobs remain skipped. Local tests, typecheck, build and runtime execution were not run, per the task constraint.

@lidge-jun
lidge-jun merged commit 49c79f3 into dev Sep 19, 2026
30 of 31 checks passed
@lidge-jun
lidge-jun deleted the codex/devin-send-budget-error-assertions branch September 19, 2026 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant