fix(cli): drain search retrieval writes before exit#1344
Conversation
Drain pending last_retrieved_at write-backs before disconnecting one-shot search/query/get_page commands so PGLite CLI processes exit cleanly. Route search modes/stats/tune through the search namespace before legacy search <query>.
|
Closing this PR as duplicate / overlapping work. I opened it before checking thoroughly enough for existing issues and PRs. Existing coverage:
I validated #1259 locally on PGLite:
One note from validation: #1259 intentionally does not fix |
|
Closing this PR as duplicate / overlapping work. I opened it before checking thoroughly enough for existing issues and PRs. Existing coverage:
I validated #1259 locally on PGLite:
One note from validation: #1259 intentionally does not fix |
Summary
Closes #1343.
last_retrieved_atwrite-backs before disconnecting one-shotsearch,query, andget_pageCLI operations.gbrain search modes|stats|tunethrough the search namespace before the legacysearch <query>operation.Test Plan
bun run src/cli.ts search "GBrain setup smoke test"exits 0 without hangingbun run src/cli.ts search modesexits 0 and prints the search mode dashboardbun run src/cli.ts query "GBrain setup smoke test" --no-expandexits 0bun test test/fix-wave-structural.test.tsbun run verifyNotes
The root cause was a fire-and-forget retrieval metadata write racing with PGLite disconnect in the one-shot CLI path. The command could print results successfully while leaving pending async work around the same engine. This PR tracks those write-back promises and drains them before disconnecting.