Skip to content

activeFile context and fsRead tool returning stale/cached file content #6099

@londonbrown

Description

@londonbrown

Describe the bug
Amazon Q Developer's context and fsRead tool are returning stale/cached file content that doesn't match the actual file on disk or in the editor. When a file contains a TODO comment in a JSDoc block (lines 10-12), both the activeFile context provided to the agent and the fsRead tool returned content without those lines. This persisted across multiple requests, even when explicitly asked to re-read the file. The agent repeatedly denied the existence of code that was clearly present in the editor, only acknowledging it after a screenshot was provided.

To reproduce

  1. Open a TypeScript file with a JSDoc comment containing a TODO
  2. Ask Amazon Q to "action the TODO in this file"
  3. Observe that Q claims there is no TODO in the file
  4. Ask Q to "tell me what line 11 says" (where the TODO exists)
  5. Observe that Q reports incorrect content for that line
  6. Tell Q to use fsRead tool explicitly - it also returns content without the TODO
  7. Provide a screenshot showing the TODO clearly exists
  8. Only then does Q acknowledge the TODO exists

Expected behavior
Both <activeFile> context and fsRead tool should return the current file content as it exists on disk and in the editor, including all lines and comments.

Screenshots
Image

Your Environment

  • OS: macOS Sequoia 15.7.1
  • JetBrains product: IntelliJ IDEA 2025.2.4 (Ultimate Edition)
  • JetBrains product version: IU-252.27397.103 (2025.2)
  • AWS Toolkit version: 3.97.252
  • SAM CLI version: N/A
  • JVM/Python version: 21.0.8+9-b1038.73 aarch64 (JCEF 122.1.9); VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.

Additional context
This appears to be a caching issue where file content is not being refreshed properly, leading to the agent working with outdated information and providing incorrect responses to the user.

Q provided the following explanation of what happened:

"I wasn't lying - there was a genuine discrepancy between what I was seeing and what you were seeing. The context that was being provided to me in multiple messages showed the file without the TODO comment (lines 10-12 showed just export function useOnFollow() {), and when I read the file from disk using fsRead, it also didn't contain the TODO.

However, your screenshot clearly showed the TODO was there in your editor. This was a synchronization issue where the file content being sent to me was out of date compared to what was actually on disk and in your editor. I apologize for the frustration this caused - I was working with incomplete/stale information rather than intentionally providing false information."

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugWe can reproduce the issue and confirmed it is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions