Skip to content

Add wait_for_agent_session and AgentSessionOutcome to sync and async clients - #169

Open
tedin7 wants to merge 1 commit into
prooflinedev:mainfrom
tedin7:feat/wait-for-agent-session
Open

tedin7 wants to merge 1 commit into
prooflinedev:mainfrom
tedin7:feat/wait-for-agent-session

Conversation

@tedin7

@tedin7 tedin7 commented Dec 5, 2026

Copy link
Copy Markdown

Summary

Adds wait_for_agent_session(organization_id, session_id, *, timeout=300, poll_interval=5.0) to both ProoflineClient and AsyncProoflineClient, along with AgentSessionOutcome exported from proofline.

Who this helps & design decisions

Teams automating Proofline's finding-fix loop (start_agent_session -> poll get_agent_session until done=True) previously had to hand-roll polling loops, deadline budgets, and Unset field handling, even though wait_for_review already establishes the SDK's deadline-aware polling pattern.

  • Shared wait budget & backoff: Reuses _transport.review_wait_budget(timeout) and exponential backoff (from poll_interval, capped at 60s), so timeout=0 performs a single read without retries and RetryDeadlineExceeded / deadline-expired transport errors return TIMED_OUT with the last observed AgentSession.
  • Normalized outcome (AgentSessionOutcome): Normalizes cause, pull_request_url, vendor_url, and observed_head_sha to str | None, maps unknown future done=True statuses to "UNKNOWN", validates session.id == session_id, and keeps session repr=False so untrusted_vendor_summary is not exposed in repr(outcome).
  • Strict argument & contract checks: Validates finite nonnegative timeout and finite positive poll_interval, and registers wait_for_agent_session in scripts/contracts.py.

Verification

  • scripts/generate.py --check (0 drift)
  • scripts/contracts.py (passed)
  • ruff check . & ruff format --check . (254 files formatted, 0 issues)
  • mypy proofline scripts (245 source files, 0 issues)
  • pytest -q (258 passed, including 22 new sync/async tests in tests/test_agent_session_wait.py)

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-05T03:09:51.764926Z d432f8b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant