mirror of
https://github.com/deepseek-ai/deepseek-harness
synced 2026-08-15 21:04:50 +00:00
fix(host): settle pending approvals as cancelled on gateway teardown
Disposability parity with the question provider: a gateway disposed while approvals are pending settles every registry entry as 'cancelled' (the service's fail-closed vocabulary), so no ctx.approval ask dangles past the proxy's lifetime and mux subscribers see the withdrawal. Spec mounts the proxy on its own fiber and drives dispose with a live ask. Addresses the ds-review-bot suggestion on PR #851.
This commit is contained in:
@@ -609,6 +609,13 @@ export function createApiProxy(ctx: Context, defaults: ApiProxyDefaults): ApiPro
|
||||
// the same rpcId (the refresh-recovery baseline) — and withdraws on the
|
||||
// ask's own abort signal (turn cancel), pushing `cancelled` to subscribers.
|
||||
if (ctx.get('approval') !== undefined) {
|
||||
// Teardown parity with the question provider above: a gateway disposed
|
||||
// while approvals are pending settles every entry as 'cancelled' (the
|
||||
// service's fail-closed vocabulary), so no ask promise dangles past the
|
||||
// proxy's lifetime and subscribers see the withdrawal.
|
||||
ctx.effect(() => () => {
|
||||
for (const pending of [...pendingApprovals.values()]) pending.resolve('cancelled')
|
||||
}, 'api-proxy: approval registry teardown')
|
||||
ctx.on('approval/request', (req, next) => {
|
||||
// The audit pair `approval/asked` is already appended by the service
|
||||
// before dispatch, but dispatch rides a microtask: parallel tool calls
|
||||
|
||||
Reference in New Issue
Block a user