bug(pi): writes committed after 3000 ms are reported as unknown outcome; mem_update and passive capture have no recovery lookup
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 57/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- go, sqlite, typescript
- Ambito
- backend-api-design, databases
Direzione di ricerca
Start in plugin/pi/index.ts at ENGRAM_WRITE_TIMEOUT_MS, postObservationWithReplayRecovery, and the mem_update, mem_session_summary, and passive capture call sites named in the issue. Trace how operation IDs and /observations/save-result recovery work for mem_save, then check the existing or planned regression tests for delayed commits. Done means committed writes are confirmed or expose a recoverable result within a bounded time, without duplicate POSTs.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Existing Issue Search
- I searched existing issues and will add evidence to a canonical tracker when applicable.
📝 Observed Consequence
Pi memory writes that the server commits are reported to the agent as failed with an unknown outcome:
mem_save:gentle-engram could not confirm the observation save. Its outcome is unknown — do NOT blindly retry with a new operation. Operation ID: …mem_update,mem_session_summaryand background passive capture:gentle-engram could not confirm the write after 3000ms. Its outcome is unknown …
Every case I checked had been committed. In one Pi session over about 28 h, 3 writes were reported unknown and all 3 were in the store:
- the
mem_saveoperation_idreturns{"status":"committed"}fromGET /observations/save-result; - the
mem_session_summaryobservation exists with a matching timestamp; - the
mem_updaterow'supdated_atis about 2 s after the call.
The agent is told not to retry, has to verify by hand, and the status entry is cleared (#2512).
🔄 Steps to Reproduce
- Run
engram serveon a local SQLite store (WAL,synchronous=FULL) on a disk under I/O load. Here: a WSL2 ext4 volume whilepnpm installruns in another worktree. - From Pi with
gentle-engram0.8.0, callmem_update(ormem_save). - The commit takes longer than 3000 ms to answer.
✅ Expected Behavior
A write the server commits within a few seconds is confirmed. When the response is late, the client keeps checking for a bounded time, and mem_update and passive capture get a way to recover the result, as mem_save already does through its operation_id.
❌ Actual Behavior
On main at 11521f4f3776db6d94dc17c11731bad35b71c7bc, plugin/pi/index.ts:
- Every write gets one attempt with a fixed 3000 ms budget (
:70ENGRAM_WRITE_TIMEOUT_MS = 3000,:284maxAttempts: 1). No environment variable or setting changes it. mem_saverecovery (postObservationWithReplayRecovery,:582) has a 7500 ms total budget, but after the POST times out it makes a single 1000 mssave-resultlookup (:662,:73). A commit that lands right after that lookup is reported as unknown.mem_update,mem_session_summaryand/observations/passive(:2617,:2850,:3394) have no operation id or recovery lookup, so a late but successful commit can only be reported as unknown.
Operating System
Windows (WSL)
Release Version (Report Context)
engram 3.7.0 core, gentle-engram 0.8.0 (code confirmed unchanged on main 11521f4)
Agent / Client
Other
📋 Relevant Logs
mem_update: gentle-engram could not confirm the write after 3000ms. Its outcome is unknown because the server may already have applied it — do NOT blindly retry it, or you may duplicate the write. Verify with mem_search or mem_doctor first.
Warning: [engram] background capture to /observations/passive failed: gentle-engram could not confirm the write after 3000ms. …
$ curl 'http://127.0.0.1:7437/observations/save-result?operation_id=<id from the mem_save error>'
{"id":16694,"status":"committed"}
Store context: 286 MB DB, freelist 0.4 %, WAL mode, synchronous=2, autosync healthy with no backlog, /health answering in under 1 ms at the same time.
💡 Additional Context
Client: Pi (Gentle Shell) with the gentle-engram companion.
Prior history: #1272 (closed) reported the same false negative for mem_save under the fixed 3 s budget. It was resolved by classifying the outcome as unknown (#1360) and adding replay-safe saves with a committed-result lookup (#1629, #1714, #1715). This is a follow-up on what that left uncovered, not a duplicate:
mem_savestill makes a single 1000 ms lookup inside its budget;mem_update,mem_session_summaryand passive capture never got an operation id or lookup.
Possibly related server-side latency: #1967 (store opens serialize), #2393 (SQLite write transaction on the critical path).
Regression test plan:
- A fake server that commits a save but answers after more than 3 s:
mem_savemust end confirmed through bounded repeatedsave-resultlookups, with no second POST. - The same delay for
mem_update: it must end confirmed or report a recoverable id, never a bare unknown for a committed write. - If the budget becomes configurable, invalid values fall back to the default.
- Lingua principale
- Go
- Stelle
- 7.1k
- Fork
- 729
- Merge medio
- 2h 19m
- PR unite (30g)
- 167
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Gentleman-Programming/engram
-
status:needs-review type:bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Gentleman-Programming/engram#2512 ·
I maintainer di solito rispondono entro 1 giorno
-
status:needs-review
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
Gentleman-Programming/engram#2502 ·
I maintainer di solito rispondono entro 1 giorno
-
status:needs-review type:bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Gentleman-Programming/engram#2501 ·
I maintainer di solito rispondono entro 1 giorno
-
status:needs-review type:feature
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
Gentleman-Programming/engram#2416 ·
I maintainer di solito rispondono entro 1 giorno
-
status:needs-review type:bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 63/100
Gentleman-Programming/engram#2511 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di Gentleman-Programming/engram
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
AvengeMedia/DankMaterialShell#4490 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
stefanpejcic/OpenPanel#1415 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100