Skip to content

fix(desktop): discard explicitly aborted turns#1687

Merged
esengine merged 1 commit into
esengine:mainfrom
GTC2080:GTC/fix-1593-long-edit-instructions
May 24, 2026
Merged

fix(desktop): discard explicitly aborted turns#1687
esengine merged 1 commit into
esengine:mainfrom
GTC2080:GTC/fix-1593-long-edit-instructions

Conversation

@GTC2080

@GTC2080 GTC2080 commented May 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Root Cause

Desktop explicit aborts used the same loop abort behavior as session switches. The loop persists the user prompt before the first API call so interrupted sessions remain visible, but for a user-initiated Abort that left the abandoned long edit prompt in history. The next request could then include both the stale interrupted task and the new prompt, making the model treat the user as repeatedly interrupting or narrowing the work.

Fixes #1593

Validation

  • npm test -- --run tests/loop-user-persist.test.ts tests/loop.test.ts tests/desktop-crash-guards.test.ts
  • npm test -- --run tests/public-api.test.ts tests/loop-user-persist.test.ts
  • npx biome check src/loop.ts src/index.ts src/cli/commands/desktop.ts tests/loop-user-persist.test.ts
  • npm run typecheck
  • pre-push npm run verify: 262 test files passed; 3610 tests passed; 12 skipped. Biome reported two existing unused-suppression warnings outside this change.

@GTC2080 GTC2080 marked this pull request as ready for review May 24, 2026 13:15
@esengine esengine merged commit 0c0e800 into esengine:main May 24, 2026
4 checks passed
@esengine

Copy link
Copy Markdown
Owner

Thanks — merged. Cleanly factored: explicit LoopAbortOptions.discardCurrentTurn opts in, the iter-start + signal.aborted branches both honor it, default behavior unchanged for session switches and new_chat. Public API addition correctly threaded through src/index.ts and the allowlist test. The regression case (mid-fetch abort → next request body carries only the new user message) makes the intent unambiguous.

One UX trade-off worth noting for a possible follow-up: the aborted text disappears from session.jsonl on disk, so a reload/session-switch loses what the user typed. A later iteration could surface it back as a composer draft on Abort so the model log still gets cleared but the user can edit + resend without retyping. Not for this PR.

@GTC2080 GTC2080 deleted the GTC/fix-1593-long-edit-instructions branch May 31, 2026 10:43
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.

桌面最新版本,在长文本编辑任务时依旧会考虑效率、token之类的再次篡改指令

2 participants