mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 12:24:30 +01:00
fix(schedules): open repo session for finished worktree runs using run branch
Teardown clears worktree_path when a run finishes, so the previous check never matched and Open session navigated to the original session whose worktree directory had been removed. run_branch persists and reliably identifies worktree runs.
This commit is contained in:
1 parent
52b6147ed3
commit
33799e0433
2 files changed
+5
-5
No files matched your search
@@ -204,7 +204,7 @@ describe('RunDetailPanel open session', () => {
|
||||
})
|
||||
|
||||
it('opens the original session while a worktree run is still running', async () => {
|
||||
renderPanel({ ...run, status: 'running', sessionId: 'ses_run', worktreePath: '/abs/worktrees/run-1' })
|
||||
renderPanel({ ...run, status: 'running', sessionId: 'ses_run', worktreePath: '/abs/worktrees/run-1', runBranch: 'schedule/1/run-1' })
|
||||
|
||||
await clickOpenSession()
|
||||
|
||||
@@ -219,7 +219,7 @@ describe('RunDetailPanel open session', () => {
|
||||
sessionId: 'ses_run',
|
||||
sessionTitle: 'Daily recap',
|
||||
finishedAt: Date.UTC(2026, 9, 2),
|
||||
worktreePath: '/abs/worktrees/run-1',
|
||||
worktreePath: null,
|
||||
runBranch: 'schedule/run-1',
|
||||
commitHash: 'abc123',
|
||||
})
|
||||
@@ -236,7 +236,7 @@ describe('RunDetailPanel open session', () => {
|
||||
|
||||
it('includes the error and notes no committed changes for a failed worktree run', async () => {
|
||||
apiMocks.createSessionWithContext.mockResolvedValue({ id: 'ses_new' })
|
||||
renderPanel({ ...run, status: 'failed', responseText: null, errorText: 'Model timed out', worktreePath: '/abs/worktrees/run-1' })
|
||||
renderPanel({ ...run, status: 'failed', responseText: null, errorText: 'Model timed out', worktreePath: null, runBranch: 'schedule/1/run-1' })
|
||||
|
||||
await clickOpenSession()
|
||||
|
||||
@@ -250,7 +250,7 @@ describe('RunDetailPanel open session', () => {
|
||||
})
|
||||
|
||||
it('shows a single open session button', async () => {
|
||||
renderPanel({ ...run, sessionId: 'ses_run', worktreePath: '/abs/worktrees/run-1' })
|
||||
renderPanel({ ...run, sessionId: 'ses_run', worktreePath: null, runBranch: 'schedule/1/run-1' })
|
||||
|
||||
await waitFor(() => expect(screen.getByRole('button', { name: 'Open session' })).toBeEnabled())
|
||||
expect(screen.getAllByRole('button', { name: /session|repo/i })).toHaveLength(1)
|
||||
|
||||
@@ -70,7 +70,7 @@ export function RunDetailPanel({ repoId, activeRun, selectedRunLoading, onCancel
|
||||
|
||||
const { sessionId } = activeRun
|
||||
|
||||
const opensNewRepoSession = Boolean(activeRun.worktreePath) && activeRun.status !== 'running'
|
||||
const opensNewRepoSession = Boolean(activeRun.runBranch) && activeRun.status !== 'running'
|
||||
|
||||
const handleOpenSession = async () => {
|
||||
if (!opensNewRepoSession) {
|
||||
|
||||
Reference in new issue
Block a user