Repository navigation
fix(chat): do not 404 sends to a live session before its first reply is saved - #165
Merged
kahme247 merged 1 commit intoOct 1, 2026
Merged
Conversation
Collaborator
Author
|
Review companion: andrebrait/ompweb#53 |
Contributor
|
This fixes #160, which reports the same bug with steps to reproduce (new session, type a slash command, Send, I've closed #161, which fixed the same thing, in favour of this PR. I tested both locally; the comparison is in the review on #161. |
…is saved omp creates the session file only once the first assistant message is committed. handleSend reads context?boundary=1 before dispatching every prompt; for a live session without a file that returned 404, so the prompt was never sent and every retry failed the same way. Boundary mode now returns an empty entry list for a live wrapper whose file does not exist yet, mirroring the sync fallback.
andrebrait
force-pushed
the
fix/boundary-before-session-file
branch
from
October 1, 2026 00:13
842d362 to
c4fdb1d
Compare
kahme247
approved these changes
Oct 1, 2026
kahme247
added a commit
that referenced
this pull request
Oct 2, 2026
Merged #183 turns a 404 from the boundary read into an empty baseline so a prompt is still dispatched. Its own regression test stubs a state the server cannot produce -- the harness's /api/agent stub succeeds for any unknown id, which the real route never does -- so it does not actually pin the fix. These three do: - the fileless live session that merged #165 already answers 200, proven on the unfixed source, so the original repro no longer exists; - a 404 boundary on a live session (unreadable file, or a wrapper that died between get_state and the read) still dispatches, which is the case #183 genuinely closes; - a vanished session with no wrapper still fails loudly, so the new fallback did not swallow a real error.
kahme247
added a commit
that referenced
this pull request
Oct 2, 2026
Merged #183 turns a 404 from the boundary read into an empty baseline so a prompt is still dispatched. Its own regression test stubs a state the server cannot produce -- the harness's /api/agent stub succeeds for any unknown id, which the real route never does -- so it does not actually pin the fix. These three do: - the fileless live session that merged #165 already answers 200, proven on the unfixed source, so the original repro no longer exists; - a 404 boundary on a live session (unreadable file, or a wrapper that died between get_state and the read) still dispatches, which is the case #183 genuinely closes; - a vanished session with no wrapper still fails loudly, so the new fallback did not swallow a real error.
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.
Problem
Sometimes a session looks normal (editor, model picker, and so on), but every message send fails with
HTTP 404.omp creates the session
.jsonlonly after the first assistant message is committed. Before dispatching each prompt,handleSendcallssnapshotRunEntries, which fetchesGET /api/sessions/<id>/context?boundary=1. That applies to existing sessions and to pre-spawned new sessions (existingSid). The route had a live-wrapper fallback forsync=1but not forboundary=1. For a live session with no file yet, boundary mode returned 404,snapshotRunEntriesthrew, and the prompt was never sent. Every retry failed the same way.Production access logs show the pattern: right after
POST /api/agent/new,context?sync=1returns 200 whilecontext?boundary=1for the same id returns 404, repeated on each send.Fix
When the path does not resolve and a live wrapper exists whose session file does not exist yet, boundary mode returns
{ entryIds: [] }(no-store). That is the true persisted boundary, and it matches what the new-session path already uses ([]). Without a live wrapper, or when the file exists but does not resolve or is malformed, boundary still returns 404.Tests
lib/session-routes.test.mjs: the pre-persistence test now expects an empty boundary for a live, unpersisted session. It fails without the fix (404vs200). It also asserts 404 for an existing unresolvable file, for a malformed file (session_file_malformed), and when there is no wrapper. Dropping theisAlive/existsSyncguard makes the test fail.npm test: 901 pass, 0 fail, 4 skipped.tsc --noEmitand ESLint on the changed files are clean.