qwen-code/integration-tests
jinye 246a0a1fc5
feat(core): persist file history snapshots for cross-session /rewind (T2.1) (#4897)
* feat(core): persist file history snapshots to JSONL for cross-session /rewind (T2.1)

File history snapshots were purely in-memory — lost on process exit, making
/rewind unusable after session resume. This adds JSONL persistence so restored
sessions can rewind to any pre-resume turn.

Key changes:
- Serialize/deserialize FileHistorySnapshot to/from JSONL system records
- Record each snapshot after makeSnapshot succeeds (incremental per turn)
- Re-record surviving snapshots after rewind (full batch on active branch)
- Parse file_history_snapshot records in sessionService.loadSession()
- Restore snapshot chain in config.getFileHistoryService() on resume
- Copy backup files on session fork (hard link with copy fallback)
- Add session_resume capability tag (stable alias for unstable_session_resume)
- validateRestoredSnapshots with dedup + batched parallel stat

🤖 Generated with [Qwen Code](https://github.com/QwenLM/qwen-code)

* fix: address Copilot review — last-wins dedup + isEnabled guard

- Change snapshot dedup from first-wins to last-wins so rewind batch
  records (which contain the most up-to-date snapshot state) override
  earlier incremental records for the same promptId.
- Guard validateRestoredSnapshots behind isEnabled() to skip I/O
  when file checkpointing is disabled.

🤖 Generated with [Qwen Code](https://github.com/QwenLM/qwen-code)

* fix: address wenshao review — ghost snapshots + test assertion

- Session.ts: slice snapshots to targetTurnIndex+1 to exclude
  turns being discarded (fixes ghost-snapshot persistence)
- AppContainer.tsx: only pass snapshots when file restore succeeded
  (avoids writing un-truncated snapshots for conversation-only rewind)
- Session.test.ts: update rewindRecording assertion to expect 3 args

🤖 Generated with [Qwen Code](https://github.com/QwenLM/qwen-code)

* fix: address wenshao R2 — slice snapshots in AppContainer + add deserialize warning

- AppContainer.tsx: use .slice(0, targetTurnIndex + 1) to match
  Session.ts behavior (prevents ghost snapshots for conversation-only rewind)
- sessionService.ts: log warning instead of silent continue on malformed
  file_history_snapshot deserialization

🤖 Generated with [Qwen Code](https://github.com/QwenLM/qwen-code)

* fix: enable daemon file checkpointing + seed TUI promptCount on resume

Two fixes from wenshao's local verification:

1. ACP daemon sessions had fileCheckpointingEnabled=false because
   stdin is a pipe (non-TTY). Add enableFileCheckpointing() to Config
   and call it in acpAgent.newSessionConfig so daemon /rewind works.

2. TUI prompt counter restarted at 0 on --resume, colliding with
   restored snapshot promptIds and corrupting the chain via last-wins
   dedup. Seed promptCount from the resumed conversation's user turn
   count so new promptIds don't overlap.

🤖 Generated with [Qwen Code](https://github.com/QwenLM/qwen-code)

* fix: add makeSnapshot + recordFileHistorySnapshot to ACP prompt path

ACP sessions drive the chat through Session.prompt → GeminiChat,
bypassing GeminiClient.sendMessageStream where makeSnapshot lives.
This meant daemon-created sessions never produced file history
snapshots, leaving /rewind non-functional.

Add makeSnapshot + recordFileHistorySnapshot at the start of each
ACP prompt turn (mirroring client.ts:1488), using the existing
sessionId########turn promptId format.

🤖 Generated with [Qwen Code](https://github.com/QwenLM/qwen-code)

* fix: add session_resume to integration test capability assertion

🤖 Generated with [Qwen Code](https://github.com/QwenLM/qwen-code)

* fix: add debug logging to ACP makeSnapshot catch blocks

🤖 Generated with [Qwen Code](https://github.com/QwenLM/qwen-code)

* fix(acp): move makeSnapshot after slash-command and hook checks

Locally handled slash commands (/help, /memory, etc.) previously
created file history snapshots even though no model turn was added.
This caused the snapshot index to drift from the real user turn count,
breaking rewind in web-shell sessions that use slash commands frequently.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: address qwen-code-ci-bot review round 5

- Remove stale line number from comment (Session.ts)
- Single cast instead of double cast for systemPayload (sessionService.ts)
- Guard mkdir in copyFileHistoryBackups to prevent fork failure (sessionService.ts)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: address wenshao review — mock, ordering guard, JSDoc placement

- Add makeSnapshot/rewind to FileHistoryService mock in Session.test.ts
- Invalidate cached FileHistoryService on enableFileCheckpointing() to
  prevent stale enabled=false if service was lazily created first
- Move copyFileHistoryBackups above class JSDoc to fix association

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: truncate in-memory snapshots on ACP rewind + deduplicate recordFileHistorySnapshot

- Call restoreFromSnapshots(survivingSnapshots) in ACP rewindToTurn to
  prevent phantom snapshots from accumulating in the in-memory array
  after conversation-only rewind
- Simplify recordFileHistorySnapshot to delegate to the batch variant

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: add restoreFromSnapshots to FileHistoryService mock

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-06-12 13:50:16 +08:00
..
baselines test(perf): add daemon baseline harness (#4175 Wave 1 PR 1) (#4205) 2026-05-17 00:41:26 +08:00
cli feat(core): persist file history snapshots for cross-session /rewind (T2.1) (#4897) 2026-06-12 13:50:16 +08:00
concurrent-runner feat(web-search): remove built-in web_search tool, replace with MCP-based approach (#3502) 2026-04-24 11:29:02 +08:00
fixtures feat(daemon): merge daemon-mode feature batch into main (#4490) 2026-06-12 00:34:49 +08:00
hook-integration feat(hooks): Add HTTP Hook, Function Hook and Async Hook support (#2827) 2026-04-16 10:10:33 +08:00
interactive feat(core): enable loop/cron tools by default (#4950) 2026-06-10 23:21:53 +08:00
sdk-typescript fix(test): count result messages instead of assistant messages in multi-model E2E test (#4341) 2026-05-20 10:42:51 +08:00
terminal-bench Terminal Bench Integration Test (#521) 2025-09-05 17:02:03 +08:00
terminal-capture feat: add Agent Team experimental feature for parallel sub-agent coordination (#4844) 2026-06-11 07:58:32 +08:00
channel-plugin.test.ts docs(channels): add plugin developer guide and rename mock to plugin-example 2026-03-27 03:19:34 +00:00
globalSetup.ts feat(core): support QWEN_HOME env var to customize config directory (#2953) 2026-05-09 15:51:52 +08:00
test-helper.ts test(integration): harden flaky sleep-interception e2e against skipped tool calls (#4936) 2026-06-11 00:08:26 +08:00
test-mcp-server.ts # 🚀 Sync Gemini CLI v0.2.1 - Major Feature Update (#483) 2025-09-01 14:48:55 +08:00
tsconfig.json refactor(serve): 1 daemon = 1 workspace (#3803 §02) (#4113) 2026-05-15 12:44:36 +08:00
vitest.config.ts feat(daemon): merge daemon-mode feature batch into main (#4490) 2026-06-12 00:34:49 +08:00
vitest.loadtest.config.ts feat(daemon): merge daemon-mode feature batch into main (#4490) 2026-06-12 00:34:49 +08:00
vitest.terminal-bench.config.ts Fix E2E caused by Terminal Bench test (#529) 2025-09-08 10:51:14 +08:00