GitNexus/gitnexus-web/test/unit
Bassey Riman 6c572749b0
fix(web): stop Nexus AI agent when user clicks Stop (#1820)
* fix(web): stop Nexus AI agent when user clicks Stop

Wire AbortController through chat streaming so Stop cancels the LangGraph
run instead of only hiding the loading UI. Fixes #1615.

* fix(web): address PR review feedback for Nexus AI stop

Guard stream cleanup against Stop-then-Send races, remove dead cancelled
handler, tighten abort error detection, add stopped tool-call status, and
extend abort unit tests. Fixes #1615.

* chore(autofix): apply prettier + eslint fixes via /autofix command

* fix(web): address review findings for Nexus AI stop/cancel

- Fix race conditions in useAppState.tsx abort lifecycle:
  - Replace stale isChatLoading closure guard with chatStateRef
  - Track and cancel rAF handles in stopChatResponse/finally
  - Move cancelled chunk check before onChunk dispatch
  - Simplify finally block to unconditional cleanup via chatStateRef
  - Guard tool_result from overwriting stopped status
  - Have clearChat abort in-flight streams before clearing
- Reorder isAbortError to check error identity before signal.aborted
- Refactor AgentStreamChunk to discriminated union for exhaustive switch
- Fix test assertions to use exact .toEqual() per DoD §2.7
- Add test for plain Error with name AbortError
- Remove dead markStopped alias, simplify signal spread-conditional

---------

Co-authored-by: Gergő Magyar <gergomagyar@icloud.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Test <test@example.com>
2026-05-26 19:18:36 +01:00
..
agent-abort.test.ts fix(web): stop Nexus AI agent when user clicks Stop (#1820) 2026-05-26 19:18:36 +01:00
agent-history.test.ts feat: Support DeepSeek V4 API (#1594) 2026-05-23 08:05:13 +01:00
backend-client-retry.test.ts feat: shared resilient-fetch (retries + circuit breaker) (#1448) 2026-05-09 15:18:09 +01:00
bug-fixes.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
constants.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
embedding-auto-start.test.ts feat(i18n): make web and CLI language-aware (#1748) 2026-05-23 06:14:24 +01:00
filter-panel.test.ts feat(web): Introduce Tree View and Circles View in Web Viewer (#1799) 2026-05-26 18:05:50 +01:00
graph.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
heartbeat.test.ts chore(web): bump vite 7.3.2 -> 8.0.10 + vitest 4 (iter 3 of 3) (#1063) 2026-04-24 14:16:45 +01:00
i18n.test.tsx feat(i18n): make web and CLI language-aware (#1748) 2026-05-23 06:14:24 +01:00
mermaid-generator.test.ts ci: E2E workflow, web typecheck job, pre-commit hook, test suite (#486) 2026-03-24 06:01:08 +00:00
path-resolution.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
perf-optimizations.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
security-guards.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
server-connection.test.ts feat(web): support GITNEXUS_BACKEND_URL env var for Docker deployments (#1286) 2026-05-25 11:21:11 +01:00
settings-service.test.ts feat: Support DeepSeek V4 API (#1594) 2026-05-23 08:05:13 +01:00
test-setup-storage.test.ts feat(i18n): make web and CLI language-aware (#1748) 2026-05-23 06:14:24 +01:00
use-auto-scroll.test.tsx fix(extractors): resolve 3 silent contract mis-resolution bugs (#793) (#817) 2026-04-14 08:03:02 +01:00
utils.test.ts ci: E2E workflow, web typecheck job, pre-commit hook, test suite (#486) 2026-03-24 06:01:08 +00:00