openclaw: a hook that arrives while lazy initialization is in progress gets no client (recall silently skipped)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 79/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
Direzione di ricerca
Inizia da hindsight-integrations/openclaw/src/index.ts, in particolare da lazyReinit() e waitForReady() in prossimità delle righe citate; segui il comportamento delle chiamate concorrenti mentre l’inizializzazione è in corso. L’issue suggerisce di aggiungere un test unitario che chiami waitForReady() due volte con un controllo dello stato ritardato di 100 ms. Il lavoro è completato quando entrambe le chiamate si risolvono con un client e gli hook concorrenti di recall e retain non proseguono più senza un client.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Bug Description
When OpenClaw loads a fresh copy of the plugin that never receives service.start() (the registry-reload case from #4828), the first hook calls waitForReady(), which starts lazyReinit(). A second hook that calls waitForReady() while that re-initialization is still running returns at once, because lazyReinit() exits early on isReinitInProgress (and also inside the 30 s cooldown). waitForReady() then resolves with client still null:
// index.ts, lazyReinit()
if (now - lastReinitAttempt < REINIT_COOLDOWN_MS || isReinitInProgress) {
return; // a concurrent caller returns before the in-flight init finishes
}
The caller then has no client:
before_prompt_build:getClientForContext()returnsnulland the turn is answered without memories, with only a debug line (Client not initialized, skipping auto-recall).agent_end: on 1.2.0 the turn was dropped (client not initialized, skipping retain). Since #6196 it is queued, which is fine, but it waits for the next queue flush although the client becomes available a few hundred milliseconds later.
We hit this when two sessions finished a turn 69 ms apart, right after OpenClaw had loaded a new plugin copy. The first retain succeeded 250 ms later; the second was dropped (1.2.0).
Steps to Reproduce
- External API mode. Make OpenClaw load a new plugin copy without starting its service (a registry reload; on 2026.10/2026.11 this happens routinely:
plugin entry invokedwithoutservice.start invoked). - Fire two hooks (two
agent_end, or abefore_prompt_buildin another session) within the time the health check and bank-default setup take (a few hundred ms). - The first logs
waitForReady called before service.start() — attempting lazy initialization fallbackand works; the second gets no client.
As a unit test: call global.__hindsightClient.waitForReady() twice without awaiting the first, with a health-check mock that resolves after 100 ms, and check getClient() after the second call resolves.
Expected Behavior
Concurrent callers await the same in-flight initialization (keep the pending promise and return it), so every hook that arrives during lazy init gets the client once it exists. The cooldown should only stop a new attempt after a failed one, not make callers skip a successful one that is still running.
Actual Behavior
Only the caller that started the re-initialization gets a client. The others return immediately with client === null.
Version
@vectorize-io/hindsight-openclaw1.2.0 when observed; the early return is unchanged in 1.2.3 (= main at c828c7e). On 1.2.3 a concurrent retain is queued instead of dropped (#6196), a concurrent recall is still skipped.- Hindsight API 1.3.0, OpenClaw 2026.11.8
LLM Provider
Not relevant.
Suspected code location
hindsight-integrations/openclaw/src/index.ts: lazyReinit() (lines 622-680) and waitForReady() in the __hindsightClient global (lines 687-716), called from the before_prompt_build handler (line 2954) and the agent_end handler (line 3384). Storing the in-flight lazyReinit promise and awaiting it from waitForReady() would fix both hooks.
TypeScript-only (OpenClaw plugin lifecycle).
- Lingua principale
- Python
- Stelle
- 45.2k
- Fork
- 5.9k
- Merge medio
- 5h 46m
- PR unite (30g)
- 389
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
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 vectorize-io/hindsight
-
integration:coding-agents
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
vectorize-io/hindsight#7028 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
integration:openclaw
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
vectorize-io/hindsight#7022 ·
I maintainer di solito rispondono entro 1 giorno
-
integration:hermes
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
vectorize-io/hindsight#7002 ·
I maintainer di solito rispondono entro 1 giorno
-
core
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
vectorize-io/hindsight#6986 ·
I maintainer di solito rispondono entro 1 giorno
-
core
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
vectorize-io/hindsight#6978 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di vectorize-io/hindsight
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
fedora-infra/anitya#2272 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
unitaryfoundation/mitiq#3205 ·
I maintainer di solito rispondono entro 6 giorni
-
[Bug]: Index worker test drops empty Git config values on WindowsForse già presa @xiaoyesoso l’ha presa oggi. Apertatriage/confirmed
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
agentscope-ai/agentscope#4377 · 2 commenti ·
I maintainer di solito rispondono entro 2 giorni
-
area/config comp/agent P2 type/perf
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
NousResearch/hermes-agent#161039 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
astral-sh/ty-pre-commit#46 ·