-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/end endpoint returns empty object #1500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
✱ Stainless preview buildsThis PR will update the
|
fc06f89 to
0537a80
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 7 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/server/test/end.test.ts">
<violation number="1" location="packages/server/test/end.test.ts:33">
P2: Resource leak: `afterAll` should be `afterEach` to match the `beforeEach` that creates a new app for each test. Currently, only the last app instance is closed.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Greptile SummaryThis PR aligns the Key Changes:
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client as Client SDK
participant Server as /end Endpoint
participant Store as Session Store
Client->>Server: POST /sessions/{id}/end<br/>Body: {}
activate Server
Server->>Server: Validate body against<br/>SessionEndRequestSchema
alt Invalid Body (empty string or extra keys)
Server-->>Client: 400 Bad Request
else Valid Body ({})
Server->>Store: endSession(sessionId)
activate Store
Store-->>Server: Session terminated
deactivate Store
Server-->>Client: 200 OK<br/>{ success: true }
end
deactivate Server
|
why
Right now our server
/endendpoint doesn’t match the production Stagehand API contract: prod expects a non-empty JSON body whenContent-Type: application/jsonis set, so a call to/endthat sends an empty body fails. This change makes our server + OpenAPI spec match prod so downstream generated SDKs send an empty object.what changed
Defined a strict empty-object request schema for
/end(SessionEndRequest) and made it a required request body in the route + emitted OpenAPI. Updated the /end handler response to match prod({ "success": true })and added a server test covering the body requirement.stainless.yamltest plan
Regenerate the Python SDK and verify sessions.end() succeeds against production