Skip to content

subagents: 为生产 Pi adapter 补齐生命周期集成覆盖 #176

Closed

Description

@tt-a1i

问题

extensions/subagents/src/backends/pi.ts 是 Direct Subagent 的生产 Pi adapter,负责 Session 创建、事件桥接、first-response watchdog、取消、dispose、usage 与动态 tool binding,但当前关键测试主要覆盖 manager/stub,缺少对生产 adapter 的端到端生命周期合同。

Provider、Pi extension hook 或 Session API 变化可能让生产路径挂起、双重 settle、泄漏 Session 或丢失最后结果,而现有测试仍然全绿。

期望

建立最小 fake Pi Session 集成测试,覆盖:

  • spawn → first response → tool loop → final settlement;
  • silent provider 的 first-response timeout;
  • prompt 中取消、工具中取消、late completion;
  • cleanup/dispose 超时与错误;
  • restart/send 后的 run identity;
  • usage、model、tool allowlist 与 cwd 传递;
  • 每条路径只 terminalize 一次并释放并发槽。

测试应直接穿过生产 adapter,不复制实现为第二套 mock state machine。

Activity

  1. CuSO41108 commented on Aug 28, 2026

    @CuSO41108
    Contributor

    Hi, I’d like to take #176.

    I plan to add deterministic lifecycle integration coverage that exercises the production Pi backend through a controllable fake AgentSession, rather than extending the scripted stub backend.

    The scope will cover:

    • spawn → first assistant response → tool lifecycle → single final settlement;
    • silent-provider first-response timeout, cancellation during prompt/tool work, and late completion;
    • bounded cleanup/disposal timeouts and failures, including concurrency-slot release;
    • send/restart behavior and propagation of cwd, model, thinking level, tool allowlist, usage, and metadata.

    I expect to introduce only the smallest test seam needed to inject the fake session and short test deadlines; production defaults and behavior will remain unchanged. If the tests expose a runtime defect, I’ll keep any fix narrowly scoped and call it out separately.

    If this scope matches your intent, please assign the issue to me.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions