Repository navigation
fix(agent): 重启后被接管的待决策 run 恢复决策卡片 - #1757
Merged
Merged
Conversation
felinics#1724 把 DBService.GetVisibleHistoryTurnRequestMessageIDByTurn 当作无调用方 删除,但 ParkedRunMessages 通过类型断言调用它。断言静默失败后,重启后被接管 的 waiting_decision run 在运行快照里没有消息:重新打开会话只显示“Working on your request”,看不到决策卡片,用户无法作答。 恢复该方法,并在编译期把消息服务固定到 parkedRunRequestResolver,避免它再被 当作死代码删除。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
chen-ran
marked this pull request as ready for review
November 7, 2026 08:47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Author
Type
Summary
问题:#1724 把
DBService.GetVisibleHistoryTurnRequestMessageIDByTurn当作无调用方删除,但ParkedRunMessages是通过类型断言(s.messageService.(interface{ GetVisibleHistoryTurnRequestMessageIDByTurn(...) }))调用它的,所以编译和单测都发现不了。断言失败后函数静默返回空:server 重启后,被新进程接管的waiting_decisionrun 在runtime_snapshot里messages为空。用户重新打开会话只看到 “Working on your request”,看不到决策卡片,也就无法作答。页面一直开着则不受影响,因为卡片还留在前端内存里。修复:
DBService.GetVisibleHistoryTurnRequestMessageIDByTurn,实现与 refactor(agent): 收紧上下文准备,每轮只读一次历史,历史窗口只留一条查询 #1724 之前一致,复用仍保留的GetHistoryTurnByID查询。parkedRunRequestResolver,并加上var _ parkedRunRequestResolver = (*messagepkg.DBService)(nil):以后再删这个方法会直接编译失败,不会再静默降级。改动只涉及
internal/agent/application/runtime_decision.go和internal/chat/message/service.go,没有 schema、API 或前端改动。Related Issues
Refs #1724(引入回归)、#1707(待决策跨重启恢复)。这个问题是在 Memoh Cloud 同步
49c948dae后做滚动升级演练时发现的。Validation
环境:本 worktree 的独立
mise run dev栈(compose 项目memoh-parked,Webhttp://localhost:21782),真实模型mimo-v2.6-pro,Botparked-qa。main95e20b6):让模型调用ask_user让我在 Pine / Oak 之间选,决策卡片正常出现。docker restart memoh-parked-server后重新打开页面:WSruntime_snapshot为status=waiting_decision, messages=0,页面只有 “Working on your request”,没有卡片。messages=2,卡片恢复。选择 Pine 并提交后,同一 run 完成,回复PARKED_OK Pine。docker restartserver,重新打开页面:messages=2,卡片出现。选择 Birch 后回复PARKED_AGAIN_OK Birch。go build ./...、go vet通过;go test ./internal/agent/application/ ./internal/chat/message/ ./internal/agent/runtime/session/通过;golangci-lint 2.10.1 对改动的两个包无问题。未做:多副本 / Valkey 部署下的跨实例接管只在 Memoh Cloud 的 kind 环境做过(同一修复,旧版本 messages=2、修复前新版本 0、修复后 2),本 PR 没有在 OSS 的 Valkey 验收环境复跑。
Screenshots / Recordings
Human QA
🤖 Generated with Claude Code