Repository navigation
Add wait_for_review poll hooks, bounded intervals, and actionable outcome provenance - #136
Open
juggernaut7777 wants to merge 3 commits into
Open
juggernaut7777 wants to merge 3 commits into
juggernaut7777 wants to merge 3 commits into
Conversation
The API only records SERIOUS and WARNING. Do not invent HIGH in the sort rank; keep the forward-compatible contract that any future label a server sends sorts after the known ones instead of raising.
juggernaut7777
force-pushed
the
feat/wait-observability-and-findings
branch
from
November 30, 2026 16:02
774ad20 to
748809a
Compare
This branch has not been deployed
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.
What this adds
wait_for_reviewis the call most people wrap in CI or a worker, but today it only returns at the end and hides most of what it learned. This PR makes the wait observable and the outcome actionable.1. Observable, bounded polling (sync and async)
on_poll(detail)runs after every non-terminal poll, before the client sleeps, so a caller can stream status or cancel early. The async client awaits the callback when it returns an awaitable.poll_intervalsets the first delay;max_poll_intervalcaps the exponential backoff (defaults 5s to 60s, unchanged today). The same call now fits a tight 2s watch and a slow 10-minute review.timeout.poll_intervalandmax_poll_intervalare validated before any request (finite,poll_interval > 0,max_poll_interval >= poll_interval), matching the guaranteestimeoutandhead_commit_shaalready make.2. Findings with provenance, ready for triage
outcome.recorded_findings(severity=..., unresolved_only=...)returnsRecordedFindings that keep the assessment behind each finding:assessment_id,environment_display_name, andfrom_code_assessment.outcome.gap_codesreturns the deduplicated reason codes for gaps and unresolved checks in recorded order.3. Gaps that name where and what
An
INCOMPLETEoutcome used to say why (reason codes) but not which environment, which risk domains, or which evidence. Those fields exist on the wire models and were dropped when a gap was built:AssessmentGap.environmentnames the environment the gap came from, andoutcome.environmentslists the distinct names in recorded order.AssessmentGap.domainscarries the assessment's risk-domain coverage asDomainCoverage(domain, status, reason), withCONSIDEREDorSKIPPEDand the recorded reason.DomainCoverageis exported from the package.CheckGap.filescarries the files the evaluator cited, each with the revision it was read at (BASE_CODE_REVISIONorPROPOSED_CODE_REVISION), andCheckGap.evaluated_atrecords when the answer was produced.[withheld: environment value]) is never surfaced, and the new metadata is validated before a gap is built, so malformed responses still raise the existinginvalid-responseerror.Why it is more than a poll hook. A callback is only the visible half. Interval control lets one API serve both a fast watch and a long backoff, the deadline-safe break stops the last sleep from overrunning
timeout, and the gaps now carry the environment, domain coverage, and cited evidence a CI job needs to act without re-walking the review tree. The change is additive: default behaviour is byte-for-byte today's.Severity vocabulary
Findings are filtered with the API's own labels (
SERIOUS,WARNING, ...). The sort rank is forward-compatible: an unknown label sorts last.Tests
tests/test_wait_and_outcomes.py: poll hooks (sync and async), awaitable callbacks, interval validation, the deadline break,gap_codes, finding provenance, environment and domain attribution, cited evidence andevaluated_at, withheld-value filtering, and invalid gap metadata.pytest248 passed; operation and outcome contract checks pass;ruff checkandruff format --checkclean;mypyclean.Note on AGENTS.md
I left out the session's user prompts rather than publish personal text to a public repo. Happy to share context privately.