Skip to content

新建会话,向模型提问报错 #871

Open

Description

@ZHAO-YANG-A

Existing reports / 提交前查重

  • I searched existing issues and did not find the same problem / 我已搜索现有 Issue,没有发现相同问题

Affected area / 涉及区域

Conversations, models, or tools / 会话、模型或工具

Operating system / 操作系统

Windows 10 x64

Installation method / 安装方式

Windows installer / Windows 安装包

DSH Desktop version / DSH Desktop 版本

V2.0.5

DSH runtime version / DSH 运行时版本

不知道

Profile type / Profile 类型

Unknown / 不确定

Third-party plugins / 第三方插件

None/无

Fresh Profile comparison / 全新 Profile 对照结果

Not tested / 未测试

What happened? / 实际发生了什么?

打开新的会话会弹出,新会话发请求也会弹出
resume failed for session "session-a7e09e61-e849-4183-af68-
a03d456378bc": RemoteError: agent-presets: preset "code" not found
(available: standard, ptc, minimal, cordis) (gateway/internal)

Reproduction steps / 复现步骤

1、新建会话
2、向模型提问

Expected behavior / 预期结果

正确情况,模型会回复

Reproduction frequency / 复现频率

Every time / 每次都能复现

Logs or error details / 日志或错误信息

resume failed for session "session-a7e09e61-e849-4183-af68-
a03d456378bc": RemoteError: agent-presets: preset "code" not found
(available: standard, ptc, minimal, cordis) (gateway/internal)

Image

Screenshots or recordings / 截图或录屏

Image

Last known working version / 最后正常版本

No response

Additional context / 补充信息

No response

Sensitive information / 敏感信息

  • I removed API keys, tokens, account details, and other sensitive data from my attachments / 我已从附件中移除 API Key、Token、账号信息等敏感内容

Activity

  1. zp-home commented on Sep 17, 2026

    @zp-home
    Collaborator

    补一份根因定位,说明这个问题为什么没有随 #998 一起修好,以及后续怎么走。

    根因

    报错来自 resume 路径。deepseek-harness/packages/api/session-controller/src/agent.ts 在重建会话时读取会话自己记录的 preset:

    const composition = await this.composeAgent(this.presetForObservation(observation))

    而 preset id 的来源是会话创建头,见 packages/preset/agent-presets/src/session.ts:

    export const agentPresetProjectionDefinition = {
      key: 'agentPreset',
      init: header => header.agentPreset ?? null,
      apply: (state, event) => event.type === 'agent-preset/selected'
        ? event.data.agentPreset : state,
    }

    旧版本创建的会话,其创建头里写的是 code;新 runtime 的预设表只有 standard / ptc / minimal / cordis,于是 presets.resolve('code') 抛出 agent-preset/not-found,外层包成 resume failed for session "..."。

    为什么不能照 #998 的方式修

    #998(已合并)修的是 ~/.dsh/settings.yaml 里的全局默认值 agent-presets.default: code,解决的是新建会话失败(#997)。它动不了已存在会话里的 preset id,因为两者存放位置完全不同:

    1. 创建头按设计不可改。 同一文件的模块注释写明创建头 "is deep-frozen because that is a creation fact"。

    2. 唯一被允许的改法是追加 agent-preset/selected 事件,但对本场景双重不可行。 packages/preset/agent-presets/src/index.ts 中:

      if (boundary !== undefined
        && (boundary.openTurnStartSeq !== null || boundary.lastTurn > 0)) {
        throw new RemoteError('agent-preset/locked',
          `session "${agent.id}" has already started; its agent preset is fixed`)
      }

      其一,已开始过对话的会话预设被锁定,而本 issue 中的会话都有历史记录;其二,执行切换的 swap() 需要一个 live agent,而拿到 live agent 的前提是 resume 成功 —— resume 失败正是待修的问题本身,构成循环依赖。

    3. 上游也没有相应的存储迁移。 session-format-v0-to-v1 的 dispositions.ts 对 agent-preset/selected 只做 payload 成员保留,没有值映射;v1-to-v2、v2-to-v3 同样没有。整个 harness 源码中不存在 code → ptc 的会话迁移。

    现状与后续

    当前可用的绕过办法:受影响的历史会话暂时无法恢复;新建会话请先按 #997 中的方法把 ~/.dsh/settings.yaml 的 agent-presets.default 改为 ptc(升级到含 #998 的版本后会自动完成)。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    windowsWindows-specific issues

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions