← Back to Pull requests

fix(dspy): preserve ReAct tool history when output names collide #10922

Open
unknown opened this pull request with 173 lines diff across 2 files
View on GitHub
unknown unknown commented on Nov 19, 2026 18:35 UTC
Author

📝 Changes Description

A ReAct planner can declare question -> tool_calls: list[str]. On 7fbc8ff, returning ["lookup"] from submit also replaces the history event’s structured tool calls with that list. Passing the history into a second call drops the previous native submit call and its result from the model request.

ReAct now copies final outputs into the history event only when their names are outside the inner predictor’s signature. The application still reads prediction.tool_calls == ["lookup"], and the follow-up request replays the original call and result with their matching ID.

The offline regression inspects the second request for both parts. All four sync/async and normal/forced-submit cases failed on the baseline and pass with the fix.

✅ Contributor Checklist

  • Local pre-commit checks passed, including Ruff and ty check.

  • PR title and commit use the fix(dspy) format.
  • Validation

  • pytest tests/predict/test_react.py tests/predict/test_react_v2.py tests/streaming/test_react_native_tool_stream.py --extra -q — 118 passed.

  • pytest tests/adapters/test_chat_adapter.py tests/adapters/test_json_adapter.py tests/adapters/test_xml_adapter.py -k history -q — 32 passed.
  • ⚠️ Warnings

    Codex wrote the implementation, documentation and regression test, and ran the local checks. The model responses in the regression are scripted.

    Diff: 173 lines (+129 / -44) across 2 files Reviewer: chrikrah Review duration: 6956m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.35) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.35 · 173 lines diff across 2 files
    0.35
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.309
    Real PR Conversation Timeline
    1 comments
    "Review active on #10922"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 35.3% (MEDIUM) · Higher = larger blast radius
    35.3%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 18.8% · Safe to merge
    18.8%