GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(core): publish filesystem.changed events for workspace file edits by twitset · Pull Request #55537 · anomalyco/opencode

Conversation

@twitset

@twitset twitset commented Oct 14, 2026 •
edited by opencode-agent Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Issue for this PR

Refs #52941

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The location watcher only subscribed to the exact VCS branch-metadata file (.git/HEAD or .hg/branch), so ordinary file creates, edits, and deletes inside a workspace never produced filesystem.changed events. Clients that rely on the event stream — the desktop file pane and the review tab — went stale whenever files changed on disk outside the app (terminal editors, scripts, agent tool writes).

The watcher now keeps two subscriptions per workspace instead of one:

  • a directory subscription on the workspace root that publishes filesystem.changed ({ file: <absolute path>, event: "add" | "change" | "unlink" }) for every normal file create/update/delete, with node_modules, .git, and .hg ignored;
  • the existing exact branch-metadata file subscription, so branch switches still publish (exactly one event per switch, no duplicates from store churn).

Subscriptions are keyed by their full watch input, so when the user-configured watcher-ignore policy changes, only subscriptions whose inputs actually differ are restarted — entries duplicating the defaults don't cause churn. The directory subscription is unconditional, so events also flow in workspaces without git/hg.

How did you verify your code works?

  • bun test packages/core/test/filesystem/watcher.test.ts — 17/17 pass (new/updated tests cover the directory + branch-metadata subscriptions, policy reconciliation without duplicate restarts, and the create/update/delete → add/change/unlink publish mapping). tsgo typecheck clean.
  • Manual against a server run from source, watching /api/event while modifying files externally: add/change/unlink events carry absolute paths; 50-file .git/ churn and node_modules/ churn produce zero events; exactly one .git/HEAD change per branch switch; a 200-file burst is delivered without loss; events keep flowing after a server restart and in a non-git workspace.
  • In the app UI (renderer pointed at the dev server, edits done externally, no manual refresh): file tree updates in ~40–200 ms; quick create+delete leaves no ghost entries; nested edits only refresh the affected subtree and preserve expansion state; the review diff refreshes itself (~100 ms debounce) and reacts to branch switches.

Screenshots / recordings

If this is a UI change, please include a screenshot or recording.

No UI change — server-side event coverage only.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Added by the opencode bot (AI-generated).

Fixes #48451

Related: #52941, #50463, #52776

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
grim
fix(core): publish filesystem.changed events for workspace file edits
c7fbc6b
The location watcher only subscribed to the exact VCS branch-metadata
file (.git/HEAD or .hg/branch), so ordinary file creates, edits, and
deletes inside a workspace never produced filesystem.changed events.
Clients relying on the event stream (desktop file pane, review tab)
went stale whenever files changed on disk outside the app.

The watcher now maintains a per-workspace directory subscription that
publishes every file create/update/delete, with node_modules and VCS
stores (.git/.hg) ignored, while keeping the dedicated branch-metadata
file subscription so branch switches still publish exactly one event.
A user-configured watcher-ignore policy is merged into the directory
ignore list without restarting unchanged subscriptions.
@github-actions

github-actions Bot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@twitset

twitset commented Oct 14, 2026

Copy link
Copy Markdown
Author

Superseded by #55538 (reopened from my other account).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@twitset twitset closed this Oct 14, 2026
@twitset
twitset deleted the fix/location-watcher-workspace-files branch October 14, 2026 21:18
opencode-agent[bot]
opencode-agent Bot reviewed Oct 14, 2026
View reviewed changes

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

The fix works. Running serve from source and listening on /api/event, external create/edit/delete of a file in a git workspace now produces filesystem.changed add/change/unlink events with absolute paths. On the base it produced nothing. node_modules writes stay silent, and a branch switch still gives exactly one .git/HEAD event. watcher.test.ts (17/17) and the packages/core typecheck pass.

Public API: no schema change. filesystem.changed keeps its payload but now fires for ordinary workspace edits, not only the branch file. Backwards compatible; existing app and review-pane listeners already handle these events.

Main concern (inline): the recursive watch is unconditional for every location instance, with only node_modules/.git/.hg ignored. See the inline comment.

Fixes #48451
Related: #52941, #50463, #52776

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/core/src/filesystem/location-watcher.ts
// refresh open views. VCS metadata is excluded: store churn is not an
// edit, and the exact branch-metadata subscription below covers switches.
const inputs = new Map<string, Watcher.WatchInput>()
const directory: Watcher.WatchInput = {

@opencode-agent opencode-agent Bot Oct 14, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This starts an always-on recursive watch of the location root for every instance: TUI, opencode run and server locations, not only clients that use filesystem.changed. It also covers folders like ~. Only node_modules/.git/.hg are skipped. The broader built-in list (dist, build, target, .venv, __pycache__, .next, coverage…) was deleted in #52658, so build output churn will now stream events to every client. Large trees can also run into the inotify watch limit (#52776) or Windows junction recursion (#50463) for users who never open the file pane. Could the folder watch be scoped more tightly? For example, skip it when the location is the home or filesystem root, restore a sensible default ignore set, and/or only subscribe while a client listens for these events.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@jlongster jlongster mentioned this pull request Oct 15, 2026
refactor(tui): use one side padding for all dialogs #55505
Merged
@opencode-agent opencode-agent Bot mentioned this pull request Oct 18, 2026
desktop: file tree does not refresh live; workspace watcher emits no events (Windows) #56615
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@opencode-agent opencode-agent[bot] opencode-agent[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Desktop file panel does not live-refresh on external file changes

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@twitset
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.