Skip to content

reliability: fix audited lifecycle and state edge cases - #962

Open
yisding wants to merge 1 commit into
mainfrom
agent/bug-audit-followup
Open

reliability: fix audited lifecycle and state edge cases#962
yisding wants to merge 1 commit into
mainfrom
agent/bug-audit-followup

Conversation

@yisding

@yisding yisding commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Problem

A broad reliability audit found lifecycle races, dropped task failures, inconsistent state serialization, and persistence/validation edge cases that could surface under cancellation, shutdown, parallel execution, or malformed inputs.

Changes

  • harden runtime, server, session, STT, and transport task ownership and teardown retry behavior
  • preserve and serialize agent, journal, and turn state consistently across failure paths
  • improve telephony retry/classification, debugger safeguards, and latency validation boundaries
  • add focused regressions and refresh reviewed lifecycle/source ratchets

Impact

Shutdown remains bounded while retaining failed work for an explicit retry, background failures are observed instead of leaked, and persisted/validated state is deterministic across concurrent and degraded paths.

Validation

  • full credential-free suite: 9,195 passed, 209 skipped, 69 deselected
  • Ruff lint: passed
  • Ruff format check: passed
  • mypy: passed for 289 source files
  • ratchet suite: 48 passed
  • final diff, conflict-marker, and worktree integrity checks: passed

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@yisding, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 55 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: fcea7464-8ef0-4513-8b98-17b1688b3d7e

📥 Commits

Reviewing files that changed from the base of the PR and between b59cbec and 2b0659c.

📒 Files selected for processing (86)
  • src/easycat/_concurrency.py
  • src/easycat/config/_factory.py
  • src/easycat/config/easy.py
  • src/easycat/debugger/server.py
  • src/easycat/integrations/agents/_agent_runner.py
  • src/easycat/integrations/agents/_state_serialization.py
  • src/easycat/integrations/agents/generic_workflow.py
  • src/easycat/integrations/agents/langchain.py
  • src/easycat/integrations/agents/langgraph.py
  • src/easycat/integrations/agents/llama_agents.py
  • src/easycat/integrations/agents/openai_agents.py
  • src/easycat/integrations/agents/pydantic_ai.py
  • src/easycat/integrations/agents/responses_api.py
  • src/easycat/integrations/agents/template.py
  • src/easycat/runtime/journal_sql.py
  • src/easycat/runtime/scope.py
  • src/easycat/server/transports.py
  • src/easycat/server/voice_server.py
  • src/easycat/session/_audio_router.py
  • src/easycat/session/_debug_backends.py
  • src/easycat/session/_journal_sink.py
  • src/easycat/session/_session.py
  • src/easycat/session/_stt_committer.py
  • src/easycat/session/_turn_runner.py
  • src/easycat/session_manager.py
  • src/easycat/stages/turn.py
  • src/easycat/telephony/call_state.py
  • src/easycat/telephony/retry.py
  • src/easycat/telephony/voicemail.py
  • src/easycat/timeouts.py
  • src/easycat/transports/_webrtc_stats.py
  • src/easycat/transports/local.py
  • src/easycat/transports/webrtc.py
  • src/easycat/turn_manager.py
  • src/easycat/validation/_latency_artifacts.py
  • src/easycat/validation/_latency_baseline.py
  • src/easycat/validation/_latency_budgets.py
  • src/easycat/validation/_latency_models.py
  • src/easycat/validation/redaction.py
  • tests/cli/test_doctor.py
  • tests/config/test_session_creation.py
  • tests/core/test_timeouts.py
  • tests/debugger/_server_helpers.py
  • tests/debugger/test_aec_diagnostics.py
  • tests/debugger/test_server_replay_export.py
  • tests/debugger/test_server_rest_api.py
  • tests/debugger/test_server_route_controller.py
  • tests/debugger/test_server_security_origin.py
  • tests/integration/test_session_pipeline.py
  • tests/integrations/agents/test_agent_runner.py
  • tests/integrations/agents/test_bridge_template.py
  • tests/integrations/agents/test_generic_workflow_bridge.py
  • tests/integrations/agents/test_pydantic_ai_v2.py
  • tests/ratchets/pause-generation-manifest.json
  • tests/ratchets/source-baseline.json
  • tests/ratchets/teardown-budget-manifest.json
  • tests/ratchets/turn-commit-manifest.json
  • tests/ratchets/turn-lifecycle-manifest.json
  • tests/runtime/test_scope.py
  • tests/runtime/test_sqlite_journal.py
  • tests/server/test_capacity_gate_drain.py
  • tests/server/test_shutdown_draining.py
  • tests/server/test_voice_server_lifecycle.py
  • tests/server/test_websocket_runtime_drain.py
  • tests/session/test_audio_router.py
  • tests/session/test_journal_sink.py
  • tests/session/test_session_journal_accounting.py
  • tests/session/test_session_lifecycle_teardown.py
  • tests/session/test_session_manager.py
  • tests/session/test_session_stop_ordering.py
  • tests/session/test_session_streaming_behavior.py
  • tests/session/test_stt_committer.py
  • tests/session/test_turn_runner.py
  • tests/stages/test_stages.py
  • tests/teaching/test_chapter_15_doctor_contract.py
  • tests/telephony/test_call_state_basics.py
  • tests/telephony/test_call_state_gate.py
  • tests/telephony/test_outbound_config.py
  • tests/telephony/test_retry_strategy.py
  • tests/telephony/test_voicemail.py
  • tests/transports/test_local_transport.py
  • tests/transports/test_webrtc_lifecycle_server.py
  • tests/transports/test_webrtc_stats_artifacts.py
  • tests/turns/test_turn_manager.py
  • tests/validation/test_latency_boundaries.py
  • tests/validation/test_latency_percentiles.py

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.

@yisding
yisding marked this pull request as ready for review August 7, 2026 14:07
try:
cleanup_error = await self._close_unpublished_peer(pc)
except asyncio.CancelledError:
if self._pending_peer_cleanup is pc:

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

Copy link
Copy Markdown

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: 2b0659c7f3

ℹ️ 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 on lines +329 to +332
if type(telephony) is not TelephonyConfig:
raise EasyConfigError("telephony must be a TelephonyConfig instance or None.")
outbound = telephony.outbound
if outbound is not None and type(outbound) is not OutboundCallConfig:

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 Accept telephony configuration subclasses during copying

When a caller supplies a subclass of TelephonyConfig or OutboundCallConfig, create_session() now rejects it before build validation, even though EasyConfig.validate_for_build() explicitly accepts subclasses with isinstance() and the previous copy path handled them. This breaks otherwise valid extensions that add telephony policy fields; use subclass-aware checks for both guards or validate before copying.

Useful? React with 👍 / 👎.

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.

2 participants