Skip to content

Harden provider admission and transport telemetry - #232

Merged
pmbstyle merged 1 commit into
mainfrom
agent/harden-provider-admission-telemetry
Aug 15, 2026
Merged

Harden provider admission and transport telemetry#232
pmbstyle merged 1 commit into
mainfrom
agent/harden-provider-admission-telemetry

Conversation

@pmbstyle

@pmbstyle pmbstyle commented Aug 15, 2026

Copy link
Copy Markdown
Owner

Summary

  • Raise local provider capacity to three total turns with two background turns, preserving one interactive slot.
  • Bound background admission waits and defer scheduled attempts instead of letting them wait indefinitely.
  • Add redacted app-server transport diagnostics with session, phase, lane, thread, turn, PID, exit state, stderr digest, and protocol context.
  • Capture child exit state and stderr briefly when stdout closes.
  • Add regression coverage for admission deferral and transport telemetry.

Why

Background work could starve behind a busy provider admission queue, and transport EOFs did not carry enough context to distinguish a session, turn, or child process. The change keeps scheduled work retryable without marking it as a task failure and makes future transport incidents diagnosable without logging prompts or secrets.

Validation

  • uv run pytest -q — passed; one Windows PID semantics test skipped.
  • uv run ruff check . — passed.
  • uv run black --check . — passed.

Summary by CodeRabbit

  • New Features

    • Increased concurrent processing capacity for interactive and background tasks.
    • Added bounded waiting with automatic retry scheduling when capacity is temporarily unavailable.
    • Deferred attempts now release resources and are recorded separately from failures.
  • Bug Fixes

    • Improved diagnostics for interrupted provider processes and transport errors.
    • Added redacted telemetry to help troubleshoot session and execution issues without exposing sensitive identifiers.

@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: dcd4828b-f074-4a79-95e4-71fe14d9f574

📥 Commits

Reviewing files that changed from the base of the PR and between bf411c9 and 0489ac2.

📒 Files selected for processing (7)
  • src/octopal/infrastructure/providers/base.py
  • src/octopal/infrastructure/providers/codex_provider.py
  • src/octopal/runtime/octo/scheduled_runtime.py
  • src/octopal/runtime/scheduler/service.py
  • tests/test_codex_provider_sessions.py
  • tests/test_scheduler_leases.py
  • tests/test_scheduler_safety.py

📝 Walkthrough

Walkthrough

The PR adds bounded Codex background admission with a public deferral exception, propagates redacted diagnostic context through app-server lifecycle events, and records provider admission deferrals as scheduler retries without counting them as failures.

Changes

Provider admission and retry flow

Layer / File(s) Summary
Bounded provider admission
src/octopal/infrastructure/providers/base.py, src/octopal/infrastructure/providers/codex_provider.py, tests/test_codex_provider_sessions.py
Background admission now uses separate capacity and a 60-second timeout. Timeout handling raises ProviderAdmissionDeferred with normalized wait and retry values.
Diagnostic context and transport reporting
src/octopal/infrastructure/providers/codex_provider.py, tests/test_codex_provider_sessions.py
Request and transport telemetry now includes redacted session, phase, lane, thread, turn, and process context. EOF handling records child exit diagnostics after waiting for termination.
Deferred scheduler attempts
src/octopal/runtime/octo/scheduled_runtime.py, src/octopal/runtime/scheduler/service.py, tests/test_scheduler_leases.py, tests/test_scheduler_safety.py
Scheduled dispatch records provider admission deferrals, releases the active attempt, schedules retry metadata, and avoids generic error counting.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CodexProvider
  participant ScheduledRuntime
  participant SchedulerService
  CodexProvider->>CodexProvider: Wait for background admission deadline
  CodexProvider-->>ScheduledRuntime: Raise ProviderAdmissionDeferred
  ScheduledRuntime->>SchedulerService: defer_attempt with retry timing
  SchedulerService->>SchedulerService: Record deferred outcome and sync schedule
Loading

Possibly related PRs

  • pmbstyle/Octopal#222: Modifies Codex provider session and turn lifecycle handling, including resumable sessions and diagnostic context.
  • pmbstyle/Octopal#225: Modifies Codex app-server transport, EOF diagnostics, telemetry context, and turn handling.
  • pmbstyle/Octopal#228: Modifies Codex admission, session lane propagation, and telemetry.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/harden-provider-admission-telemetry

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.

@pmbstyle pmbstyle self-assigned this Aug 15, 2026
@pmbstyle
pmbstyle marked this pull request as ready for review August 15, 2026 13:48
@pmbstyle
pmbstyle merged commit 3ebbf81 into main Aug 15, 2026
6 of 7 checks passed
@pmbstyle
pmbstyle deleted the agent/harden-provider-admission-telemetry branch August 15, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant