Skip to content

fix: harden runtime concurrency and production guardrails - #106

Merged
CoreyLeath-code merged 10 commits into
mainfrom
codex/production-runtime-hardening
Nov 13, 2026
Merged

CoreyLeath-code merged 10 commits into
mainfrom
codex/production-runtime-hardening

Conversation

@CoreyLeath-code

@CoreyLeath-code CoreyLeath-code commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • serialize execution and approval decisions for a run ID within a runtime process, preventing duplicate tool execution from concurrent requests
  • make the SQLite checkpoint store safe for concurrent FastAPI background work with locking, WAL mode, full synchronous commits, and a busy timeout
  • reject stale approval decisions with an API 409 Conflict
  • bound Prometheus endpoint labels to route templates and record unhandled 500s
  • retain machine-readable dependency-audit findings as workflow evidence
  • add regression coverage for concurrent execution and stale approvals

Validation

  • existing PR CI runs the Python matrix, API/container checks, and security workflow
  • targeted concurrency behavior is covered by the added runtime tests

Security follow-up

The audit currently reports 62 pre-existing dependency vulnerabilities across six packages. This PR preserves the report artifact but does not turn it into a required gate, because doing so would permanently fail the default branch until coordinated dependency upgrades are validated. Those upgrades should be a dedicated remediation PR.

Scope

The runtime lock is intentionally process-local. SQLite remains documented as single-node checkpoint durability; distributed workers still require shared coordination and a shared store.

@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7c5d7e79-85cc-4d32-afd2-c852445dfd74
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T16:17:41.826516Z 8e5221f PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 8e5221fbd5

ℹ️ 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 agent/autonomy/runtime.py
Comment on lines +241 to +243
lock = self._lock_for_run(run_id)
with lock:
run = self._approve_locked(run_id, task_id, approved)

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 Offload approval locking from the API event loop

When an approval request arrives while the same run is executing (for example, a retried approval POST after execution resumes), this synchronous lock acquisition blocks until the entire execution finishes. api/main.py calls runtime.approve() directly inside the async decide_approval handler, while the background execution holds this lock across tool calls and retries. Consequently, one stale approval request can freeze unrelated requests, including health checks, on that API worker for the remaining execution time instead of promptly returning a conflict. Run the blocking approval operation in a thread pool, or make the route synchronous so FastAPI offloads it.

Useful? React with 👍 / 👎.

@CoreyLeath-code
CoreyLeath-code merged commit e22fed2 into main Nov 13, 2026
16 checks passed
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