Skip to content

fix(grok): account for metered preflight failures - #655

Closed
luvs01 wants to merge 2 commits into
devfrom
codex/propose-fix-for-grok-devin-429-issue
Closed

luvs01 wants to merge 2 commits into
devfrom
codex/propose-fix-for-grok-devin-429-issue

Conversation

@luvs01

@luvs01 luvs01 commented Sep 26, 2026 •

Copy link
Copy Markdown
Owner

Motivation

  • Grok/Devin can emit usage frames before returning an HTTP 429; the new preflight early-return path returned a refusal without recording that usage, breaking durable spend accounting and allowing billed tokens to escape a configured ceiling.

Description

  • Record usage carried on a Devin preflight error before returning the HTTP 429 by calling transportState.bindKeyUsageFromBridge(preflight.error.usage) in the Grok preflight refusal path in src/server/responses/run-turn-execution.ts.
  • Add a regression test tests/responses/responses-grok-devin-preflight.test.ts that verifies metered usage attached to a pre-output 429 is preserved for both streaming and buffered response modes.
  • Update documentation in structure/transports/responses-spend.md to clarify that pre-output Grok/Devin 429 errors bind terminal usage the same way streaming/buffered bridges do.

Testing

  • Ran the focused regression file with Bun: npx --yes bun@latest test tests/responses/responses-grok-devin-preflight.test.ts, which passed (25 tests passed).
  • Typecheck: npx --yes bun@latest run typecheck succeeded.
  • Structure checks: npx --yes bun@latest run structure:check succeeded.
  • Privacy scan: npx --yes bun@latest run privacy:scan succeeded.
  • Note: bun run test:changed could not run in this checkout because no dev comparison ref was available; focused regression coverage was executed instead.

Codex Task


Devin Review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Repository: luvs01/opencodex/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 9eb60c57-71a0-43bd-a6ee-d80170730339


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.

devin-ai-integration[bot]

This comment was marked as resolved.

@github-actions github-actions Bot added the bug Something isn't working label Sep 26, 2026
@github-actions

Copy link
Copy Markdown

✅ Deterministic PR hygiene checks passed.

…sonl

Co-Authored-By: Epinephrine <luvs01@hanmail.net>
@luvs01

luvs01 commented Sep 27, 2026

Copy link
Copy Markdown
Owner Author

이관됨: lidge-jun#6035

@luvs01

luvs01 commented Sep 27, 2026

Copy link
Copy Markdown
Owner Author

동일 수정이 상류 저장소에 제출되어 이 포크 PR의 목적은 달성됐습니다.

@luvs01 luvs01 closed this Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aardvark bug Something isn't working codex

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant