Skip to content

fix(acp): replay history on session load#2

Closed
huntharo wants to merge 1 commit into
fix/acp-message-idsfrom
fix/acp-load-history-message-ids
Closed

fix(acp): replay history on session load#2
huntharo wants to merge 1 commit into
fix/acp-message-idsfrom
fix/acp-load-history-message-ids

Conversation

@huntharo
Copy link
Copy Markdown
Owner

@huntharo huntharo commented May 24, 2026

Summary

This PR builds on MoonshotAI#2359 and includes both ACP fixes in one branch:

  1. fix(acp): assign message ids to streamed content MoonshotAI/kimi-cli#2359: assign ACP messageId values to streamed content chunks after the ACP SDK bump to 0.10.0.
  2. This follow-up: make ACP session/load replay restored history, including messageId fields on replayed user, assistant, and thought chunks, and expose restored session metadata.

I can rebase this PR after MoonshotAI#2359 lands so it contains only the session-load replay change. Alternatively, if maintainers prefer to take both fixes together, this PR can be merged as the combined ACP fix and MoonshotAI#2359 can be closed.

Changes

  • Return a LoadSessionResponse with initial modes and models from session/load.
  • Advertise transcript restore support as sessionCapabilities._meta.kimi.sessionHistoryReplay = true so clients do not have to infer replay behavior from loadSession alone.
  • Replay persisted wire.jsonl records as ACP session/update notifications on load.
  • Send messageId on restored user, assistant, and thought chunks using the message-id run tracking from fix(acp): assign message ids to streamed content MoonshotAI/kimi-cli#2359.
  • Emit standard ACP SessionInfoUpdate title/updatedAt updates after prompt completion, and during session/load/session/resume.
  • Return title/updatedAt metadata on session/load and session/resume under _meta.kimi.session.
  • Record ACP/direct KimiCLI.run() turns to the session wire log so future loads have a replay source.
  • Fall back to context text history for older sessions that do not have a wire log.
  • Cover wire replay, context fallback, restored messageId, advertised replay capability, and session title metadata with tests.

Validation

  • uv run pytest tests/acp tests/core/test_notifications.py -q
  • uv run ruff check src/kimi_cli/acp/session.py src/kimi_cli/acp/server.py src/kimi_cli/app.py tests/acp/test_protocol_v1.py tests/acp/test_session_notifications.py tests/acp/test_server_initialize.py
  • uv run pyright src/kimi_cli/acp/session.py src/kimi_cli/acp/server.py src/kimi_cli/app.py tests/acp/test_protocol_v1.py tests/acp/test_session_notifications.py tests/acp/test_server_initialize.py
  • git diff --check

@huntharo huntharo force-pushed the fix/acp-load-history-message-ids branch from 5e25b1d to f86a8d4 Compare May 24, 2026 17:36
@huntharo huntharo force-pushed the fix/acp-load-history-message-ids branch from f86a8d4 to bea352f Compare May 24, 2026 17:44
@huntharo huntharo closed this May 24, 2026
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.

1 participant