Skip to content

Commit 627eaaa

Browse files
sepo-engFelicityclaude
authored
fix(session): wire SessionGoal/SessionLedger into the httpapi app node list (#9)
session.goal.* and session.ledger.* routes were 500ing with "Service not found" from cold boot on merged dev: the app's LayerNode.group in packages/opencode/src/server/routes/instance/httpapi/server.ts (the V1 HttpApiApp -- what test:httpapi and the live server actually build against, not packages/server/routes.ts) never listed SessionGoal.node / SessionLedger.node after they landed in #7 (TKT-317). Found while working TKT-315, extracted standalone per Ethan's sequencing call: this is a live defect on merged dev, not scoped to TKT-315's own PR, and TKT-315's own gate should not hold Gemma's slice-5 gate hostage (test:httpapi effect mode is what catches this class of bug). Validation: bun typecheck 30/30. test:httpapi mode=coverage 221/0, mode=auth 221/0 (both were crashing on every goal/ledger scenario before this fix). mode=effect 220/1 -- the crash is gone; the one remaining failure (v2.session.goal.get, "a session with no goal set should report no data") is TKT-317's own pre-existing assertion bug, now reachable for the first time instead of masked by the crash. Filed as feedback anomalyco#145, documented as a named exception in FORK.md's known-red table, matching the TKT-305 convention. Co-authored-by: Felicity <[email protected]> Co-authored-by: Claude <[email protected]>
1 parent 064bbdd commit 627eaaa

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

‎FORK.md‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ your own regression** — check whether it matches one of these first.
227227
| `unit (windows)` — **mode A, the common one** | A *varying subset of unrelated tests*, each failing at a uniform ~5000–5500ms | Not one test and not one cause. Three runs, failure sets by name: `dev@bd772dd3` (zero fork changes, the control) → `Ripgrep` ×4; `2e8d972` → `i18n parity` ×4, `Git worktrees`, `Git trees`, `LocationServiceMap`, `MoveSession` ×3; and Ripgrep *passed* in that third run. Suites that cannot share a cause (i18n string parity and git worktree creation do not interact) failing at an identical ~5s ceiling is the signature of a contended or underpowered runner hitting a per-test timeout — suspected to be `windows-latest` being smaller than the Blacksmith 4vcpu size upstream tunes these timeouts for. **The control run is the load-bearing evidence: `dev` fails this way with no fork code at all.** | feedback (internal tracker) — characterisation is future work, not scoped to any milestone-1 slice | Resolves when the flake is characterised: either the runner is sized up, or the per-test timeout is raised for Windows, or the affected suites are made timeout-independent. |
228228
| `unit (windows)` — **mode B, intermittent** | `bun install --linker hoisted` fails applying the `@ai-sdk/[email protected]` patch | `error: renaming changes to cache dir: ENOTEMPTY: ... Directory not empty (NtSetInformationFile())` — matches the exact race described in [`oven-sh/bun#28147`](https://github.com/oven-sh/bun/issues/28147), which the workflow's own `bun install --linker hoisted` comment already references. Identical failure on 2/2 independent reruns at the time it was recorded. `ubuntu-latest` is unaffected. Listed alongside mode A rather than replaced by it: this mode is real and was observed, it simply is not the only way Windows goes red, and in later runs install succeeded and the job reached the tests instead. | feedback #136 (internal tracker) | Resolves when bun's patch-apply race is fixed upstream, or worked around (e.g. serialize patch application on Windows, or pin an unaffected bun patch-apply path). |
229229
| `unit (linux)` | `packages/opencode/test/cli/run/run-process.test.ts:79` — "exits nonzero promptly when the model is unknown (regression for #27371)" | `expect(result.durationMs).toBeLessThan(15_000)` received `15285ms` then `15275ms` on two independent reruns — consistently ~275–285ms *over* the `timeoutMs: 15_000` configured two lines above the assertion. The pattern (always just past the exact configured timeout, not randomly distributed) suggests the "unknown model" fast-fail path is not triggering on GitHub Actions' network, and the process is instead being killed by its own `timeoutMs` — which structurally cannot finish before the timeout it races against. Not exercised by TKT-304's local baseline (that baseline ran `packages/core test` + `packages/opencode test:httpapi` + `packages/app test` specifically, not `packages/opencode`'s own broader suite that `bun turbo test` pulls in). | feedback #136 (internal tracker) | Resolves when #136 is triaged — either the fast-fail detection is fixed, or the test's timing assumption is loosened for CI network conditions. |
230+
| `packages/opencode test:httpapi` — **`mode=effect` only** | `GET /api/session/{sessionID}/goal` — `v2.session.goal.get` — "a session with no goal set should report no data" | Was masked by a crash: `session.goal`/`session.ledger` routes 500'd with "Service not found" on every mode, because the app's `LayerNode.group` in `packages/opencode/src/server/routes/instance/httpapi/server.ts` never listed `SessionGoal.node`/`SessionLedger.node` (a gap in [#7](https://github.com/Draugur-AI/opencode/pull/7), fixed standalone once found while working TKT-315). Fixing that crash let this route reach its own assertion, which fails only in `mode=effect` — `mode=coverage` and `mode=auth` both pass. Confirmed deterministic across reruns. | feedback #145 (internal tracker) | Resolves when #145 is triaged against TKT-317's own code — not a node-wiring issue, the route runs now, its behavior is wrong. |
230231

231232
## The milestone-1 required gate
232233

@@ -237,9 +238,10 @@ The **documented milestone-1 merge gate** is:
237238
- `packages/app` suite **green** (`bun run --cwd packages/app test` — unit and browser)
238239
- the **full** `packages/opencode` suite **green** (`bun test --cwd packages/opencode`), with
239240
exactly the two known-reds in the table above as named exceptions and nothing else
240-
- `packages/opencode test:httpapi` **green**, kept named because CI runs it as a distinct step
241-
and because it fails the build on any route with no scenario — a property the broader suite
242-
does not have
241+
- `packages/opencode test:httpapi` **green** in `mode=coverage` and `mode=auth`; in `mode=effect`,
242+
green except for the one named exception in the table above (`v2.session.goal.get`, feedback
243+
#145). Kept named because CI runs it as a distinct step and because it fails the build on any
244+
route with no scenario — a property the broader suite does not have
243245

244246
On the CI `unit` jobs specifically:
245247

‎packages/opencode/src/server/routes/instance/httpapi/server.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ import { ModelsDev } from "@opencode-ai/core/models-dev"
5959
import { Npm } from "@opencode-ai/core/npm"
6060
import { PermissionSaved } from "@opencode-ai/core/permission/saved"
6161
import { ProjectV2 } from "@opencode-ai/core/project"
62+
import { SessionGoal } from "@opencode-ai/core/session/goal"
63+
import { SessionLedger } from "@opencode-ai/core/session/ledger"
6264
import { ProjectCopy } from "@opencode-ai/core/project/copy"
6365
import { PtyTicket } from "@opencode-ai/core/pty/ticket"
6466
import { Ripgrep } from "@opencode-ai/core/ripgrep"
@@ -266,6 +268,13 @@ const app = LayerNode.group([
266268
ProjectV2.node,
267269
ProjectCopy.node,
268270
PtyTicket.node,
271+
// Pre-existing gap from #7 (TKT-317, goal/ledger): session.goal.* and session.ledger.*
272+
// routes 500'd with "Service not found" through this path, because this list -- not
273+
// packages/server/routes.ts -- is what the httpapi exerciser and this V1 HttpApiApp
274+
// actually build against. Found while working TKT-315; see FORK.md's node-assembly-sites
275+
// list for every other place a new global .node needs the same explicit entry.
276+
SessionGoal.node,
277+
SessionLedger.node,
269278
])
270279

271280
export function createRoutes(

0 commit comments

Comments
 (0)