Repository navigation
fix(app): keep session timeline stable across worktree exit #436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
bd51c51
fix(app): keep session timeline stable across worktree exit
Astro-Han af87f30
fix(app): address timeline stability review
Astro-Han 0d35251
test(app): cover timeline stability review cases
Astro-Han a26ab8e
fix(app): refresh session actions after directory changes
Astro-Han 9139287
test(app): tighten timeline cache diagnostics
Astro-Han 280aa03
fix(app): document followup queue migration boundary
Astro-Han 1dd3fa5
fix(app): keep timeline cache identity stable
Astro-Han 90bc76a
fix(app): bind review artifacts to source directory
Astro-Han 12b2e11
fix(app): scope local model cache by directory
Astro-Han 3bffa2e
fix(app): restore model selection on directory change
Astro-Han cb6d2f0
test(app): cover local model selection boundaries
Astro-Han 01b6f96
fix(app): gate session actions during cache hydration
Astro-Han 800d800
fix(app): gate session actions on hydrated state
Astro-Han f5608a5
fix(app): track session status hydration separately
Astro-Han a4003de
fix(app): harden session action readiness
Astro-Han b110195
fix(app): degrade session status readiness on failure
Astro-Han 33edf35
fix(app): preserve active status during degraded bootstrap
Astro-Han 5b0b9ec
fix(app): wait for local model cache hydration
Astro-Han 9d2245f
fix(app): resync session model after local cache ready
Astro-Han 471d3d9
fix(app): isolate review and status hydration races
Astro-Han b8949b5
fix(app): handle directory status and store pins
Astro-Han 7b106b7
fix: gate session actions on directory readiness
Astro-Han 13f8b52
fix: avoid permanent session action locks
Astro-Han 94e799d
fix: separate submit and session action readiness
Astro-Han c8dcadc
fix: gate submit readiness separately from stop actions
Astro-Han ee84e79
fix: keep disabled prompt keys blocked
Astro-Han 3531bfa
fix: handle local and sync readiness edge cases
Astro-Han File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
packages/app/src/pages/session/use-session-timeline-data.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| import { describe, expect, test } from "bun:test" | ||
| import type { Message } from "@opencode-ai/sdk/v2/client" | ||
| import { readTimelineMessages } from "./use-session-timeline-data" | ||
|
|
||
| const userMessage = (id: string): Message => | ||
| ({ | ||
| id, | ||
| role: "user", | ||
| sessionID: "ses_target", | ||
| time: { created: 1 }, | ||
| }) as Message | ||
|
|
||
| describe("readTimelineMessages", () => { | ||
| test("keeps last-good messages for the same session when the current store briefly loses its cache", () => { | ||
| const loaded = [userMessage("msg_1"), userMessage("msg_2")] | ||
| const ready = readTimelineMessages({ | ||
| sessionID: "ses_target", | ||
| raw: loaded, | ||
| lastGood: undefined, | ||
| }) | ||
|
|
||
| const missing = readTimelineMessages({ | ||
| sessionID: "ses_target", | ||
| raw: undefined, | ||
| lastGood: ready.lastGood, | ||
| }) | ||
|
|
||
| expect(missing.messages).toBe(loaded) | ||
| expect(missing.lastGood).toBe(ready.lastGood) | ||
| }) | ||
|
|
||
| test("does not reuse last-good messages after switching to another session", () => { | ||
| const loaded = [userMessage("msg_1")] | ||
| const ready = readTimelineMessages({ | ||
| sessionID: "ses_source", | ||
| raw: loaded, | ||
| lastGood: undefined, | ||
| }) | ||
|
|
||
| const missing = readTimelineMessages({ | ||
| sessionID: "ses_target", | ||
| raw: undefined, | ||
| lastGood: ready.lastGood, | ||
| }) | ||
|
|
||
| expect(missing.messages).toEqual([]) | ||
| expect(missing.lastGood).toBe(ready.lastGood) | ||
| }) | ||
|
|
||
| test("clears last-good messages when there is no active session", () => { | ||
| const loaded = [userMessage("msg_1")] | ||
| const ready = readTimelineMessages({ | ||
| sessionID: "ses_source", | ||
| raw: loaded, | ||
| lastGood: undefined, | ||
| }) | ||
|
|
||
| const missing = readTimelineMessages({ | ||
| sessionID: undefined, | ||
| raw: undefined, | ||
| lastGood: ready.lastGood, | ||
| }) | ||
|
|
||
| expect(missing.messages).toEqual([]) | ||
| expect(missing.lastGood).toBeUndefined() | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.