Repository navigation
fix(github): enforce gh request throttling, disk quota persistence, and diff-only project sync (#211) - #212
Merged
dan-petty merged 21 commits intoSep 15, 2026
Conversation
…nce, and diff-only project sync (#211)
…quota safety guards (#211)
…f defaults submodule
…and pre-push quality gate (#211)
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved critical workflow security exposure and multiple moderate correctness issues remain.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This PR adds GitHub request pacing and quota persistence, implements diff-only project synchronization, removes PR-thread REST fallbacks, and updates sandbox defaults and related coverage.
Changes:
- Adds adaptive, persistent GitHub quota management.
- Reconciles project fields only when values differ.
- Updates sandbox, workflow, documentation, and test support.
File summaries
| File | Reviewed change / final note |
|---|---|
tests/test_valkey.py |
Valkey CLI error-path coverage. |
tests/test_ui_dashboard.py |
Dashboard lifecycle timing stabilization. |
tests/test_test_runner.py |
Sandbox and profiling coverage. Nit (1 vote): use example.com consistently instead of api.service in fixtures. |
tests/test_repos.py |
Repository command coverage. |
tests/test_pr_cmd.py |
Pull-request command coverage. |
tests/test_github_projects.py |
Project synchronization coverage. |
tests/test_github_projects_reconcile.py |
Project field reconciliation coverage. |
tests/test_github_pr_threads.py |
GraphQL review-thread coverage. |
tests/test_argo_gitops.py |
Argo manifest handling coverage. |
src/devops_cli/watchers/live_resource.py |
Watcher maintenance. |
src/devops_cli/watchers/file_watcher.py |
File-watcher maintenance. |
src/devops_cli/valkey/rate_limiter.py |
Valkey limiter updates. |
src/devops_cli/valkey/client.py |
Valkey client updates. |
src/devops_cli/security/sbom.py |
SBOM metadata handling. |
src/devops_cli/security/gitleaks.py |
Safe-file filtering updates. |
src/devops_cli/security/dependency_remediator.py |
Dependency remediation updates. |
src/devops_cli/security/complexity.py |
Complexity scan maintenance. |
src/devops_cli/security/checkov.py |
IaC path filtering updates. |
src/devops_cli/security/aibom.py |
AIBOM metadata handling. |
src/devops_cli/sandbox/models.py |
Sandbox network-mode validation. |
src/devops_cli/k8s/policy.py |
Kubernetes policy maintenance. |
src/devops_cli/k8s/logs.py |
Kubernetes logging maintenance. |
src/devops_cli/k8s/logql.py |
Log query maintenance. |
src/devops_cli/k8s/credentials.py |
Credential handling updates. |
src/devops_cli/k8s/chaos.py |
Kubernetes chaos maintenance. |
src/devops_cli/github/projects.py |
Cached project reconciliation. Moderate (2 votes): distinguish a valid empty item list from {} fetch failure. Moderate (1 vote): validate nested response mappings before chained .get() calls. Moderate (1 vote): invalidate or bypass the 60-second cache after item mutations. Moderate (1 vote): preserve unknown field state on fallback and skip mutations until values are fetched. |
src/devops_cli/github/pr_threads.py |
GraphQL-only review-thread operations. |
src/devops_cli/github/pr_monitor.py |
Pull-request monitoring updates. |
src/devops_cli/exceptions/git.py |
GitHub rate-limit exception support. |
src/devops_cli/exceptions/__init__.py |
Exception exports. |
src/devops_cli/docker/sandbox.py |
Sandbox network configuration. Moderate (3 votes): use the centralized isolated default in the validator and Docker command defaults instead of bridge. |
src/devops_cli/core/process.py |
Subprocess environment isolation. |
src/devops_cli/config/settings.py |
Configuration path hardening. |
src/devops_cli/config/defaults.py |
Centralized defaults. Moderate (2 votes): SBOM/AIBOM default version 0.1.0 conflicts with package version 0.2.18. Moderate (1 vote): sandbox and Docker entry points still use literal bridge defaults. |
src/devops_cli/config/constants.py |
Shared constants. |
src/devops_cli/config/commands.py |
Command configuration updates. |
src/devops_cli/config/__init__.py |
Configuration exports. |
src/devops_cli/commands/vault.py |
Vault error sanitization. |
src/devops_cli/commands/test_cmd.py |
Sandbox validation and masking. Moderate (1 vote): reuse canonical network-mode constants and aliases. Moderate (2 votes): delegate whitelist URL validation to the shared sandbox model rather than the restrictive regex. |
src/devops_cli/commands/repos.py |
Repository command updates. |
src/devops_cli/commands/pr.py |
Pull-request command updates. |
src/devops_cli/commands/k8s/cluster_context.py |
Cluster output masking. |
src/devops_cli/argo/rollouts.py |
Rollout maintenance. |
src/devops_cli/argo/gitops.py |
Manifest path safeguards. |
src/devops_cli/argo/fleet.py |
Argo fleet maintenance. |
src/devops_cli/ai/test_gen.py |
Test-generation updates. |
src/devops_cli/ai/tasks/review.md |
Review task guidance. |
src/devops_cli/ai/router.py |
AI routing updates. |
src/devops_cli/ai/review_schema.py |
Review schema updates. |
src/devops_cli/ai/response_repair.py |
Response repair updates. |
src/devops_cli/ai/repomap.py |
Repository mapping updates. |
src/devops_cli/ai/rag/indexer.py |
Indexing path safeguards. |
src/devops_cli/ai/pydantic_ai_bridge.py |
Provider bridge updates. |
src/devops_cli/ai/mcp/server.py |
MCP integration updates. |
src/devops_cli/ai/instruction_generator.py |
Instruction generation updates. |
src/devops_cli/ai/harness/filesystem.py |
Filesystem symlink safeguards. |
src/devops_cli/ai/function_signature.py |
Function signature updates. |
src/devops_cli/ai/format_prompt.py |
Prompt formatting updates. |
src/devops_cli/ai/durable.py |
Durable-state updates. |
src/devops_cli/ai/context_packer.py |
Context packing updates. |
src/devops_cli/ai/concurrency.py |
AI concurrency updates. |
src/devops_cli/ai/common_tools.py |
AI tool maintenance. |
src/devops_cli/ai/agents/media.py |
Media handling updates. |
src/devops_cli/ai/agents/guardrails.py |
Guardrail updates. |
src/devops_cli/ai/agents/embeddings.py |
Embedding helper updates. |
src/devops_cli/ai/agents/capabilities.py |
Capability updates. |
src/devops_cli/ai/agents/agent.py |
AI agent refactor. |
docs/SELF_IMPROVEMENT.md |
Remediation records. Nit (1 vote): documented Docker sandbox default does not match the bridge default in the entry point. Nit (1 vote): the documented run_gh() PR-check fallback still uses direct gh api. |
docs/MCP_TOOLS.md |
Sandbox default documentation. |
docs/ERRORS.md |
Rate-limit error documentation. |
docs/commands/test.md |
Test command documentation. |
docs/CLI_REFERENCE.md |
CLI reference updates. |
docs/agent/tasks/task-211-rate-limit-budget-pacing-project-sync.md |
Task acceptance record. Nit (1 vote): the no-REST claim overstates coverage because PR monitor requests still call gh api directly. |
AGENTS.md |
Engineering workflow guidance. |
.pre-commit-config.yaml |
Pre-push CI enforcement. |
.github/workflows/project-automation.yml |
Project synchronization workflow. Critical (1 vote): PR-tree code runs with GH_TOKEN and project write access; use trusted base-branch or pinned code. Moderate (2 votes): concurrency permits simultaneous reconciliations; serialize or coalesce runs project-wide. |
.github/workflows/ci.yml |
CI trigger adjustments. |
Review details
Suppressed comments (15)
docs/SELF_IMPROVEMENT.md:198
- This documentation claims the default changed for
devops docker sandbox, but that command still declaresnetwork="bridge"insrc/devops_cli/commands/docker.pyand passes it through unchanged. Update the Docker entry point to use the isolated default (or correct this claim); otherwise users receive a networked sandbox despite the documented security default.
- Switched default network mode from insecure `bridge` to `isolated` across `devops test sandbox`, `devops docker sandbox`, and FastMCP tools (`docker_sandbox`, `sandbox_deploy`, `sandbox_network_policy`).
docs/SELF_IMPROVEMENT.md:213
- This session record says PR check fallbacks were routed through
run_gh(), but_render_pr_checks_fallback()still invokesrun_subprocess(["gh", "api", ...])insrc/devops_cli/commands/pr.py. The claim is false and the fallback still bypasses the centralized GitHub pacing/quota accounting; either migrate that call or document the remaining exception accurately.
- Routed PR check fallbacks through `run_gh()` with secret masking.
docs/agent/tasks/task-211-rate-limit-budget-pacing-project-sync.md:42
- The acceptance record overstates the implementation:
src/devops_cli/github/pr_monitor.pystill resolves PRs and fetches details, reviews, checks, status, and Copilot timeline through directrun_subprocess(["gh", "api", ...])calls. Those monitor requests bypass the new limiter, so this line must either be narrowed to PR-thread operations or the monitor's REST calls must be migrated before marking the no-REST deliverable complete.
- Decoupled GitHub Projects v2 automation and card synchronization from the heavy CI quality gate.
src/devops_cli/commands/test_cmd.py:263
- This new local mode set duplicates
SandboxNetworkModeand the centralized mode/alias constants, and it omits accepted aliases such asnamespace,public, andlocal. The test sandbox therefore rejects modes that the underlying model accepts and will drift when a mode is added; validate through the shared model or reuse its canonical constants.
src/devops_cli/config/defaults.py:504 - This new constant is not wired into all sandbox CLI entry points:
commands/sandbox.py:113andcommands/docker.pystill pass a literal"bridge"default. Thusdevops sandbox deployanddevops docker sandboxretain the insecure default while onlydevops test sandboxusesisolated; update the other entry points as part of the default change.
src/devops_cli/github/projects.py:1269 - A successful process response can still contain
data,repository, orprojectsV2asnullor a non-mapping value. This chained.get()then raisesAttributeErrorinstead of returning the already-established empty result(None, None, []); validate each nested mapping before traversing it.
src/devops_cli/github/projects.py:700 - This cached item-list is also used by
sync_remote_projectbefore and aftersync_repository_issues_to_project; newly added items can therefore be hidden by the 60-second cache during the immediate reconciliation pass. Their custom fields are not initialized until a later run. Invalidate this query after item mutations, or bypass the cache for the post-mutation reconciliation fetch.
src/devops_cli/github/projects.py:730 - When the structured item-list query fails or cannot be parsed, this fallback returns every URL with all field values set to
None._filter_differing_fields()treats eachNoneas drift, so reconciliation then issues all five field mutations for every fallback item—the broad mutation behavior this PR is intended to eliminate. Preserve an explicit unknown state and skip field edits until current values are fetched successfully.
src/devops_cli/github/rate_limiter.py:928 acquire()already decrements a valid quota before every request, so this headerless-response path charges the same request a second time. GraphQL mutations without arateLimitselection will therefore consume two estimated tokens per call and can trigger the low-quota circuit breaker prematurely; make the pre-request debit and post-request estimate mutually exclusive.
src/devops_cli/github/rate_limiter.py:516- When quota resolution fails, this handler converts
GitHubRateLimitErrorintomin_interval(0.0 by default) and continues. An unknown or expired quota can therefore send the request immediately, defeating the exhaustion-prevention guarantee; let the error propagate or fail closed with a bounded wait instead.
src/devops_cli/github/rate_limiter.py:409 - Because this valid local state returns before the disk reload below, a long-lived process never observes quota decrements persisted by another process while its own state remains valid. That defeats cross-process quota accounting and lets each process pace from stale remaining values; reload/merge the persisted state before reserving quota, with inter-process coordination.
src/devops_cli/github/rate_limiter.py:149 - The temporary-file replacement is atomic against partial writes, but it does not serialize processes or merge their current quota state. Two processes can decrement the same old value and the last replacement can erase the other request's usage, so the disk cache undercounts consumption; protect the read-modify-write sequence with an inter-process lock or equivalent.
src/devops_cli/github/rate_limiter.py:943 - The public
costargument is accepted byrun_gh, but the normal execution path calls_post_process_run()without passing it, so headerless requests always decrement the quota estimate by 1. Any caller supplying a higher GraphQL cost therefore gets no protection; propagatecostthrough both normal and paginated execution paths.
src/devops_cli/github/rate_limiter.py:58 - The quota model’s validation path raises a bare
ValueError(and the same pattern is repeated throughout this limiter), which violates the repository’s domain-exception contract (AGENTS.md:330). Use aDevOpsCLIError-derived GitHub quota exception for invalid state so callers receive the canonical exit code/error metadata; retainValueErroronly through multiple inheritance if compatibility with these tests is required.
tests/test_test_runner.py:139 - Repository test fixtures use the bare
example.complaceholder; introducingapi.servicecreates a nonstandard internal-looking dummy hostname and violates the repository's fixture sanitization convention. Useexample.comconsistently, including for the port-bearing token.
- Files reviewed: 79/79 changed files
- Comments generated: 7
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
dan-petty
added a commit
that referenced
this pull request
Sep 16, 2026
* feat(release): v0.2.18 * fix(security): harden secret sanitizer boundaries and safe path exclusions (#116) (#203) * fix(security): harden secret sanitizer boundaries and safe path exclusions (#116) * fix(release): default release PRs to draft mode * fix(security): harden secret boundaries, remove extension lookahead, and update task status (#116) * fix(security): remediate devsecops findings and add native rate management (#204) * test * fix(security): remediate devsecops findings and add native rate management * docs(task): update task-204 status to in review and link PR #204 * fix(security): permit token masking in filesystem path arguments * fix(security): remediate review findings, exclude home in sandbox, and relocate MockProvider (#205) (#206) * fix(security): remediate review findings, exclude home in sandbox, and relocate MockProvider (#205) * docs(task): update task-205 status to in review and link PR #206 * test(sandbox): provide explicit tmp_path workspace_dir in test_docker_sandbox_wait_timeout * fix(rag): support both gitignore and gitwildmatch pathspec factories * feat(sandbox): multi-tier networking options and decommission task.md (#207) (#208) * feat(sandbox): multi-tier networking options and decommission task.md index (#207) * docs(agent): transition task 207 to in-review with PR #208 * test(projects): update test fixtures to eliminate task.md references * fix(security): replace concrete RFC 1918 and internal homelab endpoints with standard documentation values * fix(sandbox): harden network containment, secret output masking, and rate limiter caching * fix(sandbox): remediate egress containment, dns resolution, and output masking findings (#207) * fix(security): stream sandbox container output directly to sys streams avoiding logger sink cleartext alerts (#207) * docs(agents): mandate working pull requests from oldest to newest (FIFO) * docs(roadmap): add v0.2.23 reactive workstation command center and interactive TUI * docs(agents): mandate root-cause remediation, roadmap synthesis, and interaction improvement * fix(docs): escape placeholder angle brackets and prune completed roadmap matrix items * fix(security): stream sandbox output via centralized output writers to resolve codeql cleartext alerts * fix(k8s): uncap ollama memory limits and elevate daemonset/deployment thresholds (#209) (#210) * fix(k8s): uncap ollama memory limits and elevate daemonset/deployment thresholds (#209) * fix(k8s): add CoreDNS resource configs and tighten test assertions (#209) * fix(github): enforce gh request throttling, disk quota persistence, and diff-only project sync (#211) (#212) * fix(github): enforce window-budgeted rate pacing, disk quota persistence, and diff-only project sync (#211) * docs(agent): record PR #212 in task 211 tracking * fix(github): enforce low-quota circuit breakers, preamble-tolerant JSON parsing, and casing-safe project diffing (#211) * fix(github): replace quota thresholds with logical exponential backoff (#211) * test(github): patch run_gh instead of run_subprocess in reconcile tests (#211) * fix(github): derive rate limit pacing from actual response values without hardcoded windows (#211) * fix(ci): stop running all of the ci tasks every time a pr is marked ready for review. * fix(ci): decouple project automation into dedicated workflow and add quota safety guards (#211) * fix(github): align rate limiter baseline velocity and add quota test coverage (#211) * refactor(ai): eliminate inline function parameter defaults in favor of defaults submodule * fix(github): enforce strict non-negative rate quotas, 25% threshold, and remediate review findings (#211) * fix(typecheck): resolve Path None guard and optional quota remaining in mypy (#211) * docs: refresh CLI and MCP references for updated commands and errors (#211) * fix(ci): enforce mandatory pre-push devops ci gate, handle unauthenticated acquire, and expand test coverage (#211) * fix(pr): align checks fallback to run_subprocess and isolate rate limiter sleep test (#211) * fix(ci): complete pre-push gate, argo drift tests, and coverage expansion (#211) * docs(agent): update task-211 documentation with linear window pacing and pre-push quality gate (#211) * fix(pr): guard pr ready against failing checks and fix project automation uv sync (#211) * docs(pr): update cli and mcp reference for pr ready --force * fix(github): address pr 212 review comments on workflows, sandbox, defaults, and rate limiter (#211) * fix(security): derive artifact version from package metadata and validate whitelist tokens (#211) * feat(security): sigstore cosign container provenance and image signing (#112) (#213) * fix(ci): prune all merged PR devcontainer images from ghcr and guard in-flight builds * feat(security): sigstore cosign container provenance and image signing (#112) * docs(agent): link PR 213 in task 112 tracking doc * fix(security): resolve review comments for cosign container provenance (#112) * ci: re-trigger validation after resolving all review threads * feat(security): falco ebpf runtime security and anomaly streamer (#113) (#214) * feat(security): falco ebpf runtime security and anomaly streamer (#113) * fix(security): resolve review comments for falco ebpf runtime security (#113) * chore: retrigger validation after resolving all review threads * feat(security): distributed threat intelligence valkey l2 cache and radar batching (#122) (#215) * feat(security): distributed threat intelligence valkey l2 cache and radar batching (#122) * fix(security): resolve review comments for threat intel valkey l2 cache and batching (#122) * chore: retrigger validation after resolving all review threads * perf(github): adjust rate limit no-delay used threshold to 30%
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Enforces window-budgeted rate pacing, cross-process quota disk persistence, and diff-only project synchronization to permanently eliminate GitHub GraphQL quota exhaustion.
Closes #211.
Deliverables