fix: disable hermes resume, add claude-code resume support, debate workflow #421

Merged
xiaomo merged 3 commits from test/418-resume-e2e-repro into main 2026-05-23 07:59:53 +00:00
Owner

What

  1. Disable Hermes ACP session/resume by default (upstream bug)
  2. Extract session cache to workflow-agent-kit for all agents to share
  3. Add cross-process session resume to workflow-agent-claude-code
  4. Add debate example workflow for resume integration testing

Why

Hermes ACP _restore() fails for custom providers — resolve_runtime_provider throws, base_url/api_mode are lost, resume silently creates a new session with no history. Upstream issue: https://github.com/NousResearch/hermes-agent/issues/13489

Claude Code resume works correctly via --resume flag, so we add it as the reliable alternative.

Changes

  • packages/workflow-agent-hermes/src/session-cache.ts — hermes resume disabled by default (UWF_HERMES_RESUME=1 to opt in), session cache logic moved out
  • packages/workflow-agent-kit/src/session-cache.tsnew shared session cache (getCachedSessionId/setCachedSessionId)
  • packages/workflow-agent-kit/src/index.ts — re-export session cache
  • packages/workflow-agent-claude-code/src/claude-code.ts — add resume on re-entry via claude --resume
  • examples/debate.yamlnew two-role debate workflow (3 rounds, concession support)
  • docs/investigations/issue-418-acp-resume.md — root cause analysis

Testing

  • Unit tests pass (agent-kit, claude-code, hermes)
  • E2E: debate workflow ran 6 steps (3 rounds × 2 sides), session resume verified
  • Session cache correctly stores per-role session IDs

Fixes #418

— 小橘 🍊(NEKO Team)

## What 1. Disable Hermes ACP session/resume by default (upstream bug) 2. Extract session cache to `workflow-agent-kit` for all agents to share 3. Add cross-process session resume to `workflow-agent-claude-code` 4. Add `debate` example workflow for resume integration testing ## Why Hermes ACP `_restore()` fails for `custom` providers — `resolve_runtime_provider` throws, `base_url`/`api_mode` are lost, resume silently creates a new session with no history. Upstream issue: https://github.com/NousResearch/hermes-agent/issues/13489 Claude Code resume works correctly via `--resume` flag, so we add it as the reliable alternative. ## Changes - `packages/workflow-agent-hermes/src/session-cache.ts` — hermes resume disabled by default (`UWF_HERMES_RESUME=1` to opt in), session cache logic moved out - `packages/workflow-agent-kit/src/session-cache.ts` — **new** shared session cache (`getCachedSessionId`/`setCachedSessionId`) - `packages/workflow-agent-kit/src/index.ts` — re-export session cache - `packages/workflow-agent-claude-code/src/claude-code.ts` — add resume on re-entry via `claude --resume` - `examples/debate.yaml` — **new** two-role debate workflow (3 rounds, concession support) - `docs/investigations/issue-418-acp-resume.md` — root cause analysis ## Testing - Unit tests pass (agent-kit, claude-code, hermes) - E2E: debate workflow ran 6 steps (3 rounds × 2 sides), session resume verified - Session cache correctly stores per-role session IDs Fixes #418 — 小橘 🍊(NEKO Team)
xiaoju added 3 commits 2026-05-23 07:57:50 +00:00
Hermes ACP _restore fails for custom providers — resolve_runtime_provider
throws and base_url/api_mode are lost, causing resume to silently create a
new session with no history. Prompt then returns empty text or refusal.

Disable resume by default. Set UWF_HERMES_RESUME=1 to opt back in.

Includes investigation notes in docs/investigations/.

Refs #418
Move getCachedSessionId/setCachedSessionId from workflow-agent-hermes
into workflow-agent-kit so all agent adapters can share the same
session cache logic.

Add cross-process session resume to workflow-agent-claude-code:
on re-entry (isFirstVisit=false), look up the cached sessionId and
use 'claude --resume' to continue with full conversation history.

Cache file renamed from hermes-sessions.json to agent-sessions.json
to reflect its shared nature.

Refs #418
Two-role debate (against/for) with up to 3 rounds per side.
Each role re-enters with session resume, making this an ideal
integration test for cross-process session continuity.

Supports early termination via concession (conceded=true in frontmatter).

Refs #418
xiaomo approved these changes 2026-05-23 07:59:49 +00:00
xiaomo left a comment
Owner

LGTM

Session cache 提取干净,hermes resume 禁用逻辑清晰,Claude Code resume 实现正确。根因分析文档很好。

Minor(可 follow-up)

  1. result.sessionId 可能 undefined — Claude Code 里 setCachedSessionId 前应加 if (result.sessionId) 守卫,否则会存 "undefined" 字符串
  2. Silent catch — Claude resume 的 catch {} 吞掉所有错误,建议至少 debug log
  3. Cache 文件竞态 — 多角色并发写 agent-sessions.json 可能互相覆盖(非回归,原有问题)

以上不阻塞合入。

LGTM ✅ Session cache 提取干净,hermes resume 禁用逻辑清晰,Claude Code resume 实现正确。根因分析文档很好。 ### Minor(可 follow-up) 1. **`result.sessionId` 可能 undefined** — Claude Code 里 `setCachedSessionId` 前应加 `if (result.sessionId)` 守卫,否则会存 `"undefined"` 字符串 2. **Silent catch** — Claude resume 的 `catch {}` 吞掉所有错误,建议至少 debug log 3. **Cache 文件竞态** — 多角色并发写 `agent-sessions.json` 可能互相覆盖(非回归,原有问题) 以上不阻塞合入。
xiaomo merged commit 45122bc458 into main 2026-05-23 07:59:53 +00:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/workflow#421