Context
Documented v1 limitation from PR #424 (jrag watch), spec §10 ("Known limitations & follow-ups").
The 6 jrag read handlers (_cmd_search / _cmd_find* / _cmd_inspect / _cmd_callers / _cmd_callees / _cmd_flow) call _load_graph_or_error on the client before get_payload. _load_graph_or_error opens the ORIGINAL code_graph.lbug read-only. When the watch daemon is alive, get_payload serves from the daemon (which reads a COW file snapshot during a graph reindex), so the client-side load is unnecessary — but it still happens, racing the graph-reindex subprocess writer.
Impact
Under kùzu's single-writer rule, a read-only open during a write may be refused, surfacing a transient rc=2 error for the ~seconds of a graph reindex. Not partial-data — the query result comes from the daemon's snapshot; this is only an error-path race.
Proposal
When is_daemon_alive(index_dir) is true, skip the client-side _load_graph and let the daemon's ERR_STALE_INDEX response drive the cold-fallback error path (cold _load_graph raises _IndexStale → handler renders the rebuild message, byte-identical to today's cold behavior).
Repro
Hard to reproduce deterministically (depends on kùzu's RO-during-RW behavior); manifests as occasional rc=2 from a jrag read command while jrag watch is mid-graph-reindex.
Context
Documented v1 limitation from PR #424 (
jrag watch), spec §10 ("Known limitations & follow-ups").The 6
jragread handlers (_cmd_search/_cmd_find*/_cmd_inspect/_cmd_callers/_cmd_callees/_cmd_flow) call_load_graph_or_erroron the client beforeget_payload._load_graph_or_erroropens the ORIGINALcode_graph.lbugread-only. When the watch daemon is alive,get_payloadserves from the daemon (which reads a COW file snapshot during a graph reindex), so the client-side load is unnecessary — but it still happens, racing the graph-reindex subprocess writer.Impact
Under kùzu's single-writer rule, a read-only open during a write may be refused, surfacing a transient
rc=2error for the ~seconds of a graph reindex. Not partial-data — the query result comes from the daemon's snapshot; this is only an error-path race.Proposal
When
is_daemon_alive(index_dir)is true, skip the client-side_load_graphand let the daemon'sERR_STALE_INDEXresponse drive the cold-fallback error path (cold_load_graphraises_IndexStale→ handler renders the rebuild message, byte-identical to today's cold behavior).Repro
Hard to reproduce deterministically (depends on kùzu's RO-during-RW behavior); manifests as occasional
rc=2from ajragread command whilejrag watchis mid-graph-reindex.