Skip to content

fix(hermes): support the native persistence API - #1135

Merged
iruriQ merged 1 commit into
BytePioneer-AI:mainfrom
zxd-666:fix/hermes-persistence-compat
Nov 24, 2026
Merged

iruriQ merged 1 commit into
BytePioneer-AI:mainfrom
zxd-666:fix/hermes-persistence-compat

Conversation

@zxd-666

@zxd-666 zxd-666 commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Hermes v0.23.3 removed the legacy session storage modules that codexhost imports. On an affected installation, the native history helper fails before opening a Hermes Turn, and the metadata helper cannot list import candidates.

Hermes gateway history and session listing
  Legacy storage modules available → existing SessionDB APIs
  Legacy storage modules removed   → Hermes persistence reader / writer

Both paths preserve native session IDs, transcript projection, and the existing Fork and rollback checks. Read-only helpers keep opening the active Hermes profile in read-only mode.

Related issues

N/A

UI Demo

N/A

Evidence

  • Before main at 1139a2a89 fails to create a native session on Hermes v0.23.4 with ModuleNotFoundError: hermes_state_ids. The new regression also fails on that baseline at the native metadata lookup.
  • After The new isolated storage regression passes on Hermes v0.23.2 and v0.23.4. It covers listing, history readback, Fork, rollback, safe disposal of derived sessions, and source snapshot equality.
  • Live The bundled Hermes plugin on macOS arm64 with Hermes v0.23.4 completed a real model Turn, reopened the Native Session, returned an identical persisted snapshot, and resolved its import candidate.

Test plan

  • vitest run --config tests/vitest.config.js packages/adapters/hermes/test/gateway-history.test.ts packages/adapters/hermes/test/gateway-session-list.test.ts — 11 passed. The new opt-in storage test passed separately with both native runtimes.
  • tsc -b packages/adapters/hermes, scoped ESLint and Prettier, and git diff --check passed.
  • The broader opt-in tool-history test reports the same native-history failure on the v0.23.2 baseline and patched build. The isolated managed Gateway smoke test was blocked by a gateway.capabilities timeout locally. The bundled plugin check used the resident Gateway. Desktop UI, Linux, and Windows were outside this run.

Merge Danger

Door Two-way. The change adapts calls to the installed Hermes APIs and requires no codexhost data migration.

Blast Radius Hermes Adapter.

@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • 兼容性改进
    • 提升了不同 Hermes 存储环境下的会话列表与历史记录读取兼容性。
    • 支持在相关环境中继续进行会话创建、导入、删除及恢复展示等操作。

Hermes 网关新增共享存储脚本,并根据 Hermes 模块可用性选择存储实现。历史和会话列表脚本改为调用该脚本提供的接口。测试增加可选的已安装 Hermes 集成验证。

Changes: Hermes 存储与网关

层 / 文件 摘要
存储实现与兼容分支
packages/adapters/hermes/src/gateway-storage-script.ts
新增存储脚本,按模块导入结果选择原生持久化接口或 hermes_state 接口,并提供会话、消息、恢复展示和列表等操作。
网关接入与历史验证
packages/adapters/hermes/src/gateway-history-script.ts, packages/adapters/hermes/src/gateway-session-list.ts, packages/adapters/hermes/test/gateway-history.test.ts
历史脚本改为调用 resume_display。会话列表脚本改为调用 default_db_path() 和 list_sessions()。可选集成测试验证会话列表、历史读取、检查点分叉、回滚及删除。

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Suggested reviewers: bytepioneer-ai

Merge Risk: Minimal · up to 9dd86

This change adds Hermes v0.23.3+ session-storage compatibility and keeps the existing SessionDB path when the legacy modules are present. No concrete defect was found in the supplied changes, and the author reports passing native storage tests on two Hermes versions. The remaining risk is limited to unrun platform and UI checks.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed 标题“fix(hermes): support the native persistence API”与变更内容一致。变更使 Hermes 适配器在 Hermes v0.23.3 及之后版本移除旧存储模块时,回退到原生持久化读写接口(GATEWAY_STORAGE_SCRIPT),涉及 gateway-history、gateway-session-list 与测试文件。标题简洁,指出了主要改动。
Description check Passed 描述与变更相关。说明了 Hermes v0.23.3 移除旧存储模块导致 codexhost 失败的原因,列出了原生历史辅助与会话列表的回退路径,并给出了测试计划和验证证据。描述涵盖了变更的目的、范围和测试情况。
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches

Generate unit tests (beta)

  • Create a new PR
Fix failing CI checks

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 1139a2a and 9dd863a.

Files selected for processing: 4

  • packages/adapters/hermes/src/gateway-history-script.ts
  • packages/adapters/hermes/src/gateway-session-list.ts
  • packages/adapters/hermes/src/gateway-storage-script.ts
  • packages/adapters/hermes/test/gateway-history.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Recent review details

Context from checks skipped due to timeout: 8

  • GitHub Check: CodeRabbit
  • GitHub Check: Check macos-26
  • GitHub Check: Check windows-latest
  • GitHub Check: Static checks
  • GitHub Check: Web Host tests
  • GitHub Check: Vitest
  • GitHub Check: Check ubuntu-22.04
  • GitHub Check: Check Linux ARM64
Additional context used

Code guidelines: 1

AGENTS.md — auto-discovered
Path-based instructions: 2

Source excerpt: Harness-specific protocol details must remain inside the corresponding Adapter.

CodeRabbit inference engine (AGENTS.md)

Files:

  • packages/adapters/hermes/src/gateway-history-script.ts
  • packages/adapters/hermes/src/gateway-session-list.ts
  • packages/adapters/hermes/src/gateway-storage-script.ts
  • packages/adapters/hermes/test/gateway-history.test.ts
Source excerpt: Use package public exports for cross-package dependencies.

CodeRabbit inference engine (AGENTS.md)

Files:

  • packages/adapters/hermes/src/gateway-history-script.ts
  • packages/adapters/hermes/src/gateway-session-list.ts
  • packages/adapters/hermes/src/gateway-storage-script.ts
  • packages/adapters/hermes/test/gateway-history.test.ts

@iruriQ
iruriQ merged commit 6830354 into BytePioneer-AI:main Nov 24, 2026
7 of 8 checks passed
@iruriQ

iruriQ commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

感谢贡献!已在隔离的 Hermes v0.23.4(含空目录只读、tool_pin、压缩 lineage、Fork/Rollback)与本机旧版 v0.21.5 实测通过,已合入 main。

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