226fc8ea3 lists ZCode's sessions for Titles from their rows alone, with
size 0 and the row's time_updated as the file's stamp. Two things followed
from that stamp:
- ZCode writes a message without touching its session's row, so a session
still under its default title, first read before its prompt was in, was
never named by that prompt while only the Routing page polled.
- The cache kept size 0 and the row's time, where the Sessions page's
listing (zcodeFiles) keeps the message count and the last message's
time, so each read the session whole again after the other.
zcodeTitleStamps gives the sessions a poll asks for (their key wanted,
subagents under it too) the same count and last activity, from a
COUNT/MAX over each one's own messages by session_id, not the join over
every session's. A session whose messages can't be read keeps its row's
stamp, as before.
Co-authored-by: Flandern1211 <163982805+Flandern1211@users.noreply.github.com>
Run (mote, via mote-run):
- go test ./internal/sessions -run TestZCode -count=1 at 226fc8ea3 alone:
TestZCodeTitlesSeeNewMessages red (after the prompt: "") and
TestZCodeTitlesKeepTheListingsStamp red (kept size 0 mod
1790496000000000000, listing has size 3 mod 1790496030000000000). With
this change both green. On origin/main 1b0340fdb both pass (the poll
read the join), while 226fc8ea3's TestZCodeSubagentTitlesByRequestID and
TestZCodeTitlesWithoutMessageTable are red there.
- go test -timeout 45m ./internal/sessions ./internal/gui -count=1: sessions
ok; gui ok but TestMainWindowCorners/macOS_26_SDK, #3949 (mote is
macOS 27), untouched here.
- GOOS=linux and GOOS=windows go vet ./internal/sessions: ok. gofmt clean.
Not tried: a real ZCode database (none on this Mac or the Windows box);
the per-session COUNT/MAX is not timed against the reporter's 1 GB one.
It filters message by session_id, as parseOpenCode's own reads do.
Titles listed every agent's files, and zcodeFiles joins the message table to give each session its size and last activity. On a ZCode database of 1,022 sessions and about 1 GB of messages that join took ~20 s, while the Routing page asks again every 15 s: its cards showed the folder for a while, and a poll that came back empty dropped a name it had.
Titles now lists ZCode's sessions from their own rows (zcodeTitleFiles: id, parent, time_updated) and names them through the same assembleListed/parseOpenCode path as before. A ZCode subagent, which ocRoots files under its parent's key, is named from its own file's cached row when the key asked for matches no group.
Run:
- go test ./internal/sessions -run 'TestZCodeTitlesByRequestID|TestZCodeSubagentTitlesByRequestID|TestZCodeTitlesWithoutMessageTable|TestZCodeDefaultTitleFallsBackToFirstPrompt|TestSessionTitles|TestZCodeCalls' -count=1: ok.
- go test ./internal/gui -run TestSessionTitlesNameOtherAgents -count=1: ok.
- Broken by hand: with zcodeFiles (the message join) in place, TestZCodeTitlesWithoutMessageTable fails with an empty title; with the subagent fallback removed, TestZCodeSubagentTitlesByRequestID fails; with the sess_ alias removed, TestZCodeTitlesByRequestID fails.
- Real ZCode database on Windows: Titles for three live sessions went from 20.4 s to 780 ms cold and 74 ms warm; a ZCode and dsh poll took 80-160 ms.
- go build ./...: ok. The full sessions package has the same three Windows-only failures as before this change (TestAgySessions, TestAgyRowOnly, TestCCListingKeepsItsNames).