Commit 86ca65c
committed
fix(memory/typed-network): per-attempt 30s timeout on observer LLM invoke
The TypedNetworkObserver's underlying LLM adapter has no built-in
request timeout. A hung TCP socket or unresponsive provider could
deadlock long-running ingest pipelines indefinitely - at concurrency=1
a single hung request stalls every subsequent session forever.
Reproduced three times running Stage E Phase A on LongMemEval-S N=54
where each run hung 1.5-3 hours at 0% CPU on a stuck HTTPS connection
to the OpenAI/Cohere endpoint, while direct API tests via curl
returned in 0.5-1.3s.
Add Promise.race-based timeout with a clean clearTimeout in finally,
configurable via the new TypedNetworkObserverOptions.timeoutMs field
(default 30000ms). On timeout the attempt is abandoned and the
observer falls through to its existing retry / empty-result path -
the underlying request leaks its socket until GC / process exit but
ingest moves on.
This is a defense-in-depth fix; the underlying adapter SHOULD also
support AbortSignal but adding that requires extending the
ITypedExtractionLLM interface and updating every consumer's adapter,
which is invasive enough to defer.
Tests: 81/81 typed-network tests pass; new public surface
(timeoutMs option) is opt-in with a sane default that consumers
already get for free.1 parent 543fa84 commit 86ca65c
1 file changed
Lines changed: 56 additions & 6 deletions
Lines changed: 56 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
73 | 81 | | |
74 | 82 | | |
75 | 83 | | |
| |||
87 | 95 | | |
88 | 96 | | |
89 | 97 | | |
| 98 | + | |
90 | 99 | | |
91 | 100 | | |
92 | 101 | | |
93 | 102 | | |
94 | 103 | | |
| 104 | + | |
95 | 105 | | |
96 | 106 | | |
97 | 107 | | |
| |||
125 | 135 | | |
126 | 136 | | |
127 | 137 | | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
134 | 153 | | |
135 | 154 | | |
136 | 155 | | |
| |||
174 | 193 | | |
175 | 194 | | |
176 | 195 | | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
177 | 227 | | |
178 | 228 | | |
179 | 229 | | |
| |||
0 commit comments