[Feature]: Include provider, model and account label in the `upstream failure` service.log line
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- backend, observability
Research direction
Start in src/server/request-log-terminal-status.ts at the console.warn for upstream failure (around line 108) and confirm provider, model and accountLogLabel are already on the log context type. Read the redaction gate from #8104 and ACCOUNT_LOG_LABEL_RE in src/codex/account-label.ts before adding the three optional fields, then run the existing tests around request-log-terminal-status and check a 429 line in service.log. Done means that line names provider, model and account while no upstream-authored text is printed.
Written by the indexing model from the issue text.
Description
Area: Proxy and routing
What are you trying to accomplish?
When several providers or accounts share one proxy, I want to read service.log after a 429 and know which provider, model and account hit the limit.
What prevents this today?
On 2.100.8 an upstream 429 produces this line, and nothing else identifies the request:
2026-11-22T17:48:47.366Z [opencodex] upstream failure type=rate_limit_error code=rate_limit_exceeded
The line has no provider, model, account label or request id. The [combo] ... failed with 429 line that follows names the target, but it only exists for combo routes. Non-combo routes get nothing. usage.jsonl has the full detail (requestId, provider, model, accountLogLabel, per-attempt status), but joining it to service.log by timestamp is ambiguous: concurrent 429s share the same millisecond window, and the log line carries no key to join on.
The line is emitted here, where provider, model and accountLogLabel are already available on the log context:
https://github.com/lidge-jun/opencodex/blob/9e0e298ef9720cfeaa1209f090a68e4d1965d2a1/src/server/request-log-terminal-status.ts#L108
(Added in #8104 and gated in #8744. The fields were not part of its "closed vocabulary" design, which keeps upstream-authored text out of persistent logs.)
What should OpenCodex do?
Append the routing identity to that line, for example:
[opencodex] upstream failure status=429 type=rate_limit_error code=rate_limit_exceeded provider=xai model=grok-4.7 account=o1a2b3c
Only values OpenCodex itself owns are printed: provider id, model id and the existing opaque account label (main, p…, o…). Nothing upstream-authored is added, so the redaction rules from #8104 are unchanged.
Example usage or interface
No new flag. Existing behaviour is the default; only the line above gains three optional key=value fields. A possible follow-up, separate from this request, is the local request id (ocx-…) and the upstream x-request-id (already captured as upstreamRequestId) to make the line joinable with usage.jsonl.
A diff against v2.100.8 is included below: a few lines in src/server/request-log-terminal-status.ts.
Alternatives or workarounds
ocx debug/OCX_DEBUG=1are opt-in and, as far as I can tell, do not change this warning.- Reading
usage.jsonlworks, but only with a timestamp join that is ambiguous under concurrency. - #8957 (Antigravity native log traces) is opt-in and Antigravity-specific; this request is the always-on line for every provider.
Additional context
- Version:
@bitkyc08/opencodex2.100.8 (still the latest release anddevhead at the time of writing). OS: macOS. - Related: #9032 (open, Anthropic pool 429 leaves a misleading account state) shares the same diagnosability gap. #8398 (auto-resume) and #8993 (live quota in account lists, PR) improve recovery and display, not log attribution.
- The
account=field may be missing on the first failure line if the label is assigned after the first diagnostic is captured; I have not verified the ordering for every provider. - All identifiers above are masked or generic; no emails, tokens or paths are included.
Checks
- I searched existing issues and documentation.
- This request describes a concrete OpenCodex workflow rather than merely naming a desired technology.
- I removed secrets and personal data.
Suggested patch (against v2.100.8, not compiled or tested)
diff --git a/src/server/request-log-terminal-status.ts b/src/server/request-log-terminal-status.ts
index 921e68948..521f6f519 100644
--- a/src/server/request-log-terminal-status.ts
+++ b/src/server/request-log-terminal-status.ts
@@ -12,6 +12,7 @@ import {
upstreamErrorMessageFromPayload,
} from "../lib/errors";
import { redactSecretString } from "../lib/redact";
+import { ACCOUNT_LOG_LABEL_RE } from "../codex/account-label";
import { SENT_VALUE_GUARD_SCAN_CHARS, outboundCredentials, type OutboundCredentialRegistry } from "../lib/outbound-credential-registry";
import { configuredCredentials, containsConfiguredCredentialExcerpt, type ConfiguredCredentials } from "./configured-credentials";
import { isUntypedBareUpstreamError, reduceBareUpstreamEvidence, wrappedServerErrorStatus, type BareUpstreamError, type BareUpstreamEvidence } from "./bare-upstream-error";
@@ -32,6 +33,10 @@ interface TerminalStatusContext extends UpstreamErrorDiagnostics {
terminalErrorCode?: typeof CYBER_POLICY_ERROR_CODE;
committedIncompleteReason?: CommittedIncompleteReason | null;
upstreamError?: string;
+ /** Routing identity already held by RequestLogContext; printed so a failure line is attributable. */
+ provider?: string;
+ model?: string;
+ accountLogLabel?: string;
}
export interface UpstreamErrorPayload {
@@ -105,7 +110,10 @@ function noteBoundedDiagnostic(
// Service logs persist too: print only closed-vocabulary values, never an upstream id or code.
const { upstreamErrorCode: rawCode, upstreamErrorType: type } = upstreamDiagnosticLogFields(logCtx);
const code = rawCode !== undefined && KNOWN_BARE_ERROR_CODES.has(rawCode) ? rawCode : undefined;
- console.warn(`[opencodex] upstream failure${status ? ` status=${status}` : ""}${type ? ` type=${type}` : ""}${code ? ` code=${code}` : ""}`);
+ // provider/model are routing config and the account label is an opaque hash: none is upstream-authored.
+ const account = logCtx.accountLogLabel !== undefined && (logCtx.accountLogLabel === "main" || ACCOUNT_LOG_LABEL_RE.test(logCtx.accountLogLabel)) ? logCtx.accountLogLabel : undefined;
+ console.warn(`[opencodex] upstream failure${status ? ` status=${status}` : ""}${type ? ` type=${type}` : ""}${code ? ` code=${code}` : ""}`
+ + `${logCtx.provider ? ` provider=${logCtx.provider}` : ""}${logCtx.model ? ` model=${logCtx.model}` : ""}${account ? ` account=${account}` : ""}`);
}
}
- Dominant language
- TypeScript
- Stars
- 16.9k
- Forks
- 1.3k
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 814
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from lidge-jun/opencodex
-
bug gui platform
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
lidge-jun/opencodex#9172 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
[Provider] antigravity-acp catalog omits gemini-4-hydrogen and gemini-4-neon that agy acp offersPossibly taken @sedoll claimed this 6 days ago. Opencatalog provider provider-compatibility
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
lidge-jun/opencodex#9037 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
bug cli
Difficulty 4/5 3-5 days Newbie friendliness 52/100
lidge-jun/opencodex#9171 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
account-pool enhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
Maintainers usually reply within 1 day
-
account-pool enhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
lidge-jun/opencodex#9165 · 2 comments · 1 reaction ·
Maintainers usually reply within 1 day
All issues in lidge-jun/opencodex
Similar issues
-
manually bump balena-preload to ^19.0.6Possibly taken @shaunmulligan claimed this today. Open
Difficulty 1/5 1-3 hours Newbie friendliness 66/100
balena-io/balena-cli#3200 ·
Maintainers usually reply within 1 day
-
`MaterializedChatMessage._text` is quadratic in the number of text chunks (`+=` followed by `endsWith`), driving the extension host to heap OOMPossibly taken @olegius88 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
microsoft/vscode-prompt-tsx#205 ·
-
triage
Difficulty 1/5 Under an hour Newbie friendliness 64/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
melgarafael/DeskcommCRM#5340 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
ehmpathy/rhachet-roles-ehmpathy#1529 ·
Maintainers usually reply within 1 day