Usage -> Context listed DeepSeek Harness sessions as "magpie-a",
"magpie-f" and so on, while Usage -> Sessions showed their titles. Real
dsh 0.2.0-rc.2 sends no session header on its chat-completions and
messages routes. The gateway therefore keys each request by
conversationID, a hash of the first user message. contextOf joined
titles on agent + session id, and a hash never matches a dsh session
id. The responses route sends session_id and was already joined.
- The dsh reader (sessions) records the ids the gateway gives a
session's requests: the first typed user/message and the
session/title-llm-request message. Each is hashed in the forms dsh
sends it: a string, and a text part with or without a cache mark.
The text goes through a JSON.stringify-compatible encoder (jsString),
because encoding/json escapes <, > and &. These ids are
Session.Convs; cacheVersion goes to 22.
- contextOf (joinConvs) puts a route that names no session under the
session its conv id came from. An id two sessions share is left as
it is. The title call merges in and is skipped as a tool-less side
call. The existing title join then finds the session.
Fixture: internal/sessions/testdata/dsh-gateway holds two real dsh
session files and the four requests that dsh sent for them to a fake
upstream: a turn and a title call on each of the completions and
messages routes, headers and body as captured. Only the cwd is
rewritten to /work/proj.
Siblings: other agents that send no session header have the same gap,
but none was run to see what it sends. Filed as #3263.
Run at bc11b8a5f (on origin/main ccbc72781):
- gofmt -l: clean.
- go vet: darwin, GOOS=linux -tags nogui and GOOS=windows ./...: clean.
- set -o pipefail; go test -timeout 45m ./... | tee: exit 0, every
package ok.
- No GUI or page files changed, so the GUI suite was not run.
Broken by hand:
- joinConvs commented out: TestContextDshSessionTitles red, the
sessions keyed magpie-950998..., magpie-3dc586... and so on, with no
titles.
- json.Marshal in place of jsString: TestDshSessionConvsAreTheGatewayIDs
red on all four requests.
- title-llm-request not collected: that test red on both title calls.
New tests:
- TestDshRoutesCarryTheSessionConvs sends the captured requests
through the gateway's handler and finds each route's Conv among its
session's Convs.
- On the old code the tests don't build, because Convs doesn't exist.
Not tried:
- a masked first prompt (the hash is taken after masking, so the
session stays untitled);
- a first prompt with an image or several parts;
- dsh's subagent files and forks (seeded sessions);
- a conv after compaction;
- the DSH desktop app;
- Kumo31's own history. Old routes keep their Conv, so they should
join on the next read, but that was not seen.