Skip to content

fix(web): refresh @ file mention index on session switch and staleness#1385

Merged
RealKai42 merged 7 commits intomainfrom
fix/web-file-mention-stale-index
Mar 11, 2026
Merged

fix(web): refresh @ file mention index on session switch and staleness#1385
RealKai42 merged 7 commits intomainfrom
fix/web-file-mention-stale-index

Conversation

@YoungY620
Copy link
Copy Markdown
Collaborator

@YoungY620 YoungY620 commented Mar 10, 2026

Related Issue

N/A

Description

Fix the @ file mention autocomplete index going stale after switching sessions or when workspace files change. Four changes:

  1. Reset index on session switch — clear the cached file index when the user switches to a different session, so the new session's workspace is indexed fresh.
  2. 30-second staleness expiry — if the index is older than 30 seconds when the mention popup opens, re-fetch the file list automatically.
  3. Path-prefix search — when the user types a path prefix (containing /), issue a targeted glob query to the backend, finding files beyond the initial 500-file limit.
  4. Cleanup on unmount — abort any in-flight fetch when the component unmounts to avoid stale state.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked the related issue, if any.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have run make gen-changelog to update the changelog.
  • I have run make gen-docs to update the user documentation.

Open with Devin

The file mention autocomplete index was stale after renaming workspace
directories or switching sessions, requiring a full page reload. Also,
files beyond the 500-file BFS limit were completely inaccessible.

- Reset workspace state when sessionId changes so switching sessions
  triggers a fresh crawl
- Add 30s TTL so re-opening @ after inactivity refreshes the index
- Add debounced directory query when @ query contains "/" to find files
  beyond the initial 500-file crawl limit
- Show truncation hint when file limit is reached

Entire-Checkpoint: b43526b075f6
devin-ai-integration[bot]

This comment was marked as resolved.

…query race

- Reset directoryFiles state when sessionId changes to prevent stale results
- Add sessionIdRef to detect session changes inside setTimeout callback
- Remove unused lint suppression comments

Entire-Checkpoint: 90e87d8e1a99
devin-ai-integration[bot]

This comment was marked as resolved.

Prevent stale listDirectory results from overwriting directoryFiles
when the user switches sessions while the request is in-flight.
…tion

Use a request counter (matching the workspaceRequestRef pattern) to
invalidate stale directory queries on session switch, query change,
and post-await resolution.
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

View 10 additional findings in Devin Review.

Open in Devin Review

Comment on lines +7 to +8
- Web: Fix `@` file mention index not refreshing after switching sessions or when workspace files change — reset index on session switch, auto-refresh after 30s staleness, and support path-prefix search beyond the 500-file limit

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 English changelog manually edited instead of auto-synced from root CHANGELOG.md

The docs/AGENTS.md rule states: "The English changelog (docs/en/release-notes/changelog.md) is auto-generated from the root CHANGELOG.md. Do not edit it manually." and "The sync script is docs/scripts/sync-changelog.mjs. ... To run manually: npm run sync (from the docs/ directory)." This PR directly edits docs/en/release-notes/changelog.md with new content at lines 7-8, violating this mandatory rule. The correct workflow is to edit CHANGELOG.md (which is done) and then run npm run sync to propagate changes, not manually mirror content into the English changelog.

Prompt for agents
Remove the manual edits to docs/en/release-notes/changelog.md. Instead, after editing the root CHANGELOG.md, run `npm run sync` from the docs/ directory to auto-generate the English changelog via the sync script at docs/scripts/sync-changelog.mjs. The file docs/en/release-notes/changelog.md should never be edited by hand per the docs/AGENTS.md rules.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Signed-off-by: Young E <49367723+YoungY620@users.noreply.github.com>
devin-ai-integration[bot]

This comment was marked as resolved.

@RealKai42 RealKai42 merged commit 026bf42 into main Mar 11, 2026
15 checks passed
@RealKai42 RealKai42 deleted the fix/web-file-mention-stale-index branch March 11, 2026 05:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants