Skip to content

feat(ops): add voice-call escalations and OpsEscalationManager#7

Open
EvezArt wants to merge 1 commit intocodex/implement-self-play-browser-daemon-featuresfrom
codex/setup-openclaw-project-structure-and-code
Open

feat(ops): add voice-call escalations and OpsEscalationManager#7
EvezArt wants to merge 1 commit intocodex/implement-self-play-browser-daemon-featuresfrom
codex/setup-openclaw-project-structure-and-code

Conversation

@EvezArt
Copy link
Copy Markdown
Owner

@EvezArt EvezArt commented Feb 5, 2026

Motivation

  • Enable an automated representative path that escalates pipeline progress or failures to operators via outbound calls and fallback channels.
  • Avoid eager environment parsing at module import to improve boot reliability and allow safe test isolation.
  • Provide focused unit tests for escalation threshold and decision-required behavior to ensure deterministic alerts.

Description

  • Added a Twilio voice-call adapter TwilioVoiceAdapter that posts TwiML to the Twilio Calls API with escaped speech content.
  • Implemented OpsEscalationManager to notify on progress threshold crossings and to send decision-required escalations; wired it into the orchestration runFull() pipeline so progress updates and terminal failures trigger escalations.
  • Extended notification typing/routing to include voice as a NotificationChannel and to prefer voice/sms/whatsapp order for CRITICAL alerts, with a PriorityNotificationRouter implementation.
  • Added ops environment schema, parsing helpers, and resetOpsConfigCache() in src/config/schema.ts and removed eager opsConfig side-effects so adapters and logger resolve config lazily at send time.
  • Added pino-based logger utilities in src/logger/index.ts that read LOG_LEVEL from process.env without depending on ops config.
  • Introduced market intelligence providers (CoinGecko, Binance, AlphaVantage), a simple RateLimiter, SelfHealingSupervisor for managed services, a StripeBillingService helper, and an scripts/ops-run.ts CLI runner to exercise the pipeline.
  • Added unit tests for the escalation manager (src/notifications/ops-escalation.test.ts) and a small test tweak to src/commands/quantum.test.ts.
  • Fixed lint issues (removed unnecessary escape in TwiML string) and normalized config/test imports to allow deterministic test isolation.

Testing

  • Ran pnpm lint and lint passed with the TwiML escaping fix applied.
  • Ran pnpm build which completed successfully.
  • Ran unit tests with pnpm vitest run src/notifications/ops-escalation.test.ts src/commands/quantum.test.ts and both test files passed (20 tests total).

Codex Task

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 068378f557

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/ops/orchestrator.ts

export async function runFull(): Promise<void> {
const context: TaskContext = {};
const escalation = new OpsEscalationManager(new TwilioVoiceAdapter());
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Route critical escalations through fallback channels

Creating OpsEscalationManager with new TwilioVoiceAdapter() means every escalation is voice-only, so a voice-call failure (Twilio voice outage, invalid voice capability, or call rejection) drops the alert instead of falling back to SMS/WhatsApp even though PriorityNotificationRouter was added for that purpose. This makes critical pipeline failure notifications single-point-of-failure in production.

Useful? React with 👍 / 👎.

import { getLogger } from "../../logger/index.js";
import { type IMarketProvider, type MarketQuote, RateLimiter } from "./types.js";

const config = getOpsConfig();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid parsing full ops config at module import

Calling getOpsConfig() at module scope forces full env validation during import, so importing providers/orchestrator fails immediately when any required ops variable is missing, before runFull() reaches its config task, retry loop, or decision-required escalation path. This reintroduces eager startup side effects and makes the pipeline brittle in partially configured environments.

Useful? React with 👍 / 👎.

Comment thread src/ops/orchestrator.ts
Comment on lines +206 to +210
await escalation.notifyDecisionRequired({
stage: task.name,
summary: "Ops pipeline failed and requires operator decision before continuing.",
});
throw error;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve task failure when escalation delivery fails

Inside the task failure handler, await escalation.notifyDecisionRequired(...) runs before rethrowing the original error; if notification delivery throws (for example, Twilio API timeout), this new error escapes and masks the real task failure. In incidents where both the task and notifier fail, operators lose the root-cause exception from the pipeline stage.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant