Skip to content

fix: support current Kimi history and native session identity - #113

Draft
Yt4aZaveta wants to merge 1 commit into
howdeploy:mainfrom
Yt4aZaveta:codex/native-agent-history
Draft

Yt4aZaveta wants to merge 1 commit into
howdeploy:mainfrom
Yt4aZaveta:codex/native-agent-history

Conversation

@Yt4aZaveta

Copy link
Copy Markdown
Contributor

Summary

Current Kimi Code conversations were missing from chat history, ordinary Pi launches did not report a conversation ID, and resumed OpenCode sessions never reported working/idle status. This follow-up to #106 fixes those cases without changing the history panel's UI.

  • Read Kimi Code's version-2 session metadata from KIMI_CODE_HOME / ~/.kimi-code, accept native session_<UUID> IDs for hooks and exact resume, and derive unnamed titles from main-agent user prompts. Exclude child sessions and retain the legacy Python Kimi reader as a fallback; migrated legacy copies are not listed twice.
  • Load the existing lifecycle extension for Pi as well as OMP, including fork events. Keep same-project conversations separate, ignore spawned-agent signals, and leave launches unchanged when lifecycle hooks are disabled.
  • Bind resumed OpenCode root sessions from session.updated, which precedes native status events even when no session.created event occurs. Child and unrelated session updates cannot replace the tracked root.

Verification

  • Focused history/runtime suite: 57 passed, 0 failed. npm run test:even: 47 passed, 0 failed.
  • Full npm test on base c85cdd1 plus this change: 1,279 passed, 10 failed, 2 skipped (1,291 total). The 10 failures are also reproducible in a clean checkout of the base commit, without this change: shortcut/settings expectations, native TUI fixture assumptions and the repository-path audit. No new failure was observed in the history/runtime tests.
  • npm run build: passed on macOS arm64, including Node, renderer and mobile TypeScript checks.
  • Native isolated-home CLI runs created real conversations, read metadata through AgentChatHistoryService, and resumed the exact IDs for Codex, Claude, Qwen, Kimi Code, OpenCode, Hermes, Grok, OMP, Pi and MiniMax. Nine used a loopback model server with dummy credentials; OpenCode used its free model without login. Kimi/Pi native identity and OpenCode resumed working/idle signals were observed through the real runtime gateway.
  • Regression tests cover current/legacy Kimi stores, custom and prompt-derived titles, prefixed-ID hook delivery, Pi extension injection and identity isolation, and resumed OpenCode root/child event handling. Path fixtures cover macOS, Windows and Linux defaults.
  • git diff --check: passed. No plans, native test homes or local reports are included.

Review note

  • All 13 CLI providers resolve as installed. Cursor could create an empty ID but could not complete a model request in the isolated environment; populated Cursor history/resume remains unverified. Devin and Antigravity require login before a conversation and their existing explicitly unsupported history adapters are unchanged.
  • npm run audit:secrets reports a pre-existing personal home path in docs/linux-native-editing.md on the base branch. The built application has no audit findings; none of the reported source files are modified here.
  • These follow-up changes have not been tested in the native GUI or on native Windows/Linux. Existing installed DMGs do not include them.

@howdeploy

Copy link
Copy Markdown
Owner

Thanks for adding support for the current Kimi Code store and native session identities. One history regression needs to be fixed before this can merge.

P2 — An existing but empty modern store hides legacy conversations.

At ed448c4117d6ceaed842830f79c1747f7616a9e5, kimiHistory() immediately returns the result of kimiCodeHistory(codeHome).read() (src/main/services/agent-history/kimiHistory.ts:12). The legacy fallback runs only when the modern reader throws an ENOENT-style error. If the modern sessions directory exists but contains no accepted sessions, it returns an empty list successfully, so the legacy history is never read.

I reproduced this against the actual reader with one valid legacy conversation and an empty modern sessions directory: the legacy reader returns one conversation, but supplying codeHome returns zero. The same issue affects a modern directory containing only excluded child sessions or rejected metadata.

Please retain legacy conversations that have not been migrated. Reading both stores and deduplicating corresponding conversations is one option; at minimum, an empty modern result must not suppress valid legacy history. If both stores are supported together, the behavior should also cover partial migration rather than hiding all old conversations as soon as one modern conversation exists. Keep the modern native ID for a migrated entry so exact resume remains correct.

Please cover these cases in the history tests:

  • Existing empty modern store plus a valid legacy conversation.
  • Modern entries that are all excluded or invalid plus a valid legacy conversation.
  • A partially migrated history, with migrated conversations listed once and unmigrated legacy conversations retained.

Separately, please update the branch against the current main and rerun CI. The failures in the existing verify/Windows logs concern the old personal-path audit and keyboard expectations; main now contains the baseline corrections in a0f23b4d13818b477386b3801a99e1f539c0fc13. Those CI failures and the history regression above are separate issues.

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.

2 participants