Skip to content

test(cli): lock managed reconnect ensure-on-first-failure#37570

Open
armancharan wants to merge 2 commits into
anomalyco:v2from
armancharan:test/reconnect-ensure-coverage
Open

test(cli): lock managed reconnect ensure-on-first-failure#37570
armancharan wants to merge 2 commits into
anomalyco:v2from
armancharan:test/reconnect-ensure-coverage

Conversation

@armancharan

@armancharan armancharan commented Jul 17, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #36581

#36581

Parent epic: #36441

✧ raised · ○ in review · ● approved · ✓ merged

#36441 epic: scope streams + bound payloads

Merge in order:
v2
└ ○ #37486 location interest
   └ ○ #37487 session interest + fan-out bench
      └ ○ #37585 stream ownership / diagnostics
         └ ○ #37586 reconnect herd

Siblings under the epic (not git parents of the stack tip):
└ ○ #37559 session blobs + payloadHash
└ ○ #37570 ensure-on-first-failure ← this PR → feeds #37586

Builds toward #36285.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The ensure-on-first-failure reconnect policy already landed with the managed service lifecycle work (ServerConnection reconnect → Service.ensure with version: undefined; TUI calls it on every stream drop).

This adds the missing regression coverage from #36581:

  1. First failed reconnect runs ensure immediately (onStart("missing"))
  2. Passive reconnect reuses a healthy service from another version instead of replacing it

Also exports ServerConnection.managedReconnect so that policy is testable without going through the full resolve path.

How did you verify your code works?

  • bun test test/server-connection.test.ts --timeout 30000
  • bun run typecheck in packages/cli

Acceptance

Claim Test
First failed reconnect invokes ensure-running managed reconnect ensures the service on the first failure
Healthy version-mismatched service is reused managed reconnect reuses a healthy service from another version

Screenshots / recordings

n/a

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

Comment thread packages/cli/test/server-connection.test.ts
Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant