Skip to content

System prompt race condition in reasoning #278

@DineshThumma9

Description

@DineshThumma9

Describe the bug

Reasoning code mutates a shared system prompt on the agent LLM during planning and execution. In parallel runs, one in-flight reasoning call can overwrite another call’s prompt, causing cross-agent prompt bleed and non-deterministic behavior.

Relevant Files : cot.py ,react.py,reasoning.py

Expected behavior

System prompt should be scoped per generate call, not mutated as shared instance state during concurrent reasoning.

To Reproduce

  1. Enable parallel stepping with multiple LLM agents.
  2. Run simulation where multiple agents call planning in same step.
  3. Observe occasional inconsistent tool choice or plan output that does not match the intended reasoning prompt context.
  4. Inspect reasoning files and see shared prompt mutation before generate calls.

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