Skip to content

Commit 16c6c64

Browse files
committed
chore: temporary diagnostics for the flaky e2e viewStates read
The "sidebar and tab panel keep mode isolated" e2e test timed out on its 15s viewStates poll at 30c4f0c while 85 other tests passed and the previous head (f91e19c) was green. Log the serialized viewStates write queue outcomes (write/clear/rekey) and snapshot the raw globalState read at the start and timeout of the poll so the next CI run pinpoints where the ask/debug entries go missing. Revert this commit once the cause is found.
1 parent 30c4f0c commit 16c6c64

2 files changed

Lines changed: 34 additions & 2 deletions

File tree

‎apps/vscode-e2e/src/suite/view-state.test.ts‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,18 @@ suite("Roo Code View State", function () {
9393
// before the tasks complete, but a just-resolved globalState write can momentarily
9494
// lag a synchronous globalState.get in the extension host. Poll until both
9595
// persisted selections are visible before asserting on them.
96+
// TEMP-DIAG: e2e viewStates visibility debugging; remove before merge.
97+
const diagSnapshot = () => {
98+
try {
99+
return (
100+
JSON.stringify(globalThis.api.getGlobalState("viewStates"))?.slice(0, 800) ??
101+
String(globalThis.api.getGlobalState("viewStates"))
102+
)
103+
} catch (error) {
104+
return `snapshot error: ${String(error)}`
105+
}
106+
}
107+
console.log(`[DIAG-VS-READ-START] viewStates=${diagSnapshot()}`)
96108
await waitFor(
97109
() => {
98110
const persisted = globalThis.api.getGlobalState("viewStates") as GlobalState["viewStates"]
@@ -109,7 +121,10 @@ suite("Roo Code View State", function () {
109121
)
110122
},
111123
{ timeout: 15_000 },
112-
)
124+
).catch((error) => {
125+
console.log(`[DIAG-VS-READ-TIMEOUT] viewStates=${diagSnapshot()}`)
126+
throw error
127+
})
113128

114129
const viewStates = globalThis.api.getGlobalState("viewStates") as GlobalState["viewStates"]
115130
assert.ok(viewStates, "Expected persisted viewStates to exist")

‎src/core/webview/ClineProvider.ts‎

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,14 @@ export class ClineProvider
598598
states[viewStateId] = next
599599
}
600600

601-
await this.contextProxy.setValue("viewStates", this.prunePersistedViewStates(states))
601+
const pruned = this.prunePersistedViewStates(states)
602+
// TEMP-DIAG: e2e viewStates visibility debugging; remove before merge.
603+
this.log(
604+
`[DIAG-VS-WRITE] viewStateId=${viewStateId} values=${JSON.stringify(values)} map=${
605+
JSON.stringify(pruned)?.slice(0, 500) ?? String(pruned)
606+
}`,
607+
)
608+
await this.contextProxy.setValue("viewStates", pruned)
602609
})
603610

604611
ClineProvider.persistedViewStateWriteQueue = write.catch(() => {})
@@ -613,6 +620,10 @@ export class ClineProvider
613620
const write = ClineProvider.persistedViewStateWriteQueue.then(async () => {
614621
const states = this.getPersistedViewStates({ fresh: true })
615622
delete states[viewStateId]
623+
// TEMP-DIAG: e2e viewStates visibility debugging; remove before merge.
624+
this.log(
625+
`[DIAG-VS-CLEAR] viewStateId=${viewStateId} map=${JSON.stringify(states)?.slice(0, 500) ?? String(states)}`,
626+
)
616627
await this.contextProxy.setValue("viewStates", states)
617628
})
618629

@@ -696,6 +707,12 @@ export class ClineProvider
696707
states[nextViewStateId] = previous
697708
}
698709

710+
// TEMP-DIAG: e2e viewStates visibility debugging; remove before merge.
711+
this.log(
712+
`[DIAG-VS-REKEY] from=${previousViewStateId} to=${nextViewStateId} map=${
713+
JSON.stringify(this.prunePersistedViewStates(states))?.slice(0, 500) ?? ""
714+
}`,
715+
)
699716
await this.contextProxy.setValue("viewStates", this.prunePersistedViewStates(states))
700717
})
701718

0 commit comments

Comments
 (0)