openclaw/extensions/codex/src/app-server/timeout.ts
Peter Steinberger 83a4208aed
fix(codex): full-auto approvals survive relay unavailability, typed failure classification, usage line after fallback (#108626)
* fix(codex): full-auto approvals survive relay unavailability, typed failure classification, usage line after fallback

- full-auto (approvalPolicy never + danger-full-access) exec approvals no
  longer get declined when the native hook relay is unreachable BEFORE
  invocation; an invoked relay's explicit deny, malformed output, or nonzero
  exit still fails closed (#107447)
- startup timeout/abort and request-timeout classification use typed error
  discriminants instead of message prose; EPIPE detection walks error causes;
  compaction keeps the message-based thread-not-found gate because codex-rs
  exposes no dedicated code (its own contract test asserts the message) and
  the generic -32600 would over-match unrelated invalid requests (#99270)
- /status keeps the Codex usage/quota line for sessions whose persisted
  agentHarnessId is codex even when the effective runtime fell back to
  OpenClaw Default; never-codex sessions remain excluded (#105184)

* chore(codex): keep startup error reason type module-local
2026-07-15 22:12:35 -07:00

18 lines
559 B
TypeScript

/**
* Thin Codex app-server timeout adapter around OpenClaw's shared security
* runtime timeout helper.
*/
import { withTimeout as withSharedTimeout } from "openclaw/plugin-sdk/security-runtime";
/** Awaits a promise with a Codex-specific timeout error message. */
export async function withTimeout<T>(
promise: Promise<T>,
timeoutMs: number,
timeoutMessage: string,
createError?: () => Error,
): Promise<T> {
return await withSharedTimeout(promise, timeoutMs, {
message: timeoutMessage,
...(createError ? { createError } : {}),
});
}