Skip to content

Commit 2412e8f

Browse files
authored
Merge pull request #320 from Latitudes-Dev/shuvcode-dev
2 parents 534d1b8 + baf841f commit 2412e8f

File tree

3 files changed

+30
-24
lines changed

3 files changed

+30
-24
lines changed

.github/workflows/test.yml

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
host: windows-latest
2828
playwright: bunx playwright install
2929
workdir: packages/app
30-
command: bun test:e2e
30+
command: bun test:e2e:local
3131
runs-on: ${{ matrix.settings.host }}
3232
defaults:
3333
run:
@@ -46,26 +46,18 @@ jobs:
4646
run: ${{ matrix.settings.playwright }}
4747

4848
- name: Set OS-specific paths
49+
if: runner.os != 'Windows'
4950
run: |
50-
if [ "${{ runner.os }}" = "Windows" ]; then
51-
printf '%s\n' "OPENCODE_E2E_ROOT=${{ runner.temp }}\\opencode-e2e" >> "$GITHUB_ENV"
52-
printf '%s\n' "OPENCODE_TEST_HOME=${{ runner.temp }}\\opencode-e2e\\home" >> "$GITHUB_ENV"
53-
printf '%s\n' "XDG_DATA_HOME=${{ runner.temp }}\\opencode-e2e\\share" >> "$GITHUB_ENV"
54-
printf '%s\n' "XDG_CACHE_HOME=${{ runner.temp }}\\opencode-e2e\\cache" >> "$GITHUB_ENV"
55-
printf '%s\n' "XDG_CONFIG_HOME=${{ runner.temp }}\\opencode-e2e\\config" >> "$GITHUB_ENV"
56-
printf '%s\n' "XDG_STATE_HOME=${{ runner.temp }}\\opencode-e2e\\state" >> "$GITHUB_ENV"
57-
printf '%s\n' "MODELS_DEV_API_JSON=${{ github.workspace }}\\packages\\opencode\\test\\tool\\fixtures\\models-api.json" >> "$GITHUB_ENV"
58-
else
59-
printf '%s\n' "OPENCODE_E2E_ROOT=${{ runner.temp }}/opencode-e2e" >> "$GITHUB_ENV"
60-
printf '%s\n' "OPENCODE_TEST_HOME=${{ runner.temp }}/opencode-e2e/home" >> "$GITHUB_ENV"
61-
printf '%s\n' "XDG_DATA_HOME=${{ runner.temp }}/opencode-e2e/share" >> "$GITHUB_ENV"
62-
printf '%s\n' "XDG_CACHE_HOME=${{ runner.temp }}/opencode-e2e/cache" >> "$GITHUB_ENV"
63-
printf '%s\n' "XDG_CONFIG_HOME=${{ runner.temp }}/opencode-e2e/config" >> "$GITHUB_ENV"
64-
printf '%s\n' "XDG_STATE_HOME=${{ runner.temp }}/opencode-e2e/state" >> "$GITHUB_ENV"
65-
printf '%s\n' "MODELS_DEV_API_JSON=${{ github.workspace }}/packages/opencode/test/tool/fixtures/models-api.json" >> "$GITHUB_ENV"
66-
fi
51+
printf '%s\n' "OPENCODE_E2E_ROOT=${{ runner.temp }}/opencode-e2e" >> "$GITHUB_ENV"
52+
printf '%s\n' "OPENCODE_TEST_HOME=${{ runner.temp }}/opencode-e2e/home" >> "$GITHUB_ENV"
53+
printf '%s\n' "XDG_DATA_HOME=${{ runner.temp }}/opencode-e2e/share" >> "$GITHUB_ENV"
54+
printf '%s\n' "XDG_CACHE_HOME=${{ runner.temp }}/opencode-e2e/cache" >> "$GITHUB_ENV"
55+
printf '%s\n' "XDG_CONFIG_HOME=${{ runner.temp }}/opencode-e2e/config" >> "$GITHUB_ENV"
56+
printf '%s\n' "XDG_STATE_HOME=${{ runner.temp }}/opencode-e2e/state" >> "$GITHUB_ENV"
57+
printf '%s\n' "MODELS_DEV_API_JSON=${{ github.workspace }}/packages/opencode/test/tool/fixtures/models-api.json" >> "$GITHUB_ENV"
6758
6859
- name: Seed opencode data
60+
if: runner.os != 'Windows'
6961
working-directory: packages/opencode
7062
run: bun script/seed-e2e.ts
7163
env:
@@ -86,6 +78,7 @@ jobs:
8678
OPENCODE_E2E_MODEL: "opencode/gpt-5-nano"
8779

