Skip to content

[Bug] OpenAI Shim Injects Synthetic Protocol Text #893

Description

@akramcodez

Description

The OpenAI shim might inject synthetic [Tool results received] markers or similar protocol text that reaches the model as assistant content, which can corrupt the model's generation context.

Environment

  • OS: Any
  • Node version: Node 22+
  • Nanocoder version: 1.29.0
  • Provider: OpenAI-compatible API
  • Model: Any

Steps to Reproduce

  1. Connect via OpenAI-compatible provider.
  2. Trigger a tool call and examine the raw payload sent back to the model in subsequent turns.
  3. Observe synthetic protocol text.

Expected Behavior

The shim should format tool results strictly according to the API spec without injecting synthetic markdown/text that the model interprets as its own past output.

Actual Behavior

Synthetic markers are potentially being injected into the context window.

Logs/Screenshots

N/A

Additional Context

  • I have searched existing issues to ensure this is not a duplicate
  • I can reproduce this issue consistently
  • This issue occurs with the latest version of nanocoder and feat

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions