Skip to content

fix(mcp): make non-trace explores side-effect free #7

Description

@pratik-saptarshi

Problem

run_fastcontext always appends --traj, so the nominally non-trace fastcontext_explore path still creates a trajectory file in temp storage. In src/fastcontext_mcp/runtime.py:206-217, the non-trace branch uses tempfile.gettempdir() rather than omitting trajectory capture entirely.

Evidence

  • src/fastcontext_mcp/runtime.py:206-217 always extends the subprocess command with --traj.
  • README.md:172-177 says trajectories are written only when requested, which does not match the current default path.
  • tests/test_server.py:181-197 currently asserts that the non-trace path still receives a temp trajectory path.

Impact

This is an operational and privacy consistency issue. It adds hidden side effects to the non-trace API, creates unnecessary temp files, and contradicts the documented behavior that trajectories are only written when requested.

Recommended remediation

  • Make trajectory emission opt-in only.
  • fastcontext_explore should omit --traj entirely.
  • Keep trajectory capture behind the explicit trace path or an explicit trace flag.
  • If always-on traceability is intentional, update the docs to state that clearly and explicitly.

Regression tests to add or adjust

  • Update the non-trace test to assert that --traj is not passed and no file is created.
  • Add a trace-specific test that fastcontext_explore_with_trace still writes a trajectory file when explicitly requested.
  • Update the README to match the final behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions