Repository navigation
fix(tasks): keep unanswered prompts and failed turns visible #313
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 all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
a6bd1a4
fix(tasks): keep unanswered prompts and failed turns visible
claude ea206c5
fix(terminal): stop one pane's repaint from garbling the others on macOS
claude 5fbbb2b
test(chat): count a killed zombie job as ended
claude 1e88918
perf(terminal): share one repaint between panes returning together
claude 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
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,90 @@ | ||
| import { createSignal } from 'solid-js'; | ||
| import { render } from 'solid-js/web'; | ||
| import { afterEach, beforeEach, expect, it, vi } from 'vitest'; | ||
| import { IPC } from '../../electron/ipc/channels'; | ||
| import { WEBGL_DETACH_DELAY_MS } from '../lib/terminalPaneVisibility'; | ||
| import { TerminalView } from './TerminalView'; | ||
|
|
||
| const { redrawAllTerminals } = vi.hoisted(() => ({ redrawAllTerminals: vi.fn() })); | ||
|
|
||
| vi.mock('../lib/platform', async (importOriginal) => ({ | ||
| ...(await importOriginal<typeof import('../lib/platform')>()), | ||
| isMac: true, | ||
| })); | ||
|
|
||
| // happy-dom has no WebGL; a stand-in addon is enough to put the pane on the | ||
| // WebGL path that keeps its context across a brief trip off screen. | ||
| vi.mock('@xterm/addon-webgl', () => ({ | ||
| WebglAddon: class { | ||
| activate(): void {} | ||
| dispose(): void {} | ||
| onContextLoss() { | ||
| return { dispose() {} }; | ||
| } | ||
| }, | ||
| })); | ||
|
|
||
| vi.mock('../lib/terminalFitManager', async (importOriginal) => ({ | ||
| ...(await importOriginal<typeof import('../lib/terminalFitManager')>()), | ||
| redrawAllTerminals, | ||
| })); | ||
|
|
||
| let dispose: (() => void) | undefined; | ||
|
|
||
| beforeEach(() => { | ||
| vi.useFakeTimers(); | ||
| // happy-dom has no canvas; xterm's DOM renderer only measures glyph widths. | ||
| vi.spyOn(HTMLCanvasElement.prototype, 'getContext').mockReturnValue({ | ||
| font: '', | ||
| fillRect: vi.fn(), | ||
| clearRect: vi.fn(), | ||
| measureText: () => ({ width: 8 }), | ||
| } as unknown as CanvasRenderingContext2D); | ||
| vi.stubGlobal('OffscreenCanvas', undefined); | ||
| vi.stubGlobal('electron', { | ||
| ipcRenderer: { | ||
| invoke: vi.fn((cmd: string) => | ||
| cmd === IPC.SpawnAgent ? new Promise(() => {}) : Promise.resolve(undefined), | ||
| ), | ||
| on: () => () => undefined, | ||
| }, | ||
| }); | ||
| redrawAllTerminals.mockClear(); | ||
| }); | ||
|
|
||
| afterEach(() => { | ||
| dispose?.(); | ||
| dispose = undefined; | ||
| document.body.replaceChildren(); | ||
| vi.useRealTimers(); | ||
| vi.unstubAllGlobals(); | ||
| vi.restoreAllMocks(); | ||
| }); | ||
|
|
||
| it('repaints every terminal, not just its own, when a pane returns on macOS (issue #121)', () => { | ||
| const [visible, setVisible] = createSignal(true); | ||
| const host = document.createElement('div'); | ||
| document.body.append(host); | ||
| dispose = render( | ||
| () => ( | ||
| <TerminalView | ||
| taskId="task-1" | ||
| agentId="agent-1" | ||
| command="codex" | ||
| args={[]} | ||
| cwd="/tmp" | ||
| isShell | ||
| visible={visible()} | ||
| /> | ||
| ), | ||
| host, | ||
| ); | ||
|
|
||
| setVisible(false); | ||
| vi.advanceTimersByTime(WEBGL_DETACH_DELAY_MS / 2); | ||
| expect(redrawAllTerminals).not.toHaveBeenCalled(); | ||
| setVisible(true); | ||
|
|
||
| // The glyph atlas is shared, so a repaint must reset every terminal's model. | ||
| expect(redrawAllTerminals).toHaveBeenCalledTimes(1); | ||
| }); |
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
Oops, something went wrong.
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.