refactor(pi): stop sending terminal session requests#10
Draft
ishandhanani wants to merge 2 commits into
Draft
Conversation
Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
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.
Pi now sends session identity only and no longer issues a synthetic terminal request during shutdown. This keeps session lifecycle policy in Dynamo and avoids cancellation-prone cleanup traffic from clients.
How This Was Implemented
Walkthrough
Mental model
Ordinary model requests continue carrying Dynamo session headers. When Pi exits, it performs no additional model request; Dynamo expires retained session state according to its configured policy.
sequenceDiagram participant Pi participant Dynamo Pi->>Dynamo: ordinary request + session headers Dynamo-->>Pi: streamed response Note over Pi: process exits without terminal request Note over Dynamo: server-side retention expires session stateRequest lifecycle
The provider still wraps
streamSimple, preserves Pi'ssessionId, and adds Dynamo identity headers to ordinary requests. Removing the shutdown hook means success, error, and process-exit paths no longer create a second synthetic chat completion.Boundaries and limitations
This does not change session identity, parent/child linking, request tracing, tool-event relay, or ordinary model streaming. Dynamo must apply its own retention or cleanup policy; Pi provides no authoritative terminal-session signal.
Validation
npm run checknpm test(5 passed)npm run buildpython3 -m py_compile harbor/dynamo_pi.py