Skip to content

Commit 2c3d2ed

Browse files
anandgupta42claude
andcommitted
fix: [v1.17.9] TUI /api routing flood + branding 198->0 + require-markers config (CI green)
- WS1: TUI sdk.client.v2.{model,provider}.list hit /api/provider /api/model -> unmounted -> catch-all proxied to app.altimate.ai -> 'Unable to connect' FLOOD in TUI (+ httpapi-sdk test fail). Fixed server.ts route mounting; /api/provider now 200; httpapi-sdk + httpapi-provider 21 pass/0 fail. Same root as last suite fail. - CI branding: --branding 198->0 (rebrand shipped opencode->altimate incl tui/src/logo.ts; allowlist intentional compat refs). - CI require-markers: list 38->35, repointed 9 stale post-restructure paths (github->github.handler, extracted TUI, logo), removed 2 obsolete. - All Marker Guard CI sub-checks now exit 0 locally; typecheck 0; production WORKING (azure/gpt-5.5 --yolo). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent e92adcf commit 2c3d2ed

16 files changed

Lines changed: 286 additions & 21 deletions

File tree

.github/meta/night-run/BUDGET.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ STRATEGY: bulk e2e on FREE Ollama; sample quality runs on Azure gpt-4o-mini (che
1717
- 17:37 e2e seq conc=1 OPENCODE_DB-isolated 22 runs azure (~$0.15)
1818
- 18:01 e2e seq conc=1 DEFAULT-env 22 runs azure (~$0.15)
1919
- 19:39 e2e 3 batches x ~44 (132 runs) azure (~$1)
20+
- 00:01 BINARY e2e gpt-5.5 --yolo extensive: 22 tasks x4 = 88 runs (~21s each; gpt-5.5 pricier, est ~$10-15, cap $45)

.github/meta/night-run/STATUS.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,3 +343,11 @@ ACTIONS NOW: launch (1) branding fixer (5 prompts + provider identity headers +
343343
- Branch pushed at bdb3cef235. In-flight work (branding fixer, tasktool fixer, then COVER-46) will land as follow-up commits pushed to the branch -> auto-updates PR #964.
344344
- Template-compliance NOTE (memory): anandgupta42 NOT in TEAM_MEMBERS -> bot checks apply; PR body uses exact headings (What/Type/Issue/How-verified/Checklist) + Closes #963. Monitor it isn't auto-closed.
345345
- REMAINING (lands as PR commits): branding (5 prompts + provider headers + config/UI), TaskTool deriveSubagentSessionPermission wiring, COVER-46 (session injectable-Service refactor + compaction retained-tail), sdk regen (build-env). Each: commit + push to update PR.
346+
347+
## CHECKPOINT 34 — build verified + CI blockers identified — 2026-06-25
348+
- BUILD: co-worker hit ModuleNotFound ./src/cli/cmd/tui/worker.ts (build.ts:384 stale after TUI relocation cli/cmd/tui->cli/tui). FIXED build.ts:384 -> ./src/cli/tui/worker.ts. VERIFIED by actually building: bun build:local (gate temporarily relaxed, reverted) produced working binary dist/@altimateai/altimate-code-darwin-arm64/bin/altimate (237MB), `--version` runs. Committed 29993986f6 + pushed. (LESSON: build before claiming a build fix.)
349+
- CI (PR #964 Marker Guard) failing on 2 real blockers (the --markers non-strict step PASSES via bridge exemption):
350+
1. `analyze.ts --branding` exit 1: 198 leaks (214 in shipped opencode/src incl. packages/tui/src/logo.ts ASCII --help banner; +tests/core). Need comprehensive rebrand + allowlist intentional (User-Agent compat, ai.opencode app-id, opencode-github-action infra, public OpenCode class) via config.ts skipFiles/line-allowlist.
351+
2. `analyze.ts --require-markers --strict` exit 1: 11 of 38 requireMarkers files stale (10 TUI files moved cli/cmd/tui->packages/tui or cli/tui = "file not found"; github.ts "no blocks"). Update script/upstream/utils/config.ts requireMarkers list (repoint moved / remove obsolete / mark github.ts).
352+
- Build needs bun>=1.3.14 (env 1.3.13) — env, gate intact.
353+
- NEXT: comprehensive Marker-Guard CI fix (1 codex owns config.ts + rebrand). Then re-run CI on PR #964. Then COVER-46. Budget ~$6/$50.

.github/meta/night-run/TUI-UPSTREAM-DIFF.md

Lines changed: 122 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
# Usage: run_battery_binary.sh <model> <repeats> <conc> — runs the BUILT BINARY with --yolo
3+
MODEL="${1:-azure/gpt-5.5}"; REPEATS="${2:-1}"; CONC="${3:-1}"
4+
ROOT="$(git rev-parse --show-toplevel)"
5+
BIN="$ROOT/packages/opencode/dist/@altimateai/altimate-code-darwin-arm64/bin/altimate"
6+
TASKS="$ROOT/.github/meta/night-run/e2e/tasks.jsonl"
7+
OUT="/tmp/e2e_binary"; mkdir -p "$OUT"; RES="$OUT/res.d"; rm -rf "$RES"; mkdir -p "$RES"; : > "$OUT/results.tsv"
8+
run_one() {
9+
local id="$1" prompt="$2" check="$3" n="$4"; local wd; wd="$(mktemp -d /tmp/e2eb.XXXXXX)"
10+
( cd "$wd" && git init -q 2>/dev/null; timeout 200 "$BIN" run "$prompt" --model "$MODEL" --yolo </dev/null >/dev/null 2>&1
11+
if eval "$check" >/dev/null 2>&1; then v=PASS; else v=FAIL; fi
12+
printf '%s\t%s\t%s\n' "$id" "$n" "$v" > "$RES/${id}_${n}.tsv" ); rm -rf "$wd"
13+
}
14+
JOBS="$OUT/jobs.txt"; : > "$JOBS"
15+
while IFS= read -r line; do [ -z "$line" ] && continue
16+
id=$(printf '%s' "$line"|python3 -c "import json,sys;print(json.load(sys.stdin)['id'])")
17+
prompt=$(printf '%s' "$line"|python3 -c "import json,sys;print(json.load(sys.stdin)['prompt'])")
18+
check=$(printf '%s' "$line"|python3 -c "import json,sys;print(json.load(sys.stdin)['check'])")
19+
for r in $(seq 1 "$REPEATS"); do printf '%s\t%s\t%s\t%s\n' "$id" "$prompt" "$check" "$r" >> "$JOBS"; done
20+
done < "$TASKS"
21+
TOTAL=$(wc -l <"$JOBS"|tr -d ' '); echo "running $TOTAL binary e2e jobs (model=$MODEL --yolo conc=$CONC) $(date +%T)"
22+
while IFS=$'\t' read -r id prompt check n <&9; do
23+
run_one "$id" "$prompt" "$check" "$n" &
24+
while [ "$(jobs -rp|wc -l|tr -d ' ')" -ge "$CONC" ]; do sleep 0.3; done
25+
done 9< "$JOBS"; wait
26+
cat "$RES"/*.tsv > "$OUT/results.tsv" 2>/dev/null
27+
echo "=== RESULTS === PASS: $(grep -c $'\tPASS' "$OUT/results.tsv") FAIL: $(grep -c $'\tFAIL' "$OUT/results.tsv") / $TOTAL $(date +%T)"
28+
awk -F'\t' '{t[$1]++; if($3=="PASS")p[$1]++} END{for(k in t)printf " %-18s %d/%d\n",k,p[k],t[k]}' "$OUT/results.tsv"|sort

packages/core/src/file-mutation.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ export class Service extends Context.Service<Service, Interface>()("@opencode/v2
6767

6868
/**
6969
* Serialize file changes by canonical target. Conditional writes compare and
70-
* write under the same process-local lock so cooperating OpenCode mutations do
70+
* altimate_change start — product branding in public docs.
71+
* write under the same process-local lock so cooperating Altimate Code mutations do
72+
* altimate_change end
7173
* not overwrite changes made from the same stale content.
7274
*/
7375
export const layer = Layer.effect(

packages/core/src/plugin/command/initialize.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
Create or update `AGENTS.md` for this repository.
22

3-
The goal is a compact instruction file that helps future OpenCode sessions avoid mistakes and ramp up quickly. Every line should answer: "Would an agent likely miss this without help?" If not, leave it out.
3+
// altimate_change start — product branding in built-in command prompt
4+
The goal is a compact instruction file that helps future Altimate Code sessions avoid mistakes and ramp up quickly. Every line should answer: "Would an agent likely miss this without help?" If not, leave it out.
5+
// altimate_change end
46

57
User-provided focus or constraints (honor these):
68
$ARGUMENTS

packages/opencode/src/cli/cmd/attach.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ import { ServerAuth } from "@/server/auth"
66

77
export const AttachCommand = cmd({
88
command: "attach <url>",
9-
// altimate_change — rebrand --help text
9+
// altimate_change start — rebrand --help text
1010
describe: "attach to a running altimate-code server",
11+
// altimate_change end
1112
builder: (yargs) =>
1213
yargs
1314
.positional("url", {

packages/opencode/src/provider/models-snapshot.ts

Lines changed: 2 additions & 0 deletions
Large diffs are not rendered by default.

packages/opencode/src/server/server.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,20 @@ export namespace Server {
6464
const log = Log.create({ service: "server" })
6565

6666
export const Default = lazy(() => createApp({}))
67+
// altimate_change start — upstream_fix: preserve upstream v1.17.9 /api HttpApi routes.
68+
// The v2 SDK/TUI calls /api/provider and /api/model; without this bridge the legacy
69+
// Hono catch-all proxies those requests to app.altimate.ai and floods the TUI on failure.
70+
const httpApiBridge = lazy(async () => {
71+
const { HttpApiApp } = await import("./routes/instance/httpapi/server")
72+
return {
73+
handler: HttpApiApp.webHandler().handler as (
74+
request: Request,
75+
context: unknown,
76+
) => Response | Promise<Response>,
77+
context: HttpApiApp.context,
78+
}
79+
})
80+
// altimate_change end
6781

6882
// altimate_change start — legacy zod NamedError instances come from a different
6983
// package than the core Effect NamedError, so instanceof misses them.
@@ -159,6 +173,12 @@ export namespace Server {
159173
},
160174
}),
161175
)
176+
// altimate_change start — upstream_fix: route v2 SDK/TUI /api requests before legacy instance/UI routes.
177+
.all("/api/*", async (c) => {
178+
const bridge = await httpApiBridge()
179+
return bridge.handler(c.req.raw, bridge.context)
180+
})
181+
// altimate_change end
162182
.route("/global", GlobalRoutes())
163183
.put(
164184
"/auth/:providerID",

packages/opencode/test/server/httpapi-provider.test.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,36 @@ function setEnvScoped(key: string, value: string) {
258258
}
259259

260260
describe("provider HttpApi", () => {
261+
it.instance(
262+
"serves v2 provider and model routes from Server.Default",
263+
Effect.gen(function* () {
264+
const directory = (yield* TestInstance).directory
265+
const headers = { "x-opencode-directory": directory }
266+
const providerResponse = yield* requestDefault("/api/provider", { headers })
267+
const modelResponse = yield* requestDefault("/api/model", { headers })
268+
269+
if (providerResponse.status !== 200) {
270+
return yield* Effect.fail(
271+
new Error(
272+
`provider response ${providerResponse.status}: ${yield* Effect.promise(() => providerResponse.text())}`,
273+
),
274+
)
275+
}
276+
if (modelResponse.status !== 200) {
277+
return yield* Effect.fail(
278+
new Error(`model response ${modelResponse.status}: ${yield* Effect.promise(() => modelResponse.text())}`),
279+
)
280+
}
281+
282+
const providerBody = yield* responseJson(providerResponse)
283+
const modelBody = yield* responseJson(modelResponse)
284+
expect(isRecord(providerBody) && Array.isArray(providerBody.data)).toBe(true)
285+
expect(isRecord(modelBody) && Array.isArray(modelBody.data)).toBe(true)
286+
}),
287+
projectOptions,
288+
30000,
289+
)
290+
261291
it.instance.skip(
262292
"returns public v2 provider not found errors",
263293
Effect.gen(function* () {

0 commit comments

Comments
 (0)