feat(server): add in-flight task coordinator, soft wait window, and result caching #4
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/inflight-coordinator-soft-wait"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
This PR implements an in-flight review task coordinator, soft wait timeout, and caching layer to prevent client transport timeouts during multi-minute OpenCode reviews, as specified in
~/tmp/review-gate.md.Key Changes
ReviewRunCoordinator (
src/review_gate/coordinator.py):asyncio.shieldso tasks survive client cancellation or timeout.ReviewCacheKeyfor 30 minutes (capped at 256 entries).SessionRecordacross the full 2-hour session lifetime so retries can collect verdicts.Soft Wait Window (
src/review_gate/server.py):REVIEW_GATE_WAIT_TIMEOUT(default: 150s, clamped <= 170.0s to stay beneath the 180s MCP transport deadline).## [REVIEW IN PROGRESS: RETRY TO COLLECT]when execution extends beyond the window.Fail-Closed Guardrails:
Admission Control & Lifecycle:
## [REVIEW QUEUE FULL: RETRY LATER]when capacity is reached.## [REVIEW BUSY: SESSION ROUND RUNNING].## [REVIEW SUPERSEDED: RETRY]).execution_status: Literal["completed", "transient_failure"].Tests & Documentation:
RULES.md,AGENTS_TEMPLATE.md, andREADME.md.tests/conftest.pywith deterministic completion (drain(),fresh_coordinator,wait_until).