github / github/copilot-cli

Constrain `run_factory` to registered factory names to prevent repeated guesses

未关闭
#4,425 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

area:agents area:tools
主要语言
Shell
星标
11.2k
派生
1.9k
平均合并
14 小时 16 分钟
30 天内合并 PR
6

描述

Summary

run_factory can be exposed with an unconstrained name argument even when no matching factory is registered. The model can interpret tool availability as factory availability, invent plausible names, and retry them serially.

Originally reported from the VS Code Agents Window in microsoft/vscode#329551.

Observed behavior

With Copilot CLI 1.0.78 and GPT-5.6 Sol, one session produced 13 distinct model-authored run_factory calls. Every call failed immediately with:

RpcResponseError: No factory registered with name "<name>"

The model first tried eight implementation-oriented names:

  • apply_finding
  • code_implementation_factory
  • single_task
  • implementation
  • code-task
  • fix-factory
  • repo_task
  • review_then_implement

It later tried five more names for video analysis:

  • video_analysis
  • analyze_video
  • single_video_analysis
  • video-analysis
  • media_analysis

These were separate assistant-authored calls after each rejection, not host retries. No factory ran.

Steps to reproduce
  1. Expose run_factory in a session where no matching factories are registered.
  2. Ask the agent to perform a routine single-session task, such as a small implementation or media-analysis task.
  3. Observe that the model may invent and repeatedly retry factory names.
Expected behavior

Invalid factory names should be impossible or strongly bounded. Ideally:

  • Dynamically constrain name to registered factory names.
  • Do not expose run_factory when there are no registered factories or resumable runs.
  • If dynamic enum generation is not possible, require registry discovery before invocation and include available names in validation errors.
  • Enforce exactly one of name and resumeFromRunId at the schema level.
Actual behavior

name is effectively a free-form string, so failures occur only after a costly tool round trip. Prompt guidance to use factories selectively did not prevent repeated guesses.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先在仓库中定位 run_factory 工具 schema、factory registry 和 validation 路径。跟踪已注册名称和可恢复运行是如何暴露的,然后找出现有的工具调用或 schema validation 测试;当无效名称在工具往返之前被拦截,并且强制执行 name 与 resumeFromRunId 的互斥性时,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
shell
领域
cli
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。