Skip to content

Type ACP lifecycle parameters with existing owner contracts - #1146

Merged
trissim merged 1 commit into
mainfrom
next/toad-types-03
Oct 23, 2026
Merged

trissim merged 1 commit into
mainfrom
next/toad-types-03

Conversation

@trissim

@trissim trissim commented Oct 23, 2026 •

Copy link
Copy Markdown

Annotate ACP lifecycle parameters with existing owners. Agent.start and AgentProcess.start both accept tuple[AgentProcess, ...]; the empty default does not restrict the argument to tuple[()]. AgentController imports ClientSessionRequest, SurfaceBinding and DetachedSurfaceBinding once each and uses those class names consistently.

Rebased onto main 661fc63. Resolved agent_session.py imports preserving ThreadPresentation, agent.py preserving AgentConnection and feedback.flash, and agent_binding.py preserving AgentConnection/NoAgentConnection and feedback.flash. No removed owner or forwarding method returns.

Counts against that main: seven-file batch 206 -> 182 unannotated parameters; whole src/toad 2065 -> 2041. Explicit Any remains 10. All seven modules imported under python -I against Core 06f123fbd and compiled. No pytest; tests/ unchanged.

Requested checker command (nice -n 19, Pyrefly 1.4.0, -j 1, explicit source roots):

pyrefly check src/toad/acp/agent.py src/toad/acp/agent_session.py
INFO 20 errors

All 20 are present in the fresh-main baseline; zero new diagnostics. The earlier full checker did run, but it missed the empty-only tuple at the call through the untyped AgentSession.agent field. A checker baseline is not proof that inferred types match callers.

Current diagnostic output:

src/toad/acp/agent.py:101 [bad-assignment] `ACPAgentPresentation` is not assignable to attribute `presentation` with type `LocalAgentPresentation`
src/toad/acp/agent.py:126 [bad-argument-type] Argument `dict[str, str]` is not assignable to parameter `matrix` with type `Mapping[OS, str]` in function `toad.get_os_matrix`
src/toad/acp/agent.py:135 [bad-argument-type] Argument `Path | None` is not assignable to parameter `path` with type `Path` in function `toad.acp.agent_log.AgentLog.append`
src/toad/acp/agent.py:172 [bad-override] Class member `Agent.ready` overrides parent class `AgentBase` in an inconsistent manner
src/toad/acp/agent.py:176 [bad-override] Class member `Agent.current_turn` overrides parent class `AgentBase` in an inconsistent manner
src/toad/acp/agent.py:184 [bad-override-param-name] Class member `Agent.attach_surface` overrides parent class `AgentBase` in an inconsistent manner
src/toad/acp/agent.py:215 [bad-override] Class member `Agent.available_modes` overrides parent class `AgentBase` in an inconsistent manner
src/toad/acp/agent.py:219 [bad-override] Class member `Agent.current_mode` overrides parent class `AgentBase` in an inconsistent manner
src/toad/acp/agent.py:248 [bad-index] Cannot index into `object`
src/toad/acp/agent.py:254 [bad-index] Cannot index into `object`
src/toad/acp/agent.py:262 [bad-override] Class member `Agent.thread_read` overrides parent class `AgentBase` in an inconsistent manner
src/toad/acp/agent.py:283 [missing-attribute] Object of class `NoneType` has no attribute `wire_root`
src/toad/acp/agent.py:286 [missing-attribute] Object of class `NoneType` has no attribute `thread`
src/toad/acp/agent.py:289 [bad-specialization] `None` is not assignable to upper bound `DataclassInstance` of type variable `_DataclassT`
src/toad/acp/agent.py:291 [bad-argument-type] Argument `CoordinationChangedUpdate | None` is not assignable to parameter `update` with type `AgentCommsUpdate | CursorPresentation | QueuePresentation` in function `toad.core.events.CommsUpdated.__init__`
src/toad/acp/agent.py:296 [bad-argument-type] Argument `(method: str, **params: Unknown) -> Coroutine[Unknown, Unknown, object]` is not assignable to parameter `invoke` with type `(...) -> Awaitable[dict[Unknown, Unknown]]` in function `agent_comms.goal_actions.GoalAction.submit_control`
src/toad/acp/agent_session.py:78 [bad-override] Class member `ActiveSessionDisposition.close` overrides parent class `SessionDisposition` in an inconsistent manner
src/toad/acp/agent_session.py:94 [bad-override] Class member `HistoryOnlySessionDisposition.status` overrides parent class `UnavailableSessionDisposition` in an inconsistent manner
src/toad/acp/agent_session.py:105 [bad-override] Class member `FailedSessionDisposition.status` overrides parent class `UnavailableSessionDisposition` in an inconsistent manner
src/toad/acp/agent_session.py:346 [bad-argument-type] Argument `ThreadOwnerBinding` is not assignable to parameter `binding` with type `LiveThreadOwnerBinding` in function `agent_comms.session_load.ExistingSessionLoadPlan.__init__`

Stop: src/toad/acp/agent_controller.py:242 _prompt still receives SDK blocks and raw dictionaries. No object type or payload union substituted.

Assumed: reusable processes are AgentProcess instances; existing main owns the renamed connection family and feedback behavior. No pytest run. The old checkout containing the paused rebase was left untouched after the worktree order; this correction was made in /home/ts/wt/toad-types-1146.

Count correction: the comparison is pinned to parent 661fc63 and delivered head bfc03e7. Exactly the seven changed files were recounted individually: 206 -> 182. The earlier 612 -> 676 included changes from a moving main outside this PR; that claim was wrong.

@trissim
trissim marked this pull request as ready for review October 23, 2026 11:05
Copilot AI balanced review requested due to automatic review settings October 23, 2026 11:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@trissim
trissim force-pushed the next/toad-types-03 branch from f7088d1 to 61894e7 Compare October 23, 2026 11:14
Apply checked autotyping/Pyrefly inference to process, controller, session and configuration contracts. Use SurfaceBinding for attachment and AgentProcess for reusable connections. Reject the inferred object-based prompt list; the boundary still accepts two different payload representations.
@trissim
trissim force-pushed the next/toad-types-03 branch from 61894e7 to bfc03e7 Compare October 23, 2026 11:19
@trissim
trissim merged commit 2fa6bb2 into main Oct 23, 2026
1 of 2 checks passed
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.

2 participants