Skip to content

[BUG]: No session-level tracking of which files AI has read before editing #30767

Closed

Description

Description

The session runner (packages/core/src/session/runner/llm.ts) and the V1 prompt assembly (packages/opencode/src/session/prompt.ts) have no mechanism to track which files the AI has read.

  • read.ts has a warm() function but it's only for LSP pre-warming (line 119-120: "LSP warm-up is optional; do not let a background defect fail an otherwise successful read.")
  • No "read set" is maintained in session state
  • No tool-level check exists to verify a file was read before editing it
  • The stale-content check in writeIfUnchanged only catches race conditions between read and edit; it does nothing if the AI never read at all

This means the entire read-before-edit "enforcement" relies solely on the system prompt asking nicely. There's no programmatic guard.

Related: Chain from #30376 and #30765. See also:

Plugins

N/A (source code analysis)

OpenCode version

main

Steps to reproduce

  1. Read source code at packages/core/src/session/runner/llm.ts and packages/opencode/src/session/prompt.ts
  2. Search for any tracking of which files the AI has read via the Read tool
  3. No such tracking exists
  4. The instruction.ts file does track loaded paths but only for AGENTS.md deduplication, not for edit/write enforcement

Screenshot and/or share link

N/A (we read the source code)

Operating System

N/A (code analysis, not environment-specific)

Terminal

N/A

Activity

  1. github-actions commented on Jun 4, 2026

    @github-actions
    Contributor

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

    If this is intentionally a narrower/follow-on report (e.g. scoped specifically to the session runner rather than the tool layer), please clarify how it differs from #30376 so maintainers can track it separately.

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

Metadata

Metadata

Assignees

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