| 178 | let stopAfterWipeAt = Number.POSITIVE_INFINITY; |
| 179 | |
| 180 | const probeOnce = async (): Promise<void> => { |
| 181 | const at = Date.now() - startedAt; |
| 182 | const response = await mcpPost(target.mcpUrl, { |
| 183 | bearer, |
| 184 | sessionId, |
| 185 | body: TOOLS_LIST_REQUEST, |
| 186 | }); |
| 187 | const probe: Probe = { |
| 188 | atMs: at, |
| 189 | status: response.status, |
| 190 | body: await response.text(), |
| 191 | retryAfter: response.headers.get("retry-after"), |
| 192 | }; |
| 193 | probes.push(probe); |
| 194 | thisSession.push(probe); |
| 195 | // "Session not found" is the post-wipe verdict: the destroy alarm has |
| 196 | // run, storage is gone, and the object has been aborted. Anything |
| 197 | // after this point is a request against an already-dead id. |
| 198 | if (isWipedVerdict(probe) && stopAfterWipeAt === Number.POSITIVE_INFINITY) { |
| 199 | stopAfterWipeAt = Date.now() + graceAfterWipeMs; |
| 200 | } |
| 201 | }; |
| 202 | |
| 203 | // One worker replenishes its request the moment the previous one |
| 204 | // settles, so the session object is never idle and the DELETE has to |