GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||
GeezerVison is showing github.com — fix(app): reread a workspace file changed during its read by Hona · Pull Request #61818 · anomalyco/opencode Conversation
|
| Before | After |
|---|---|
![]() |
![]() |
type FileEntryState = | { status: "loading"; attempt: number; silent: boolean; rerun: boolean } | { status: "ready"; content: FileContent; stale: boolean } | { status: "refreshing"; content: FileContent; attempt: number; silent: boolean; rerun: boolean } | { status: "missing"; error: string } | { status: "error"; error: string } type FileContentState = | { status: "active"; directory: string; issued: number; files: Record<string, FileEntryState> } | { status: "disposed" }
stateDiagram-v2
[*] --> loading: load
missing --> loading: load
error --> loading: load
loading --> loading: forced load (rerun = true)
refreshing --> refreshing: forced load (rerun = true)
loading --> ready: succeeded
refreshing --> ready: succeeded
loading --> refreshing: succeeded, rerun
refreshing --> refreshing: succeeded, rerun
loading --> missing: missing
refreshing --> missing: missing
loading --> error: failed
refreshing --> ready: failed (stale)
ready --> refreshing: forced load, or plain load when stale
ready --> [*]: evicted
refreshing --> loading: evicted
issued only grows, also across directories, so a reply to a read from an earlier directory never matches a current attempt. scope.changed and disposed emit abort.all and cache.reset.model.tsx runs effects (read, abort.all, settle, cache.*, toast) and owns the abort controllers and the promises load() returns. A server that sends no response arrives as load.failed; the machine has no clock. It writes only the entries that changed, so other files' readers stay quiet and content is never deep-merged.FileState (what Files.get returns to plugins) is now a union per status. It stays assignable to the plugin SDK's FileState, so mounted-session.ts, the file viewer, review, and composer callers keep working without changes.FileState.loaded / loading / notFound as stored flags (now projected by selectFileState).inflight map, the scope() !== directory guards, ensure / setLoading / setLoaded / setLoadError.lru and total, evictContentLru, resetFileContentLru, touchFileContent, hasFileContent, removeFileContentBytes.load.timed-out covered the whole download and cut off large files on slow connections. The transport's 60 s limit applies only to the wait for a response (request-queue.ts), and headStreamedFile gives the media HEAD the same limit.selectFileTracked selector; the watcher checks whether an entry exists.HEAD that gets no response shows "Request failed" (an existing string) and toasts unless the load was silent.Added by the opencode bot (AI-generated).
Related: #52941
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The fix works. I copied the new Playwright test onto the base, where it fails: the tab keeps showing "before change". With this PR it passes, and so do the other 29 tests in review.spec.ts. The unit tests in workspaces/files pass, and tsc -b is clean.
Public API: unchanged. FileState is app-internal. It is now a union keyed on status, and it still has the loaded, loading, notFound, content and error fields that plugin callers read.
The state machine follows the State Machines section of packages/app/AGENTS.md. It uses attempt ids to drop stale results, every read ends in a state, a driver owns the abort controllers and timers, and a disposed event handles cleanup. Each FileProvider owning its own cache also fixes the shared-LRU problem. One inline comment about the new read timeout.
Related: #52941
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
fb264e7 to
84e3ee8
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This push rebases onto newer dev. The changes to packages/app are the same as in the commit I reviewed before. On the new head, the unit tests in workspaces/files and the new e2e test pass. tsc -b reports one error, in session/composer/region.tsx (pinned), and dev has the same error, so it doesn't come from this change. Public API: unchanged. My earlier point about the 30 s read timeout is not addressed yet, so that thread stays open. Nothing new to add.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Model workspace file content as an explicit state machine (content-machine.ts). A forced reload during a read now queues one more read instead of joining the stale one, a failed refresh keeps its content without an error, a reload of a missing file no longer reports it missing, reads time out, and each file provider owns its content cache.
84e3ee8 to
8a76132
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This push rebases onto newer dev, and the changes to packages/app are unchanged. On the new head, the unit tests in workspaces/files, tsc -b and the new e2e test all pass. Public API: unchanged. My earlier point about the 30 s read timeout is not addressed yet, so that thread stays open. Nothing new to add.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…nload The 30 s whole-read timeout cut off large files over slow connections. The API's request queue already bounds every call's wait for headers (60 s) and lets the body stream; the media HEAD, which skips the queue, now gets the same bound.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
My earlier point is addressed. File reads no longer have their own 30 s limit on the whole download. They now rely on the request queue's 60 s limit, which only covers the wait for the server's response, and the media HEAD gets the same limit through headStreamedFile. On the new head, the workspaces/files unit tests pass, including the new headStreamedFile tests. tsc -b is clean, and all of review.spec.ts passes (30/30), including the test for a file changed during its read. Public API: unchanged. Nothing new to raise.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
fix(app): reread a workspace file changed during its read (anomalyco#61818)
…owser Selecting the new tab loads the file, and since anomalyco#61818 a forced load during a read asks for one more read. Forcing after the tab opened read every newly opened file twice. Force first, so the tab's load joins that read.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.