Skip to content

fix(telegram): relay-in startup age-gate + dead-letter quarantine (DIVE-1514)#9

Merged
lodar merged 1 commit into
mainfrom
dive-1514-relay-quarantine
Jul 24, 2026
Merged

fix(telegram): relay-in startup age-gate + dead-letter quarantine (DIVE-1514)#9
lodar merged 1 commit into
mainfrom
dive-1514-relay-quarantine

Conversation

@lodar

@lodar lodar commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

What

Defense-in-depth for the DIVE-1506 relay-in leak class in the SEND_ONLY team-bot inbound path.

drainRelayIn dedups only with an in-memory `seen` Set and has no age check, so a `relay-in/*.json` drop left across a bot restart/roll (the v0.5.22 roll was the trigger) is replayed by the fresh process. The fixture->human leg is already closed CLI-side (PR #70/v0.11.23); this closes the plugin half.

How

On startup, before the drain interval arms, quarantine any `relay-in/*.json` older than a short TTL (`TELEGRAM_RELAY_IN_TTL_MS`, default 5m) into a sibling `relay-dead/` dir and log the drop. Never silent-delete — a stale-but-legit send vanishing is the availability-direction twin, so the operator keeps a trail.

  • new pure helper `hooks/lib/relay-quarantine.ts` (clock injected, quiet on fs errors — a boot sweep must never wedge startup)
  • 4 unit tests (`relay-quarantine.test.ts`)
  • plugin `0.5.25 -> 0.5.26`

Test

  • `bun test` (telegram): 9/9 green
  • `bun test test/parity.test.ts`: 50/50 green (baseline-only change; forks use the wait_for_message inbound path, not relay-in)

Roll ordering (per task)

Land in the same version rolled; sweep stale relay-in across all bot homes + re-verify zero-pending at roll time.

🤖 Generated with Claude Code

…VE-1514)

drainRelayIn dedups only in-memory and has no age check, so a relay-in
file left across a bot restart/roll is replayed by the fresh process (the
DIVE-1506 leak class; fixture->human leg already closed CLI-side, PR #70).

Defense-in-depth: at startup, before the drain interval arms, quarantine
any relay-in/*.json older than a short TTL (env TELEGRAM_RELAY_IN_TTL_MS,
default 5m) into a sibling relay-dead/ dir and LOG the drop. Never
silent-delete: a stale legit send vanishing is the availability twin.

- new pure helper hooks/lib/relay-quarantine.ts (clock injected, quiet on fs errors)
- 4 unit tests; full telegram suite + fork parity green
- plugin 0.5.25 -> 0.5.26

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@lodar
lodar force-pushed the dive-1514-relay-quarantine branch from ddcba23 to 310afe1 Compare July 24, 2026 11:53
@lodar
lodar merged commit 52fc9c1 into main Jul 24, 2026
2 checks passed
@lodar
lodar deleted the dive-1514-relay-quarantine branch July 24, 2026 11:53
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