runner: add usage preflight guard for near-limit requests#21561
Open
VontaJamal wants to merge 2 commits intoopenclaw:mainfrom
Open
runner: add usage preflight guard for near-limit requests#21561VontaJamal wants to merge 2 commits intoopenclaw:mainfrom
VontaJamal wants to merge 2 commits intoopenclaw:mainfrom
Conversation
src/agents/pi-embedded-runner/run.ts
Outdated
| activeErrorContext.provider, | ||
| activeErrorContext.model, | ||
| ) | ||
| ? formatBillingErrorMessage(provider) |
Contributor
There was a problem hiding this comment.
removing model parameter changes billing error messages during failover — formatBillingErrorMessage will no longer include the model name in the error message
Suggested change
| ? formatBillingErrorMessage(provider) | |
| ? formatBillingErrorMessage(provider, modelId) |
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/agents/pi-embedded-runner/run.ts
Line: 951
Comment:
removing `model` parameter changes billing error messages during failover — `formatBillingErrorMessage` will no longer include the model name in the error message
```suggestion
? formatBillingErrorMessage(provider, modelId)
```
How can I resolve this? If you propose a fix, please make it concise.
Author
|
Maintainer fast-path (3-5 min):
Policy discussion is tracked in #21557. Human-verified locally with targeted vitest + type-aware oxlint on touched files. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
payloads[].isError=trueand skips overflow-compaction fallback.EmbeddedPiRunMeta.error.kind.Quick Review (3-5 min)
src/agents/pi-embedded-runner/usage-preflight.ts: threshold logic + fail-open cache/timeout behavior.src/agents/pi-embedded-runner/run/attempt.ts: where preflight is invoked.src/agents/pi-embedded-runner/run.ts: early return forUsagePreflightErroras user-facing error payload.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
Security Impact (required)
Yes/No) NoYes/No) NoYes/No) YesYes/No) NoYes/No) NoYes, explain risk + mitigation:Repro + Verification
Environment
Steps
Expected
Actual
Evidence
Human Verification (required)
corepack pnpm vitest run src/agents/pi-embedded-runner/usage-preflight.test.ts src/agents/pi-embedded-runner/run.overflow-compaction.test.tscorepack pnpm oxlint --type-awareon touched filesrun.ts.corepack pnpm tsgodue pre-existing unrelated TS2742 baseline failures.Compatibility / Migration
Yes/No) YesYes/No) NoYes/No) NoFailure Recovery (if this breaks)
61eac88536b9cf976d08d780419f6d59d36d0027and5c759c117d9852dbe1e5cd07ab826b8d635d4af2.src/agents/pi-embedded-runner/usage-preflight.tssrc/agents/pi-embedded-runner/run/attempt.tssrc/agents/pi-embedded-runner/run.tsRisks and Mitigations