Skip to content

fix(sessions): find the first user message past injected context - #243

Merged
andrebrait merged 3 commits into
kahme247:mainfrom
andrebrait:fix/session-first-message-scan
Oct 10, 2026
Merged

andrebrait merged 3 commits into
kahme247:mainfrom
andrebrait:fix/session-first-message-scan

Conversation

@andrebrait

@andrebrait andrebrait commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

omp writes injected context (rules, skills, memory recall) into a session file before the first user message. That pushed the message past the 4 KiB prefix that scanSessionInfo parses, so a new session's sidebar title fell back to (no messages), and the auto-name button refused with "no user messages to name" until omp wrote its own title.

When the prefix holds no user message, scanSessionInfo now streams the file line by line until the first user entry. Torn lines are skipped, and the result is capped at 4 KiB because the session list ships it for every session. Results stay memoized by size and mtime.

Verification: a regression test in lib/session-reader.test.mjs covers the injected prefix, a torn line before the user entry, and a 300 KB first message. It failed before the fix and passes after. Real affected session files now report Integrate and deploy instead of (no messages).

omp writes rules, skills and memory-recall entries before the first user
message, which pushes it past the 4 KiB list-scan prefix. The sidebar then
showed "(no messages)" and auto-name refused with no messages to name until
omp set a title. When the prefix has no user message, scan up to 256 KiB.
Injected context larger than 256 KiB still hid the first user message.
Stream lines until the first textual user entry instead; forEachFileLineSync
now stops when onLine returns false.
…iling

The streaming scan read oversized files whose prefix has no user message,
and a line past the JS string cap threw, so scanSessionInfo dropped the
session and its route returned 404 instead of 413.
andrebrait added a commit to andrebrait/ompweb that referenced this pull request Oct 10, 2026
…cted context

Squashed from origin/fix/session-first-message-scan (08a6929) onto upstream/main.
andrebrait added a commit to andrebrait/ompweb that referenced this pull request Oct 10, 2026
…cted context

Squashed from origin/fix/session-first-message-scan (08a6929) onto upstream/main.
@andrebrait
andrebrait merged commit 300b8e0 into kahme247:main Oct 10, 2026
3 checks passed
@andrebrait
andrebrait deleted the fix/session-first-message-scan branch October 11, 2026 00:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant