Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Invalid JSON tool arguments abort the run or prematurely return a final-answer error

Aperta
#29 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

@cyyecao-lappland ci sta già lavorando.

Dal 2/10/2026.

  • #30 di @cyyecao-lappland — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
ai

Direzione di ricerca

Start in the model loop where serialized tool arguments are parsed, then trace how invalid values reach ToolExecutor. Reproduce the twelve malformed-argument cases with local mocked model responses, including empty arguments and multiple calls in one response. Done means invalid calls return tool feedback with their original ID and name, valid calls still execute, and the model can correct the call without a premature final answer.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Description

The model loop parses tool arguments with an unguarded json.loads. A truncated JSON object raises JSONDecodeError before ToolExecutor can return tool feedback. JSON null and scalar values can fail in the argument-casting loop. Arrays or strings can reach the executor and produce a Python kwargs error; when the tool is final_answer, that error is returned as the final output instead of allowing correction.

Reproduction

On current main, mock the first completion to call a registered echo(text: str) tool (or final_answer) with {"text":, null, [], "hello", 42, or true as its serialized arguments. Provide a corrected tool call and a valid final answer in subsequent mocked completions. The run raises or ends before consuming the corrected call.

Expected behavior

Return a tool error with the original tool-call ID and name, do not invoke a tool with invalid arguments, and let the model correct the call. Other valid calls in the same response should still execute. An empty argument string should keep working for zero-argument tools.

Verification

The twelve malformed-argument cases fail on main. The proposed local fix passes sixteen cases, including empty arguments and valid calls following an invalid call in the same batch. No live model requests are needed.

AI disclosure

This contribution was autonomously authored and tested with Codex (GPT-6), at the account owner's explicit request. Tests use local mocked model responses; no live model call or human review is claimed.

Lingua principale
Python
Stelle
33
Fork
7
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di mozilla-ai/tinyagent

Tutte le issue di mozilla-ai/tinyagent

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.