Skip to content

Commit b093196

Browse files
sahrizviclaude
andauthored
chore(release): v0.12.7 (#1458)
* fix(server): the trace viewer page may not call the server's API Found in the v0.12.7 release review. `GET /altimate/trace/:sessionID/view` (#1415) serves the viewer from the API's own origin, and a trace holds tool output and fetched pages. Script injected through that content could have called every other route as same-origin. - The response carries a CSP that allows the page's inline script and styles but no requests (`connect-src 'none'`), form posts or base URL. The embedded viewer is never live, so it makes no requests of its own. Checked in Chromium on a real trace: every tab renders, Copy Summary works, no CSP violations. - The summary tab's rendering error is escaped like the rest of the page. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011z8XLFXDGuywPteBesoZSU * docs: Snowflake reconnect log lines and the `serve` routes for the IDE Found in the v0.12.7 release review: #1427's `warehouse-connect` log lines and #1415/#1435's `serve` routes were not documented. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011z8XLFXDGuywPteBesoZSU * fix(traces): a trace containing `<!--<script` no longer renders the viewer empty Found by this release's adversarial tests, confirmed in Chromium. The viewer embeds the trace as JSON in an inline script and escaped only `</`. Tool output with `<!--<script` and no `-->` after it (a fetched page, say) puts the HTML parser in a state where the script's own `</script>` no longer closes it, so no script ran and the page showed only its frame. Every `<` is now written as `<`, which the parser never reads as markup and JavaScript reads back as the same character. Predates this release (the TUI's `/traces` has the same viewer); the IDE's trace view (#1415) reaches it too. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011z8XLFXDGuywPteBesoZSU * release: v0.12.7 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011z8XLFXDGuywPteBesoZSU * test: expect the viewer's `\u003c` escaping in the v0.8.4 break-out test The viewer now writes every `<` in its embedded trace JSON as `\u003c` (this release's `<!--<script` fix), so the old `<\/script>` form no longer appears. The test's other check, that the raw payload never appears, is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011z8XLFXDGuywPteBesoZSU --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent 340df36 commit b093196

9 files changed

Lines changed: 332 additions & 8 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,33 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.12.7] - 2026-10-13
9+
10+
**Workspace skills and knowledge come first.** In a linked project the agent prefers the workspace's own skills over lookalikes in the repo or your home folder, and checks the workspace's knowledge base for best practices without being asked. Linking now ends with a starter that says what the workspace provides and suggests prompts. Also in this release: opt-in automatic promotion for `learn`, session traces for the IDE extension, and Snowflake reconnects written to `opencode.log`.
11+
12+
**Heads-up for support:**
13+
- **The start-screen workspace box is back.** 0.12.6 removed it because it stopped every keybinding once it loaded. The cause is fixed, and Ctrl+C, Ctrl+P and Esc were checked on the start screen of the release build, linked, unlinked and with the workspace service unreachable. If a signed-in user still reports dead keys, `ALTIMATE_DISABLE_WORKSPACE=1` remains the stopgap.
14+
- **The skill list changes for everyone, not only workspace users.** Each skill the agent sees now carries its source (`workspace`, `project`, `built-in`, `personal` or `other`), and the agent is told to prefer them in that order. So a skill in the repository now outranks a personal one with a similar purpose. It is guidance to the agent, not a filter: every skill is still listed and can be asked for by name.
15+
- **The agent may search the workspace knowledge base on its own.** When the linked workspace has knowledge, the agent consults it for best practices and team conventions without the user asking. Unlinking the project, or turning knowledge off for the workspace, stops it.
16+
- **`serve` has new read-only routes for the IDE extension** (see Added). Traces hold prompts and tool output, including SQL and query results. Like every `serve` route, they need no password unless `OPENCODE_SERVER_PASSWORD` is set, so set one on a shared machine.
17+
18+
### Changed
19+
20+
- **Workspace skills and knowledge are preferred.** Every skill in the agent's list is labelled with where altimate-code found it, and one rule tells the agent to load the highest source that fits instead of asking which team's skill to follow. A project skill with exactly the same name as a workspace skill still replaces it. Listings stay in name order, so built-in skills are not pushed out of the skill tool's list. With knowledge on, the workspace section also tells the agent to check the knowledge base before answering best-practice questions. (#1435)
21+
22+
### Added
23+
24+
- **A starter after linking.** `altimate-code link` ends with what the workspace provides (skills, knowledge, integrations, memory setting) and up to three prompts to try; the TUI shows the same after a link and from `/workspace` → **Get started**, where picking a prompt fills the input without sending it. It makes no model call, and anything not yet known is left out rather than shown as "none". `GET /altimate/workspace/starter` serves it to the IDE extension. (#1435)
25+
- **`learn` can promote lessons without a person, if you opt in.** `learn enable --auto-promote` (or `learn.auto_promote: true`, or `ALTIMATE_LEARN_AUTO_PROMOTE=1`) promotes a lesson an automatic reflection staged when every check passes: it came from a correction, review or CI signal; it is exactly what was staged; it validates like a manual promote; it does not weaken a verification step; it does not edit or remove a lesson a person approved or pinned; and it stays within 3 changes per promotion and 5 per day (`learn.auto_promote_max_changes`, `learn.auto_promote_daily`). Otherwise the candidate stays staged and `learn status` says why. Off by default, needs capture and automatic reflection on, and `learn rollback` undoes a promotion. (#1418)
26+
- **Session traces for the IDE extension.** `serve` adds `GET /altimate/trace` (a page of traces, newest first) and `GET /altimate/trace/<session>/view` (the trace viewer, without Copy Link), so the extension's `/traces` can list and open them. Browser-originated requests are refused, as for the workspace routes. (#1415)
27+
28+
### Fixed
29+
30+
- **The TUI's keybindings keep working with the start-screen workspace box.** The box rendered nothing until the project's link was resolved; each time its lines arrived, the start screen remounted it empty, and it resolved again without end, which held up every keybinding. It now keeps a root element from its first render. (#1435)
31+
- **Snowflake reconnects are in `opencode.log`.** When Snowflake closes a session and the driver reopens it, the log gains `reconnecting`, then `reconnected` (with the reason, how long it took, how many session settings were restored, and whether temporary tables or a transaction may have been lost) or `reconnect failed` (a warning with the masked error). The lines name the account, and the connection when only one uses it; they never contain SQL. Before, a session that kept dropping left no trace. (#1427)
32+
- **A trace containing `<!--<script` no longer opens as an empty page.** The viewer embeds the trace in an inline script, and that text in tool output (a fetched web page, say) stopped the script from running. Affected the TUI's `/traces` too. Found in this release's testing.
33+
- **The trace viewer page cannot call the server's API.** Served from `serve` for the IDE, the page now carries a content security policy that allows its own script but no requests or form posts, so script injected through trace content cannot reach other routes. Found in this release's review.
34+
835
## [0.12.6] - 2026-10-06
936

1037
Hotfix for 0.12.5. **Heads-up for support:** anyone on 0.12.5 who is signed in to Altimate gets a TUI where keybindings do nothing and Ctrl+C does not quit; they have to close the terminal. Upgrading fixes it, and so does `ALTIMATE_DISABLE_WORKSPACE=1` as a stopgap.

‎docs/docs/configure/warehouses.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Each warehouse has a key (the connection name) and a config object:
5353
| `database` | No | Database name |
5454
| `schema` | No | Schema name |
5555
| `role` | No | User role |
56-
| `client_session_keep_alive` | No | Keep the session alive while Altimate Code is running (default `true`). A connection Snowflake closes anyway is reopened automatically. `USE`, `ALTER SESSION` and `SET` settings are applied again to the reopened session. A single read-only query interrupted by the close is run again; a statement that changes data, or calls a sequence, is not, because it may already have run, and the error says so. Temporary tables and an open transaction cannot be restored: statements issued before the reopen report that instead of running. |
56+
| `client_session_keep_alive` | No | Keep the session alive while Altimate Code is running (default `true`). A connection Snowflake closes anyway is reopened automatically. `USE`, `ALTER SESSION` and `SET` settings are applied again to the reopened session. A single read-only query interrupted by the close is run again; a statement that changes data, or calls a sequence, is not, because it may already have run, and the error says so. Temporary tables and an open transaction cannot be restored: statements issued before the reopen report that instead of running. Each reopen is written to `opencode.log` under `warehouse-connect` as `reconnecting`, then `reconnected` (with `reason`, `duration_ms`, `settings_restored` and `session_state_lost`) or `reconnect failed` (a warning with the masked error). The lines name the account, and the connection when only one uses that account; they never contain SQL. |
5757

5858
### Key-pair authentication
5959

‎docs/docs/usage/cli.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ With workspaces on:
6565
- When the linked workspace has knowledge, the agent is told to check it for best practices and team conventions before answering, without you having to mention the knowledge base.
6666
- In an ordinary session the agent is told every turn which workspace the project is linked to — or that none is, or that the link could not be verified just now. In an extension-pinned session it is told the pinned workspace instead, and that it differs from the project's own link. Either way "which workspace am I in?" has an answer, and the agent is told not to confuse it with a Databricks workspace or an IDE workspace folder.
6767
- When `altimate-code serve` is launched by the VS Code / Cursor extension, the workspace selected in the extension's panel governs that session's skills, memory and (unless `--integrations local` is set) warehouse tool routing, taking priority over whatever the project is linked to on the backend, and is scoped to the folder it was launched for. A pin is fixed for the life of the `serve` process, so the extension relaunches `serve` when the selection changes; nothing updates a running one.
68+
- `serve` also gives the IDE extension what the TUI shows: `GET /altimate/workspace/starter` (the starter message after a link) and `GET /altimate/trace` with `GET /altimate/trace/<session>/view` (the trace list and viewer behind `/traces`). Traces hold prompts and tool output, including SQL and query results. Like every `serve` route, these need no password unless `OPENCODE_SERVER_PASSWORD` is set, so set one on a shared machine.
6869

6970
## Global Flags
7071

‎packages/opencode/src/altimate/observability/viewer.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ export function renderTraceViewer(
2020
// shareable, so the Copy Link button is left out.
2121
options?: { live?: boolean; apiPath?: string; embedded?: boolean },
2222
): string {
23-
const traceJSON = JSON.stringify(trace).replace(/<\//g, "<\\/")
23+
// Every `<` as `\u003c`, not just `</`: `<!--<script` in tool output would otherwise put the HTML parser in a
24+
// state where this script's own `</script>` no longer ends it, and the page renders empty.
25+
const traceJSON = JSON.stringify(trace).replace(/</g, "\\u003c")
2426
const apiPath = options?.apiPath ?? "/api/trace"
2527
const live = options?.live ?? false
2628
const embedded = options?.embedded ?? false
@@ -1242,7 +1244,7 @@ function showDetail(span) {
12421244
}
12431245
12441246
el.innerHTML = html;
1245-
} catch(err) { el.innerHTML = '<div style="color:var(--red);padding:20px">Summary rendering error: ' + (err.message || err) + '</div>'; console.error('[trace] Summary error:', err); }
1247+
} catch(err) { el.innerHTML = '<div style="color:var(--red);padding:20px">Summary rendering error: ' + e(err.message || err) + '</div>'; console.error('[trace] Summary error:', err); }
12461248
})();
12471249
12481250
// ===================== WATERFALL VIEW =====================

‎packages/opencode/src/server/server.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,9 @@ export namespace Server {
139139
}
140140
const TRACE_PAGE_SIZE = 50
141141
const TRACE_PAGE_MAX = 200
142+
/** No requests or form posts from the trace viewer page: its content is tool output, not ours. */
143+
const TRACE_VIEW_CSP =
144+
"default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; img-src data: blob:; connect-src 'none'; form-action 'none'; base-uri 'none'"
142145
const TRACE_SESSION_ID = /^[A-Za-z0-9_-]{1,128}$/
143146
/** The traces directory, honoring `tracing.dir` like the CLI and TUI; a config that fails to load
144147
* falls back to the default rather than hiding every trace. */
@@ -1372,6 +1375,7 @@ export namespace Server {
13721375
])
13731376
const trace = await Trace.loadTrace(sessionID, await tracesDir())
13741377
if (!trace) return c.json({ ok: false, error: `Trace not found: ${sessionID}` }, 404)
1378+
c.header("Content-Security-Policy", TRACE_VIEW_CSP)
13751379
return c.html(renderTraceViewer(trace, { embedded: true }))
13761380
} catch (err) {
13771381
const error = err instanceof Error ? err.message : String(err)

‎packages/opencode/test/altimate/tracing-viewer-e2e.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,8 +1079,8 @@ describe.skipIf(!canRunBrowserTests)("Trace Viewer Adversarial", () => {
10791079
const scriptContent = html.match(/<script>([\s\S]*?)<\/script>/)?.[1] ?? ""
10801080
// The only </script> should be the closing tag itself
10811081
expect(scriptContent).not.toContain("</script>")
1082-
// But should contain the escaped version
1083-
expect(scriptContent).toContain("<\\/script>")
1082+
// But should contain the escaped version: every `<` from the trace as `\u003c`
1083+
expect(scriptContent).toContain("\\u003c/script>\\u003cscript>alert(1)")
10841084
})
10851085

10861086
test("unicode in span names renders correctly", async () => {

‎packages/opencode/test/server/altimate-trace-routes.test.ts‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,17 @@ describe("GET /altimate/trace/:sessionID/view", () => {
135135
expect(html).toContain('id="btn-share"')
136136
})
137137

138+
// Trace content is tool output, so script injected through it must not be able to call this server's API.
139+
test("the viewer page may not make requests or post forms", async () => {
140+
await writeTrace("ses_view", "2026-10-01T10:00:00.000Z")
141+
142+
const response = await get("/altimate/trace/ses_view/view")
143+
const csp = response.headers.get("content-security-policy") ?? ""
144+
expect(csp).toContain("connect-src 'none'")
145+
expect(csp).toContain("form-action 'none'")
146+
expect(csp).toContain("default-src 'none'")
147+
})
148+
138149
test("returns 404 for an unknown trace", async () => {
139150
const response = await get("/altimate/trace/ses_missing/view")
140151
expect(response.status).toBe(404)

0 commit comments

Comments
 (0)