Skip to content

Latest commit

 

History

History
41 lines (21 loc) · 9.49 KB

github-observation.md

File metadata and controls

41 lines (21 loc) · 9.49 KB

Automatic GitHub Observation

Implemented boundary

The service observes already visible, nonretired PRs in the selected project's execution queue. It updates retained lifecycle metadata and required-CI facts, and discovers completed external Hosted reviews. It never enrolls or reactivates a PR, requests a review, queries allowance or creates an execution attempt. Review-request pause does not disable observation. Restored provider holds prevent daemon worker startup until the operator releases the installation.

Ordinary API, CLI, MCP and browser reads remain provider-free. Committed changes use the existing project event feed. Native execution retains its own source comparison, actual parent identity and dispatch authority; automatic display observations do not replace those checks.

Worker ownership and publication

The daemon owns four cancellable workers, reserving two for cheap lifecycle reads and two for CI and Hosted enrichment. Each lane has independent project/PR fairness and at most one in-flight read per project and provider account. A slow enrichment read cannot occupy lifecycle capacity. Default intervals are one minute for open PRs, five minutes for closed PRs and six hours for merged PRs. Required CI is collected every five minutes and after a changed head or base comparison. These are eligibility intervals, not completion guarantees during outages or contention.

Repository identity, execution enrollment, capability binding and visible/nonretired state are checked before provider work and again before publication. Enrichment rereads the PR and requires its retained comparison and pinned display facts to remain unchanged. Metadata publication preserves concurrent evidence, queue order, public enrollment and historical snapshots. An unchanged observation creates no snapshot or event. A changed comparison clears inherited CI credit; unsupported evidence remains unknown. A proven empty required-check set is not_required, distinct from passing CI.

Provider failures use bounded account backoff shared by both lanes. Invalid provider display fields report provider_invalid_response for that PR at ordinary retry cadence, without advancing lifecycle success, comparison, or CI facts and without blocking other PRs. Source metadata batch publication reports the refused PR numbers while preserving valid peers. A provider without CI support retains unknown CI with a local diagnostic rather than applying account backoff. Discovery-frontier domain refusals hold only Hosted collection for the affected target at ordinary retry cadence; independent pinned CI collection, lifecycle reads and other targets continue, while storage failures still stop the worker. Malformed stored execution configuration holds only its project, and malformed retained PR display metadata holds only that PR with a local diagnostic and ordinary retry cadence. Neither creates provider-account backoff or permits publication from the invalid state. SQL failures and corruption of shared history authority still stop the worker. A local native-identity read deadline holds that Hosted candidate; parent cancellation and genuine storage errors still propagate. Unsupported or incomplete Hosted inventories retain per-PR diagnostics and ordinary retry cadence without blocking the whole account. Local publication overload reduces the external append batch, ultimately publishing metadata alone and leaving history for a later tick. Retained provider results survive those local retries; no provider read is repeated inside a transaction. Shutdown cancels and joins all owned workers. Conditional GETs retain the provider adapter's bounded revalidation contract.

External Hosted history

Passive discovery uses the configured stable numeric bot identity and actor kind. Login text, matching heads, titles, times or pasted controller markers cannot establish native ownership. Only supported complete bounded inventories become external runs. Replies and empty acknowledgments do not become reviews. Inline and outside-diff findings retain their original source identities and text. Unsupported findings remain unproven rather than a clean zero result.

Each completed result is appended under the github-hosted-observer producer with its actual reviewed head, including an older head. Repeated observation and restart do not append another copy or overwrite captured findings. Both run timestamps identify provider publication; execution start time and runtime were not observed. Discovery creates no native attempt, adjudication, fix, route, round credit or allowance observation. Completed-run channel counts include these retained completions but do not imply earned native review credit.

On first observation, the service freezes a durable discovery frontier from the latest retained non-observer Hosted finish before provider collection. That frontier never advances automatically. Later native completion and restart therefore cannot hide a late-arriving external result. Unknown groups with a valid finish at or before the frontier are outside automatic discovery, including unsupported historical groups. Missing timestamps and incomplete newer groups remain diagnostics. Already retained identities still undergo contradiction and exact native reconciliation checks on either side of the frontier. Historical gaps before the frontier require explicit collection/import.

Exact captured provider publication or run identity can reconcile native and external copies of the same result within the same project, repository, PR and reviewed head. The native replacement must already be current or be staged in the same transaction before external membership is closed. Either arrival order and native publication replay are supported. Original external bodies, findings and historical snapshots remain inspectable; no decisions, fixes, routes or credit transfer from the external copy. Later unsupported provider edits cannot invalidate exact ownership already proven by the validated native capture, but cannot authorize a new external import.

Manual external-result settlement, pending-result dispatch holds, explicit pending-attempt abandonment, signed webhook hints, CI waits, review scheduling and new browser presentation are separate capabilities and are not implemented by this boundary. Existing administrator replacement/import permissions remain unchanged.

Runtime health reads

GET /reviews/queue?include_observation=true adds process-local observer state and per-PR observation facts. The typed queue client requests these for CLI and MCP queue reads. Existing callers that omit the selector receive the unchanged response shape. If the supplementary health configuration read is overloaded or storage is unavailable, the already-read queue remains available with observer state unavailable and no per-PR health claims. Caller cancellation and other errors, including authorization refusals, still fail the request.

Health distinguishes unconfigured or stopped observers, unenrolled PRs, startup waiting, current checks, changed comparisons, overdue checks and retry/backoff. Lifecycle attempt/success times are separate from CI and Hosted collection times and safe error codes. An unchanged successful poll updates health without creating history. A Hosted collection skipped because CI encountered account throttling does not advance its check time. Snapshot observed_at remains the snapshot origin, not the last automatic check. Health resets on restart and never performs provider work or grants readiness.

Storage and qualification

The retained-history contract owns immutable versions and current summaries. Reviews schema 11 appends the discovery frontier and source-identity index after the published schema-10 completed-channel-count migration. Evidence schema 4 adds exact native publication/run identity indexes. Backup inspection checks the physical definitions and frontier content without migrating old bundles. An authentic predecessor keeps its original layout and version during inspection and inactive restore.

This review slice preserves its published parent's migration numbering; it does not contain the integrated schema-lineage upgrader. Integrated development used discovery at version 10, Delivery selection at 11 and completed counters at 12, so equal older version stamps do not imply compatible layouts. Moving a main-v10 or this slice's v11 database to integrated development requires an integrated build containing the transactional review-schema-lineage bridge, which recognizes the exact physical predecessor before supplying missing prerequisites. The selected-schema convergence test proves physical objects only, not that cross-lineage upgrade. Read-only inspection does not run the bridge, and this path does not claim direct restore support for pre-upgrade backup bundles. Published migration numbers are not rewritten, and integrated databases must not be downgraded into this slice.

Controlled tests cover paused collection, lane fairness, cancellation/join, account throttling, comparison movement, unchanged polls, concurrent evidence, source isolation, positive and zero inventories, unsupported history, bounded publication retries, immutable frontiers and exact native reconciliation. Migration and backup tests cover predecessor upgrades, rollback, canonical physical layouts, retained data, resealed corruption and inactive restore. The delivery record owns executed checks and limits. No live provider call, installed upgrade, browser qualification or deployment is implied by these local tests.