Repository navigation
Description
Objective
Make GitForge reliably serve many repositories and concurrent coding-agent/Actions workloads without queue collapse, avoidable rebuilds, repeated downloads, excessive I/O, or unsafe cleanup.
This is an implementation epic, not a proposal to replace GitForge's existing scheduler or storage stack wholesale. Reuse the current durable scheduler, leases, cache mounts, job receipts, storage traits, and existing smart-CI graph work where they pass review. Measure first; ship in independently deployable phases.
Why this is needed
The current main branch already has repository-aware fairness and a special resource-class guard for workspace Cargo tests, as well as cache mounts and durable job scheduling. It still lacks a complete multi-dimensional host-pressure admission model, separate fast/heavy capacity, a content-addressed immutable artifact store, managed copy-on-write workspaces, and sound per-test result reuse.
Evidence captured during the October 31 audit:
- The October 10 worktree census recorded 44 live worktrees, including 17 dirty WIP trees and one 3,962-file build-artifact spill.
- The current cache store is key-addressed file storage, not a shared content-addressed object store. The CI cache mount is keyed by image tag.
- The current queue's priority values are Normal/High/Low and it has repository-aware running-job fairness. Resource classification currently includes a special case for workspace-wide Cargo test jobs rather than a general CPU/memory/I/O/scratch reservation contract.
- Existing issue Bound CI job resource use and protect runner storage headroom #277 records severe host pressure, D-state waits, heavy disk I/O and low free disk during concurrent CI activity. Issue ci: deduplicate validation lanes and bound runner concurrency #284 records overlapping Actions/GitForge validation lanes competing for the same self-hosted pool.
- The prior smart-CI branch has useful graph implementation work, but it is six commits ahead and 70 commits behind current main. Rebase and review it; do not merge it unchanged.
- Main at commit 5ceb106 had failed validation: an SSH callback signature compile error, an API test fixture compile error, 15 unvetted cargo-vet dependencies, and GitForge CI polling that returned HTTP 401. PR fix(storage): atomically publish file-backed records #336's storage tests/build/clippy/coverage were green at its inspected head, while Supply Chain and GitForge CI polling remained failing. These correctness/integration gates are blockers, not work that storage optimization can bypass.
Workstreams
- Resource-aware queues and admission — feat(scheduler): add resource-aware fast, standard, and heavy CI lanes #338. Separate control-plane responsiveness from compute; provide fast, standard, heavy and background lanes; weighted fair scheduling across tenants/repos; per-repo concurrency; reserved fast capacity and anti-starvation; resource reservations/enforcement; host-pressure-based deferral with durable reason codes.
- Shared storage and managed workspaces — feat(storage): implement shared content-addressed store, isolated workspaces, and safe GC #339. Add immutable CAS for non-Git artifacts, manifests/reference tracking, safe cross-process publication, trust namespaces, worktree lifecycle management, optional OverlayFS/reflink/Btrfs providers, two-phase GC and storage telemetry. Keep Git's object database canonical for Git objects.
- Incremental test impact and reusable results — feat(testing): add sound incremental test-impact graph and reusable test execution cache #340. Rebase/review the existing graph branch; map tests to executed code, select the safe impacted set, use complete test fingerprints, cache only deterministic eligible outcomes, and fall back to broader validation when graph confidence is inadequate. Integrate the OpenTestSuite prototype via an adapter contract.
- Toolchain and database benchmark bake-off — perf(tooling): benchmark faster compiler, linter, test-runner, and database paths #341. Evaluate cargo-nextest, sccache, cargo-chef, mold/LLD, lust-lang, ts-rust/tsc-rs, Biome/Oxlint, uv/Ruff/pytest-xdist/testmon and database tuning against exact correctness corpora and representative resource profiles.
Required execution order
Gate 0 — restore correctness and safe execution
- Resolve the current main compile/test failures and the GitForge CI credential/polling contract.
- Resolve cargo-vet attestations by auditing dependencies; do not blanket-certify or suppress.
- Complete public fork runner isolation and required-check semantics (Harden public PR runner trust and required-check coverage #318).
- Validate the open atomic storage publication PR (fix(storage): atomically publish file-backed records #336) at exact head; merge only after all required GitHub and self-hosted checks have valid evidence.
- Preserve the separate SSH push trigger contract work (fix(git-server): enqueue CI for successful SSH pushes #258).
Gate 1 — baseline observability and admission
- Capture queue wait, lane, queue reason, runner capacity, CPU/memory/I/O/disk pressure, per-job resource use, cache hit/miss, workspace creation time and bytes read/written.
- Add bounded admission and fair fast/heavy capacity before turning up parallelism.
- Keep active jobs alive when headroom becomes unsafe; defer new work.
Gate 2 — reuse and isolation
- Implement CAS objects/manifests, isolated workspace providers and safe GC behind opt-in flags.
- Benchmark native Git worktree, reflink/OverlayFS and Btrfs snapshot methods on supported filesystems.
- Never share mutable target directories or writable cache objects across unrelated jobs.
Gate 3 — sound incremental validation
- Rebase the prior graph work and validate it against current manifests and pipeline contracts.
- Pilot per-test dependency capture and selected-vs-full differential execution.
- Keep full validation on scheduled/release gates; no heuristic may turn a required check green.
Gate 4 — toolchain and rollout
- Benchmark alternatives by correctness first, then cold/warm latency, CPU-seconds, RSS, disk I/O and cost.
- Roll out per runner profile and per project, with automatic fallback and operator kill switches.
Non-negotiable invariants
- Durable queue, job lease, receipt and restart-recovery semantics stay authoritative.
- New/unknown tests and failed/flaky tests are not skipped.
- Graph/index/cache errors fail open to a conservative full validation scope.
- No untrusted job can write to or poison a shared cache/store used by trusted work.
- Worktree/GC operations require durable ownership/lease checks and never delete dirty live work.
- Snapshots are not backups; retain independent backup/restore procedures.
- Raw logs/conversations remain recoverable; compacted knowledge must carry hashes and source offsets. A 2% size target is measured, not guaranteed.
- No performance claim is accepted without reproducible before/after evidence.
Existing related issues
- Bound CI job resource use and protect runner storage headroom #277 resource/storage headroom
- ci: deduplicate validation lanes and bound runner concurrency #284 duplicate validation lanes and runner concurrency
- Harden public PR runner trust and required-check coverage #318 public PR runner trust
- feat: smart CI + dependency/change-impact graph optimization #322 smart CI and dependency/change-impact graph
- fix(git-server): decouple push response from CI outbox delivery #288 push response decoupling
- No canonical gate record for Amortyx-Stack; release-gate CLI blocked on missing sqlite3 #335 Amortyx-Stack repo registration / release-gate evidence
- fix(storage): atomically publish file-backed records #336 atomic file-backed publication
- fix(test): skip live release gate in bundle contract tests #337 release-bundle contract test fix
- fix(git-server): enqueue CI for successful SSH pushes #258 successful SSH push CI trigger
Acceptance criteria
- Under mixed-project load, fast checks and control-plane operations remain responsive while heavy jobs are deferred fairly.
- Queue growth is bounded and every deferred job has a measurable reason.
- Build/dependency/test reuse is measured by digest and avoids unsafe mutable sharing.
- Worktree, cache and object GC are crash-safe and cannot delete live work.
- Incremental test selection has zero missed failures in differential validation and maintains full scheduled/release suites.
- GitForge reports p50/p95/p99 API latency, queue wait, throughput, resource utilization, cache efficiency, physical/logical storage, and correctness fallback rate.
- All changes are covered by exact-head GitHub and GitForge validation, rollout/rollback instructions and recorded benchmark artifacts.
The implementation should land as small, reviewable PRs under these workstream issues. Avoid a monolithic rewrite.
Activity
aliasfoxkde commentedon Oct 31, 2026
Architecture PR: #343 (draft; documentation/design only): #343
The workstreams are tracked as #338 (resource-aware queue lanes), #339 (CAS/workspaces/GC), #340 (incremental test graph and safe result reuse), and #341 (toolchain/database benchmarks).
Two additional Gate 0 blockers were split out after inspecting the latest exact-head logs:
The PR document now links these issues and treats the existing compile fixes on #336 as unvalidated until the full required gate succeeds.
docs(planning): add optimization initiative brief (#350)
feat(ci): failure injection with rollout gate (M10) (#353)