Constrain `run_factory` to registered factory names to prevent repeated guesses
Nessuno ha ancora preso questa issue.
- Lingua principale
- Shell
- Stelle
- 11.2k
- Fork
- 1.9k
- Merge medio
- 14h 16m
- PR unite (30g)
- 6
Descrizione
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_findingcode_implementation_factorysingle_taskimplementationcode-taskfix-factoryrepo_taskreview_then_implement
It later tried five more names for video analysis:
video_analysisanalyze_videosingle_video_analysisvideo-analysismedia_analysis
These were separate assistant-authored calls after each rejection, not host retries. No factory ran.
Steps to reproduce
- Expose
run_factoryin a session where no matching factories are registered. - Ask the agent to perform a routine single-session task, such as a small implementation or media-analysis task.
- 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
nameto registered factory names. - Do not expose
run_factorywhen 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
nameandresumeFromRunIdat 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.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia individuando nel repository lo schema dello strumento run_factory, il registro delle factory e il percorso di validazione. Traccia il modo in cui vengono esposti i nomi registrati e le esecuzioni riprendibili, quindi individua i test esistenti per l’invocazione degli strumenti o la validazione dello schema; il lavoro è completato quando i nomi non validi vengono intercettati prima di un round trip dello strumento e viene fatta rispettare l’esclusività tra name e resumeFromRunId.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- shell
- Ambito
- cli
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Tranquilla
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 48/100