Commit Graph
7 Commits
Author SHA1 Message Date
71d9ecb6bc fix(socket): recover from stale disconnected socket to prevent permanent "Connecting..." (#2487)
## Summary

- Fixed a reconnect edge case where socketService.connect() could get stuck when a stale disconnected socket instance existed for the same auth token.
- Prevented false-positive connecting UI state by clearing stale disconnected socket references before async reconnect guards run.
- Preserved existing safety behavior for active sockets (connected) and in-flight sockets (!disconnected) to avoid duplicate connections.
- Added a regression unit test to verify same-token reconnect creates a fresh socket instead of silently no-oping.

## Problem

- Users could be stuck on Connecting... and unable to chat after a disconnect/reconnect cycle.
- Root cause: reconnect logic set state to connecting, but returned early because this.socket was still non-null (stale/disconnected), so no new socket was created and no connect/connect_error transition fired.
- This left connection state stranded and blocked chat flows.

## Solution

- In socketService.connectAsync, when token is unchanged and this.socket.disconnected === true, explicitly clear stale runtime references (this.socket, this.mcpTransport) before continuing.
- Keep existing early returns for:
  - same-token + already connected
  - same-token + currently connecting (!disconnected)
- Added test coverage for the stale-socket scenario: second same-token connect() now creates a new socket instance (verifies io(...) called twice).

## Submission Checklist

- If a section does not apply to this change, mark the item as N/A with a one-line reason. Do not delete items.
- Tests added or updated (happy path + at least one failure / edge case) per Testing Strategy
- Diff coverage ≥ 80% — changed lines (Vitest + cargo-llvm-cov merged via diff-cover) meet the gate enforced by `.github/workflows/coverage.yml`. Run pnpm test:coverage and pnpm test:rust locally; PRs below 80% on changed lines will not merge.
- Coverage matrix updated — added/removed/renamed feature rows in `docs/TEST-COVERAGE-MATRIX.md` reflect this change (or N/A: behaviour-only change)
- All affected feature IDs from the matrix are listed in the PR description under ## Related
- No new external network dependencies introduced (mock backend used per Testing Strategy)
- Manual smoke checklist updated if this touches release-cut surfaces (`docs/RELEASE-MANUAL-SMOKE.md`)
- Linked issue closed via Closes #NNN in the ## Related section

## Impact

- Runtime/platform impact: frontend connection management path (app/src/services/socketService.ts) affecting desktop/web UI behavior where this service is used.
- Compatibility: no API/schema changes.
- Performance: negligible; only additional stale-reference cleanup in reconnect edge case.
- Security: no new credential surface or transport changes.


Co-authored-by: M3gA-Mind <megamind@mahadao.com>
2026-05-29 04:49:44 +05:30
03d1e2512e feat(e2e): complete E2E v2 suite — 66 specs, orchestrator, bug fixes (#2353)
Co-authored-by: Steven Enamakel <31011319+senamakel@users.noreply.github.com>
Co-authored-by: Steven Enamakel <enamakel@tinyhumans.ai>
2026-05-22 17:23:01 -07:00
oxoxDevandGitHub b1bbc53fce feat: tighten runtime policy + transport guards (#2331) 2026-05-21 23:39:05 +05:30
Ruifeng XueandGitHub 3aa8477e1a fix(socket): use core auth user id for socket state scoping (#1984) 2026-05-17 01:37:30 -07:00
Aqil AzizandGitHub 992d46dd15 fix(socket): preserve queued once listeners (#1978) 2026-05-16 20:44:36 -07:00
9a73cb24c6 fix(app): split connectivity into internet/core/backend channels (#1527) (#1727)
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Co-authored-by: Steven Enamakel <enamakel@tinyhumans.ai>
2026-05-15 15:56:00 -07:00
Mega MindandGitHub 4e9f2a8f77 feat(config): RPC bootstrap hardening, socket alignment, and exhaustive tests (#1313) 2026-05-06 16:45:42 -07:00