Skip to content

Concurrency bug: Polaris edit session blocked by self-induced file change #4079

Closed as duplicate

Description

@riatzukiza

Summary

When Polaris alpha runs concurrent edits and uses the Read/Edit tools against the newly introduced prompt file (packages/opencode/src/session/prompt/polaris.txt), OpenCode incorrectly treats its own prior edits in the same session as an external modification. This triggers the "file has been modified since it was last read" protection and causes legitimate concurrent edits from the same agent/session to be blocked.

Details

  • Environment: opencode repo, OpenCode v1.0.45, latest dev (after addition of packages/opencode/src/session/prompt/polaris.txt)
  • Actor: Polaris alpha (OpenCode agent) performing concurrent edits via the Edit tool
  • Observed behavior:
    • Polaris reads a file.
    • Polaris (or its sub-operations) edits the same file as part of the session.
    • Subsequent parallel edits in the same logical session are rejected with messages like:
      • "File ... has been modified since it was last read. Please read the file again before modifying it."
    • This appears even though the only intervening modifications were made by Polaris itself as part of the same workflow.
  • This effectively creates a race condition / false-positive concurrency conflict for self-induced changes when multiple edits are in flight.

Expected behavior

  • The modification detection should distinguish between:
    • Conflicts caused by external writers / other sessions (should be blocked), and
    • Changes made by the same Polaris/OpenCode session or atomic multi-edit operation (should be allowed or auto-rebased).
  • Concurrent edits initiated by the same logical session/agent to the same file should not be blocked solely because an earlier step in that session updated the file.

Impact

  • Breaks multi-step and concurrent edit workflows driven by Polaris/OpenCode.
  • Forces unnecessary re-reads and manual intervention, and in some cases makes automated refactors/large changes impossible.

Possible direction

  • Track per-session version IDs or edit tokens so that edits can be validated against a session-aware version, not only the raw mtime/hash.
  • Allow batched/atomic multi-edit operations where multiple edits share the same read snapshot.
  • Ensure that edits to internal prompt/config files (e.g. packages/opencode/src/session/prompt/polaris.txt) do not spuriously poison subsequent edits from the same session.
Image

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Nov 8, 2025
  2. github-actions commented on Nov 8, 2025

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Feel free to ignore if none of these address your specific case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    opentuiThis relates to changes in v1.0, now that opencode uses opentui

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions