Files
magpie/internal/gateway/testdata/qoder-1.1.82/title-first.json
T
yetone f8987ce617 gateway: Qoder 1.1.82's requests find their session in Qoder's own files
qodercli/qoderclicn 1.1.82 (11-03) stopped sending session-id to a
provider of the user's own, and nothing else in a request names the
session (coderlee233 on Discord). Its requests were recorded with no
session: the Sessions page lost the conversation's title and showed each
title and suggestion side call as a row of its own.

A request from Qoder or Qoder CN (by its agent token) on this computer
that names no session is now matched against Qoder's session files
(sessions.QoderDir/projects/<project>/<id>.jsonl and its subagents'
files): the session whose typed prompts (user lines with humanInput /
origin.kind human) appear most in the request's user text wins, the file
written last on a tie. Qoder's <system-reminder> blocks are left out. A
side call (no tools) no file matches yet is held up to 600ms, since the
first title is asked ~0.1s before Qoder writes the file. The id found
goes on the request as session-id, the header 1.1.81 sent, so it is
grouped and titled as before. A request that names a session (older
Qoder's session-id, X-Magpie-Session) is left as it came. Files are read
incrementally; a half-written last line waits for the next read.

Run (on mote, rebased on origin/main 6b47bce67):
- go test -run TestQoder ./internal/gateway: ok. Fixtures are the literal
  bodies and headers qodercli 1.1.82 sent to a capture server, and its
  own session files, from a sandbox HOME (headless turns, a subagent, a
  second headless session, interactive turns, first title, later title,
  transcript title, suggestion).
- go test -timeout 45m ./internal/gateway and the full suite run after
  the push (mote at load 200 from another suite); a red is filed.
- gofmt -l; GOOS=linux and GOOS=windows go vet ./internal/gateway: clean.
Broken by hand, each red: no qoderSession call in handle; no
named-session guard; no agent check; subagent files not read; array
content not read; no wait for side calls; no newest-file tie-break; a
half-written line taken.

Not tried: the reporter's own account or a real model (fake upstream
only); Qoder in WSL (its files are in the WSL home, not found from the
Windows magpie); a keyed or MAGPIE_ADDR gateway on another machine (not
matched by design). The in-flight Active session (status bar) is not
fed from this. A large session file is read whole once per process.
2026-11-04 16:45:47 +08:00

1 line
1.3 KiB
JSON

{"model":"fake-model","messages":[{"role":"system","content":"You are an expert conversation summarizer. Your goal is to create a concise, 2-5 word title that captures the main intent of the user's message.\n\n# Rules\n1. Length: 2 to 5 words maximum.\n2. Format: One line only. No quotes, labels, bullets, colons, or explanations.\n3. Content: Capture the core intent, goal, or task; do not merely repeat keywords.\n4. Language: Strictly output the title in the same language as the user's input.\n5. Case: For English titles, use sentence case: capitalize only the first word and proper nouns.\n\n# Examples\nUser Message: \"Can you help me write a python script for scraping?\"\nTitle: Python scraping script\n\nUser Message: \"Fix the login button on mobile\"\nTitle: Fix mobile login button\n\nUser Message: \"今天天气怎么样\"\nTitle: 天气查询\n\nUser Message: \"排查一下 CI 为什么失败\"\nTitle: 排查 CI 失败\n\n# Output\nReturn JSON with a single \"title\" field.\nReturn only a JSON object that conforms to this JSON Schema.\nDo not wrap the JSON in Markdown.\n{\"type\":\"object\",\"properties\":{\"title\":{\"type\":\"string\"}},\"required\":[\"title\"],\"additionalProperties\":false}"},{"role":"user","content":"write a haiku about rivers"}],"stream":true,"stream_options":{"include_usage":true},"temperature":0,"max_tokens":64}