8880
- name: Run opencode server
81+
if: runner.os != 'Windows'
8982
working-directory: packages/opencode
9083
run: bun dev -- --print-logs --log-level WARN serve --port 4096 --hostname 0.0.0.0 &
9184
env:
@@ -103,6 +96,7 @@ jobs:
10396
OPENCODE_CLIENT: "app"
10497

10598
- name: Wait for opencode server
99+
if: runner.os != 'Windows'
106100
run: |
107101
for i in {1..60}; do
108102
curl -fsS "http://localhost:4096/global/health" > /dev/null && exit 0

packages/app/script/e2e-local.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,28 @@ async function freePort() {
2424
})
2525
}
2626

27-
async function waitForHealth(url: string) {
28-
const timeout = Date.now() + 60_000
27+
async function waitForHealth(url: string, server: Bun.Subprocess) {
28+
const timeoutMs = process.env.CI ? 180_000 : 60_000
29+
const timeout = Date.now() + timeoutMs
30+
2931
while (Date.now() < timeout) {
3032
const ok = await fetch(url)
3133
.then((r) => r.ok)
3234
.catch(() => false)
3335
if (ok) return
36+
37+
const exited = await Promise.race([
38+
server.exited.then(() => true).catch(() => true),
39+
new Promise<boolean>((resolve) => setTimeout(() => resolve(false), 0)),
40+
])
41+
42+
if (exited) {
43+
throw new Error(`Server exited before health check: ${url}`)
44+
}
45+
3446
await new Promise((r) => setTimeout(r, 250))
3547
}
36-
throw new Error(`Timed out waiting for server health: ${url}`)
48+
throw new Error(`Timed out waiting for server health after ${timeoutMs / 1000}s: ${url}`)
3749
}
3850

3951
const appDir = process.cwd()
@@ -115,7 +127,7 @@ const server = Bun.spawn(
115127
)
116128

117129
try {
118-
await waitForHealth(`http://localhost:${serverPort}/global/health`)
130+
await waitForHealth(`http://localhost:${serverPort}/global/health`, server)
119131

120132
const runner = Bun.spawn(["bun", "test:e2e", ...extraArgs], {
121133
cwd: appDir,

packages/opencode/src/cli/cmd/tui/routes/session/sidebar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { useDirectory } from "../../context/directory"
1212
import { useKV } from "../../context/kv"
1313
import { TodoItem } from "../../component/todo-item"
1414

15-
export function Sidebar(props: { sessionID: string; overlay?: boolean }) {
15+
export function Sidebar(props: { sessionID: string; overlay?: boolean; width?: number }) {
1616
const sync = useSync()
1717
const { theme } = useTheme()
1818
const session = createMemo(() => sync.session.get(props.sessionID)!)
@@ -72,7 +72,7 @@ export function Sidebar(props: { sessionID: string; overlay?: boolean }) {
7272
<Show when={session()}>
7373
<box
7474
backgroundColor={theme.backgroundPanel}
75-
width={42}
75+
width={props.width ?? 42}
7676
paddingTop={1}
7777
paddingBottom={1}
7878
paddingLeft={2}

0 commit comments

Comments
 (0)