Simplify acknowledgement results - #2432
Closed
monadoid wants to merge 2 commits into
Closed
Conversation
|
monadoid
marked this pull request as ready for review
July 26, 2026 11:41
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 28 files
Architecture diagram
sequenceDiagram
participant SDK as SDK Client<br/>(TypeScript / Python)
participant Transport as JSON‑RPC Transport
participant Router as Server Router
participant Controller as Controller
participant Runtime as Runtime
participant Schema as AcknowledgementResultSchema
Note over SDK,Schema: CHANGED: All side‑effect‑only methods return the literal `true`
SDK->>Transport: jsonrpc request<br/>{ method: "locator.click", params }
Transport->>Router: dispatch to handler
Router->>Controller: invoke handler
Controller->>Runtime: locatorClick(params)
Runtime-->>Controller: true as const
Controller-->>Router: result: true
Router->>Schema: validate result (z.literal(true))
Schema-->>Router: valid
Router-->>Transport: jsonrpc response<br/>{ result: true }
Transport-->>SDK: response received
SDK->>SDK: unwrap to void/None
alt Error during execution
Runtime-->>Controller: throw error
Controller-->>Router: jsonrpc error
Router-->>Transport: jsonrpc error response<br/>{ error: { code, message } }
Transport-->>SDK: error thrown
end
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
monadoid
force-pushed
the
simplify-acknowledgement-results
branch
from
July 27, 2026 15:34
169d61b to
e1ed7c8
Compare
monadoid
force-pushed
the
simplify-acknowledgement-results
branch
from
July 27, 2026 15:35
e1ed7c8 to
dab7665
Compare
monadoid
marked this pull request as draft
July 27, 2026 21:54
Contributor
Author
|
Closing this PR; #2434 has been rebased to stand alone against v4-spike. |
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.
Why
Side-effect-only RPC methods currently return several method-specific success objects:
Although fields such as
clickedandclosedlook descriptive, they do not communicate an additional outcome. These fields are literals: on a successful response, their value can only betrue. If the operation fails, the call produces a JSON-RPC error instead of returning a result with the field set tofalse.As a result, even a caller with access to
.clickedwould never need to check it:There is no third code path where the call succeeds but returns
{ clicked: false }. The method being called already identifies the operation, and successful completion already acknowledges that it happened. Returningtrueexpresses the same contract without a separate result shape for every side-effect-only method.The public TypeScript and Python SDKs continue exposing these methods as
Promise<void>andNone, so this does not change their caller-facing APIs.What changed
Add one shared acknowledgement schema:
Point all 28 side-effect-only RPC methods directly at the shared schema.
Return
true as constfrom the corresponding server controller and runtime methods.Remove 12 obsolete result schemas and their generated types.
Regenerate
stagehand.v4.jsonand the Python protocol models.Keep all public TypeScript and Python method signatures unchanged.
Before and after
Wire protocol
Before:
{ "jsonrpc": "2.0", "id": 12, "result": { "clicked": true } }After:
{ "jsonrpc": "2.0", "id": 12, "result": true }Failures remain normal JSON-RPC errors and never return
result: false:{ "jsonrpc": "2.0", "id": 12, "error": { "code": -32603, "message": "Element is not clickable" } }