Repository navigation
Conversation
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.
Problem
ProoflineClientandAsyncProoflineClientexposeget_agent_session_prompt,start_agent_session, andget_agent_session, but callers that start a coding-agent session from a finding currently lack a bounded wait helper analogous towait_for_review. Hand-rolled polling loops aroundget_agent_sessionface three failure modes:status == "FINISHED"as terminal beforesession.doneisTrue, which races Proofline's follow-up verification (such as confirming whether a vendor-opened pull request belongs to the target repository or whether the pull request head moved).AgentSession.from_dictparser (which does not enforce runtimebool/int/strtypes or verify thatsession.idmatches the requestedsession_id), or leakinguntrusted_vendor_summaryinto logs and exception tracebacks viarepr()._transport.DEADLINE, allowing DNS resolution, streaming reads, orRetry-Afterdelays to exceed the caller's wait budget.Architectural Solution
proofline/outcomes.py: AddedAgentSessionStatus,AgentSessionOutcome(frozen dataclass withsessionmarkedrepr=Falsesountrusted_vendor_summaryand vendor URLs never appear inreprdiagnostics),_validate_agent_session, andagent_session_outcome.agent_session_outcometreatssession.done is Trueas the sole completion signal. Active sessions (done=False, even whenstatus == "FINISHED") continue polling. Terminal sessions map toFINISHED,FAILED,REFUSED,HEAD_MOVED, orUNKNOWN(with explicitreasonstrings when a session ends in an active or unrecognized status), andTIMED_OUTretains the last validatedAgentSessionwhen available.proofline/client.py: Addedwait_for_agent_session(organization_id, session_id, *, timeout=300)to bothProoflineClientandAsyncProoflineClient, sharing_transport.DEADLINEand exponential backoff (5sdoubling to60s) withwait_for_review.AgentSessionOutcomeandAgentSessionStatusinproofline/__init__.py, registeredwait_for_agent_sessioninscripts/contracts.py, and documented usage inREADME.md.Benchmarks/Tests
@MODES(syncandasync) test suites intests/test_http.py(test_wait_for_agent_session_follows_done_and_redacts_untrusted_summaryandtest_wait_for_agent_session_timeout_and_invalid_shapes) andagent_sessionfixture intests/fixtures.py.REQUESTED->FINISHED (done=False)->FINISHED (done=True), all terminal statuses (FAILED,REFUSED,HEAD_MOVED,UNKNOWN), settled active/future status fallbacks,timeout=0and multi-poll deadline expiration,Retry-Afterbounding on503, immediate propagation on403,repr()redaction ofuntrusted_vendor_summary, andurn:proofline:sdk:invalid-responseon malformed session/target shapes.python scripts/check.pyend-to-end:generate.py --check,contracts.py,ruff check,ruff format --check,mypy proofline scripts,pytest -q(90 passed), wheel/sdist build, andinstall_smoke.py.Trade-offs
300s): Matcheswait_for_reviewin this SDK for consistent Python caller ergonomics while allowing callers to pass a longertimeoutfor slower coding-agent runs.outcomes.py: Rather than modifying the generatedAgentSession.from_dicttemplate across all endpoints, runtime type and identity checks live in_validate_agent_sessionalongside_validatefor reviews, keeping generated code untouched and failing closed withurn:proofline:sdk:invalid-response.