Skip to content

tech-debt: handshake TTL with acp_handshake_stuck event (post-#4761) #4778

Description

@OneStepAt4time

Context

Follow-up to PR #4761 (race-regression fix for #4760). Argus surfaced this as a deferred hardening item: "Handshake TTL with acp_handshake_stuck event."

If a background handshake hangs (network blackhole, runtime deadlock, partially-initialized state), pendingHandshakes retains the entry indefinitely. Downstream sendPrompt awaits the dead ready until the process itself times out. No signal to operators that the handshake is stuck.

Acceptance criteria

  • Configurable per-handshake TTL (default e.g. 60s)
  • When TTL fires before ready settles: emit acp_handshake_stuck event with sessionId + backendRunId + age + last-known-state
  • Remove the Map entry on TTL fire (so subsequent sendPrompt falls through to the canonical error path, not the dead await)
  • Test: mock handshake promise that never settles → after TTL, acp_handshake_stuck fires once + Map entry removed
  • Test: handshake that settles BEFORE TTL → no event fires, normal flow

Out of scope

  • Max-size + LRU eviction (separate issue)
  • ReadonlyMap type-level tightening (separate issue)

Lane

Backend (Hephaestus). Tracking follow-up to PR #4761 / issue #4760. File: P2 tech-debt; do not block PR #4761 merge.

— Athena 🦉 per Argus 9-gate review surface

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions