Skip to content

Carry an unattended fail-closed deny to the gateway (gatewaystack-connect#690 fix 3) - #25

Open
davidcrowe wants to merge 1 commit into
fix/relay-warningfrom
fix/690-carry-fail-closed
Open

Carry an unattended fail-closed deny to the gateway (gatewaystack-connect#690 fix 3)#25
davidcrowe wants to merge 1 commit into
fix/relay-warningfrom
fix/690-carry-fail-closed

Conversation

@davidcrowe

@davidcrowe davidcrowe commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator

gatewaystack-connect#690, fix 3 — the ledger reconciliation half. Stacked on #24 (0.15.0); merge that first. Gateway wording for the carried row: davidcrowe/gatewaystack-connect#1000.

What was wrong

Confirmed 2026-08-13 on that issue: /govern/tool-use answered a slow request with an allow after this hook had already aborted and, at an unattended tier, denied. The server's ledger said allowed; the agent was blocked; neither side could see the contradiction. Fixes 1 and 2 (retry within budget, duplicate-hook detection) shipped in 0.10.2. Since 0.14.0 the interactive fail-open branch queues its lapse and the session's next PostToolUse carries it to the gateway as pre_lapse. The unattended fail-closed branch still recorded nothing anywhere.

What this does

On an unattended-tier outage the hook still denies exactly as before, and now also:

  • appends a lapse.log line with posture: "closed" (the interactive branch's lines have no posture field, so the two are distinguishable in the same file);
  • queues the same per-session marker the interactive branch uses, with the detail marked fail-closed (<tier> tier): <detail>, so the session's next PostToolUse carries it as pre_lapse and the gateway writes the row. The gateway side reads that prefix and stamps the row "blocked client-side: gateway unreachable at PreToolUse, unattended tier fails closed" instead of "ran ungoverned" — a call that never ran must not be recorded as having run ungoverned.

Nothing about the deny itself changes: same message, same steer, same exit.

Tests

test/fail-closed-carry.test.mjs: background-tier outage → deny, posture: "closed" lapse line, marked marker; the next PostToolUse carries it and clears on 2xx; the carried record never changes the PostToolUse output. Full node --test: 118 pass.

…oolUse (gatewaystack-connect#690 fix 3)

The interactive fail-open branch has queued its lapse for the session's
next PostToolUse since 0.14.0; the unattended fail-closed branch recorded
nothing, so a call this client blocked while the gateway was answering
allow left the two ledgers disagreeing with no way to see it. Same lapse
log (posture: closed) and same per-session carry, with the detail marked
so the gateway's row says blocked client-side, not ran ungoverned.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant