Skip to content

Commit 2c5dd93

Browse files
committed
fix(workspace): drop dead hydrateFailed field + duplicate RefreshResult doc
Two cleanups on packages/opencode/src/altimate/workspace/memory-sync.ts: 1. Remove the `hydrateFailed` field on `SessionMemory` and its three write sites. The `refresh` restructure replaced the read with a direct `outcome.status === "error"` check, so the field is written but never read. (kilo-code-bot #1123 comment 3840696504.) 2. Remove the doc comment above `export type RefreshResult` — it duplicated the doc on `refresh` (line 867) and had drifted stale (still claimed "Returns how many blocks the session now holds", but `refresh` returns a `RefreshResult`). The doc was also attached to the wrong element (the type, not the function). (kilo-code-bot #1123 comment 3840696513.)
1 parent 8e9e506 commit 2c5dd93

1 file changed

Lines changed: 1 addition & 16 deletions

File tree

packages/opencode/src/altimate/workspace/memory-sync.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ interface SessionMemory {
7373
touchedAt: number
7474
/** Set once a bounded wait expired, so later injections do not re-wait. */
7575
waitTimedOut?: boolean
76-
/** Set when the last fetch for this session failed, so a caller can tell an
77-
* empty workspace apart from an unreadable one. */
78-
hydrateFailed?: boolean
7976
}
8077

8178
const sessions = new Map<string, SessionMemory>()
@@ -848,11 +845,7 @@ async function loadWorkspaceMemory(): Promise<LoadOutcome> {
848845
* an older in-flight load must not write into the newer one. */
849846
function commitLoad(sessionID: string, state: SessionMemory, outcome: LoadOutcome): void {
850847
if (sessions.get(sessionID) !== state) return
851-
if (outcome.status === "error") {
852-
state.hydrateFailed = true
853-
return
854-
}
855-
state.hydrateFailed = false
848+
if (outcome.status === "error") return
856849
state.overlay = outcome.status === "loaded" ? outcome.blocks : []
857850
if (outcome.status === "loaded" && outcome.blocks.length > 0) {
858851
log.info("workspace memory hydrated", { blocks: outcome.blocks.length })
@@ -865,13 +858,6 @@ export function overlayBlocks(sessionID: string): RemoteMemoryBlock[] {
865858
return [...(sessions.get(sessionID)?.overlay ?? [])]
866859
}
867860

868-
/** Re-read this session's workspace memory, discarding what it already holds.
869-
*
870-
* ``hydrate`` is idempotent for the life of a session, which is what keeps the
871-
* per-turn call cheap -- but it also means a session started before a teammate
872-
* (or this user on another machine) wrote a block never sees it. This is the
873-
* on-demand path: drop the session's state so the next hydrate genuinely
874-
* refetches. Returns how many blocks the session now holds. */
875861
export type RefreshResult = {
876862
count: number
877863
ok: boolean
@@ -898,7 +884,6 @@ export async function refresh(sessionID: string): Promise<RefreshResult> {
898884
// strictly worse than not reloading, and the user asked for a reload.
899885
const state = sessionState(sessionID)
900886
state.overlay = previous
901-
state.hydrateFailed = true
902887
return { count: previous.length, ok: false, status: "error" }
903888
}
904889
// Replace the session's state so any older in-flight hydration is orphaned

0 commit comments

Comments
 (0)