From 26540944f9730a6cf1d21e71a5461cce59c49241 Mon Sep 17 00:00:00 2001 From: Haider Date: Mon, 16 Nov 2026 03:11:37 +0530 Subject: [PATCH 1/3] release: v0.12.11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changelog entry, release adversarial tests, and the fixes from the release review: - A `--model anthropic/...` that no longer resolves (the Claude Pro/Max sign-in was removed) says to use an API key or `/connect` → Claude subscription, in `run`, the TUI and `serve` - The Claude subscription `/connect` failure toast says to run `claude auth login` instead of "OAuth authorization failed"; a Claude Code start that times out names the network or proxy - `impact_analysis` says in its report when the column answer could not be built - Removing a request from the workspace in `/rules` asks for confirmation, opening on No - A member's `skill publish` says approval happens in the Altimate web app - Docs: `impact_analysis` reference, `tool report-event`, and Claude subscription notes (environment keys, proxy, Windows path, deleted chats) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01XM3J9mB75wZRnzTSGcW2kc --- CHANGELOG.md | 36 ++++ docs/docs/configure/providers.md | 7 +- .../data-engineering/tools/lineage-tools.md | 20 ++ docs/docs/usage/tool.md | 4 + .../provider/claude-agent/claude/probe.ts | 2 +- .../provider/claude-agent/claude/sessions.ts | 2 +- .../src/altimate/provider/model-hint.ts | 10 + .../src/altimate/tools/impact-analysis.ts | 8 +- .../src/altimate/workspace/skill-publish.ts | 2 +- packages/opencode/src/cli/error.ts | 5 + .../src/plugin/tui/altimate/rules.tsx | 64 ++++-- packages/opencode/src/session/prompt.ts | 12 +- .../impact-analysis-column-answer.test.ts | 2 + packages/opencode/test/cli/error.test.ts | 16 ++ .../release-v0.12.11-adversarial.test.ts | 186 ++++++++++++++++++ .../tui/src/component/dialog-provider.tsx | 5 +- 16 files changed, 356 insertions(+), 25 deletions(-) create mode 100644 packages/opencode/src/altimate/provider/model-hint.ts create mode 100644 packages/opencode/test/skill/release-v0.12.11-adversarial.test.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 79b76578f5..b930016bc8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,42 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.12.11] - 2026-11-16 + +**You can use a Claude Pro or Max plan through your own Claude Code login, and workspace review works from every client.** The new Claude subscription provider runs Claude models through the `claude` you already have installed; Altimate Code never reads or stores its token. The first-run picker and `/connect` suggest the subscription logins already on the machine. On workspaces with review on, a member's skill goes to the owner or an admin for approval, everyone sees their own requests and their status, and requests can be withdrawn or removed from the TUI, `serve` and the plugins. Team rules also reach Claude Code and Codex sessions through the plugins. `impact_analysis` answers where a column's value goes, or where it comes from, hop by hop. Also in this release: a capped agent ends with an answer, one overflow compacts once, and the dbt adapter starts under Bun. + +**Heads-up for support:** +- **The Anthropic provider's "Claude Pro/Max" sign-in is removed.** A login saved with it no longer connects; Anthropic API keys are unaffected. The TUI shows a one-time notice, and a `--model anthropic/...` that no longer resolves says what to do. To keep using the plan: install Claude Code 2.1.296 or later, run `claude auth login`, then `/connect` → **Claude subscription**. The `claude-code-20250219` beta header is no longer sent. +- **Claude subscription needs `claude` on the same machine.** `OPENCODE_CLAUDE_PATH` points at a specific binary (on Windows, the full path to `claude.exe` if the login check does not finish). `claude` runs with the user's environment, so an `ANTHROPIC_API_KEY` or `ANTHROPIC_AUTH_TOKEN` in the shell is used, and billed, instead of the subscription. If no login is found within 5 minutes, `/connect` says to run `claude auth login`. Deleting a chat also deletes Claude Code's copy of it (`claude --resume` no longer lists it). +- **The first-run picker shows at most five suggestions:** the Altimate LLM Gateway, subscription logins found on this machine, the Claude and ChatGPT subscriptions, and the Anthropic and OpenAI API keys. Altimate Base, Google and every other provider are under **Search all providers…**. Detection only checks that a login exists; nothing is read from it or sent anywhere. +- **On a workspace with review on, a member's `skill publish` sends the skill for review** and exits 0; it reaches the team once the owner or an admin approves it in the Altimate web app. `altimate-code workspace review status` shows where each request stands. +- **Workspace admins review and manage like the owner.** Against an older server that sends no role, an admin is treated as a member. +- **Removing an approved skill or knowledge base from the workspace** (`/rules` → your request → **Remove from the workspace**) stops serving it to the whole team, and now asks for confirmation. +- **A capped agent (`steps`) ends with a text answer** sent with no tools, and the cap counts model requests rather than loop iterations, so compaction no longer uses up steps. + +### Added + +- **Claude subscription provider.** Claude models through the user's Claude Code login, with Altimate Code's tools, permissions, agents and skills; Claude Code's own tools, settings, `CLAUDE.md`, hooks and MCP servers are off. See "Claude Agent (Claude subscription)" in the providers docs. (#1706) +- **Subscription suggestions on the first-run picker and `/connect`**, from Claude Code, Codex CLI and Copilot editor logins and logins saved earlier, through `GET /altimate/provider/subscriptions`. (#1706) +- **Workspace review.** `skill publish` waits for approval on review-on workspaces, `workspace review status` lists your requests, and the TUI shows a notice once when a request is approved, rejected or removed. Skills sync at the version the workspace serves you. (#1685, #1708) +- **Workspace roles.** Admins approve, reject and manage like the owner, and their own submissions go in without review. (#1707) +- **Your requests in one view, from any client.** `/rules` lists your rule proposals and your skill and knowledge requests, and withdraws or removes them; `serve` gives the same through `GET /altimate/workspace/requests` and `POST /altimate/workspace/requests/{id}/withdraw|remove`, and `workspace review decisions --json` for plugins. (#1716) +- **Workspace rules in Claude Code and Codex sessions** through the plugins' hooks (`learn hook`, `learn rules`). (#1626) +- **Column answer in `impact_analysis`.** With a column and `direction` (`downstream` by default, or `upstream`), it traces the value hop by hop through compiled SQL and lists every model past the edited one as carrying it or possibly carrying it, with the reason (`metadata.column_answer`). `dbt_lineage` uses the same column resolver. See `impact_analysis` in the lineage tools docs. (#1710) +- **`tool report-event`**, which the Claude Code plugin calls to count how its lineage report is used (`lineage_report` telemetry; nothing is sent when telemetry is off). (#1718) + +### Changed + +- **The dbt integration moves to 0.3.17**, which starts its Python bridge without `python-bridge`, so the dbt-first path of `sql_execute` runs under Bun, and dbt's log lines stay off the TUI and JSON output. (#1368) + +### Fixed + +- **A capped agent ends with an answer** instead of a failed request, and a capped subagent no longer hands its parent an empty result; an empty task result is reported as such. (#1632) +- **One context overflow compacts once**, instead of replacing the summary with a summary of the kept tail, and the post-compaction ledger lists files written by shell commands. (#1639) +- **Background subagents run without blocking the parent** when `OPENCODE_EXPERIMENTAL_BACKGROUND_SUBAGENTS` is on: `background: true` returns a `task_id` to collect later, at most 4 run per parent, and cancellation keeps partial findings. (#1643) +- **Workspace telemetry.** A workspace's first prompt and job are sent from any session bound to it, with `origin`; a pinned IDE session names the picked workspace; a failed prompt leaves no workspace verdict; and `ALTIMATE_DISABLE_WORKSPACE` stops a saved link's first events. (#1699, #1672, #1705, #1711) +- **Clearer failures.** A failed `impact_analysis` column answer is said in the report, a Claude Code start that times out names the network or proxy as the likely cause, and a Claude subscription `/connect` that finds no login says to run `claude auth login`. + ## [0.12.10] - 2026-11-07 **Workspace rules are no longer read from the repository, and a session's title no longer sticks on its placeholder.** The workspace rules state (queued proposals, pending approvals, review notices, dismissed topics and the personal learning choice) moves out of the project folder to a private per-user file, so a branch, merge or pull cannot plant a proposal or an approval that a client would then send with the signed-in person's credential, and team rules reach a session only for the account that pulled them. A session whose first title request fails now retries on the next messages and records the provider's error. Also in this release: a project linked by its path can gain its git remote so team rules can sync, `learn status` says why rules are off, and `tool` commands deliver a large answer whole on a pipe. diff --git a/docs/docs/configure/providers.md b/docs/docs/configure/providers.md index 5c5d69e69c..462c482bfc 100644 --- a/docs/docs/configure/providers.md +++ b/docs/docs/configure/providers.md @@ -168,7 +168,7 @@ A login counts as found even if it has expired. Altimate Code checks that these | Claude Pro/Max | Claude Code's login (`~/.claude/.credentials.json`, `~/.claude.json`, or the macOS keychain item `Claude Code-credentials`) | Uses that login; nothing to sign in | | ChatGPT Plus/Pro | The Codex CLI's ChatGPT login (`~/.codex/auth.json`) | You sign in with ChatGPT once in Altimate Code | | GitHub Copilot | A Copilot editor login (`~/.config/github-copilot/`) | You sign in with GitHub once in Altimate Code | -| Claude Pro/Max | Claude subscription connected earlier in Altimate Code | Checks your Claude Code login again; run `claude auth login` if it has ended | +| Claude subscription already connected | Claude subscription connected earlier in Altimate Code | Checks your Claude Code login again; run `claude auth login` if it has ended | | ChatGPT, GitHub Copilot, SuperGrok or GitLab Duo | A login saved earlier in Altimate Code | Reconnects, signing in again if it expired | ## Claude Agent (Claude subscription) @@ -187,7 +187,10 @@ How it behaves: - Chats use Claude Code's system prompt plus the selected agent's prompt as its role. Temperature, top-p and top-k are not supported. - You can switch between Claude Agent and other models in the same session. Claude is sent the part of the conversation it has not seen. - Each session keeps one `claude` process, which stops after 5 minutes idle and resumes the saved Claude session on the next message. -- `claude` must be installed on the same machine. Set `OPENCODE_CLAUDE_PATH` to run a specific `claude` binary instead of the one on `PATH`. +- `claude` must be installed on the same machine. Set `OPENCODE_CLAUDE_PATH` to run a specific `claude` binary instead of the one on `PATH`, for example the full path to `claude.exe` on Windows if the login check does not finish. +- `claude` runs with your environment, as it does when you start it yourself. An `ANTHROPIC_API_KEY` or `ANTHROPIC_AUTH_TOKEN` set in your shell is therefore used instead of your subscription and billed to that key; unset it to use the subscription. Proxy settings (`HTTPS_PROXY`, and `NODE_EXTRA_CA_CERTS` for a company certificate) reach `claude` the same way. +- The model list comes from Claude Code, so it appears after the first successful connect. If `claude` cannot reach Anthropic, `/connect` keeps checking and then says no login was found. +- Deleting a chat in Altimate Code also deletes Claude Code's copy of that conversation, so it no longer appears in `claude --resume`. Connection settings in config map to Claude Code variables: diff --git a/docs/docs/data-engineering/tools/lineage-tools.md b/docs/docs/data-engineering/tools/lineage-tools.md index 9c2b96f0ef..ce0b308137 100644 --- a/docs/docs/data-engineering/tools/lineage-tools.md +++ b/docs/docs/data-engineering/tools/lineage-tools.md @@ -87,3 +87,23 @@ Source columns: Downstream impact: dim_products.category rename would break fct_revenue ``` + +## impact_analysis + +Shows what a change to a dbt model, or to one of its columns, affects downstream, from the project's `manifest.json`. + +``` +impact_analysis({ model: "stg_orders", column: "order_id", change_type: "rename" }) +impact_analysis({ model: "fct_orders", column: "revenue", change_type: "modify", direction: "upstream" }) +``` + +| Parameter | Meaning | +|---|---| +| `model` | The model, by name or unique id | +| `column` | Optional. Without it, the report is model-level only | +| `change_type` | The change you plan: `remove`, `rename`, `retype`, `add` or `modify` | +| `manifest_path` | Path to `manifest.json`; `target/manifest.json` by default | +| `direction` | With a column: `downstream` (default) says where its value goes; `upstream` traces where it comes from | +| `dialect` | Optional SQL dialect; read from the manifest when left out | + +The report lists the directly and transitively affected models, their tests, and the exposures (dashboards) on them. With a column, it also traces each model's compiled SQL hop by hop and adds a column answer: the columns that carry the value, in which models, how many hops, and where it ends. A model the trace cannot settle (for example a `select *`, a natural join, or SQL the engine cannot read) is listed as one that *may carry* it, with the reason, rather than dropped. The full answer is in the tool's `metadata.column_answer`. If the column answer cannot be built, the report says why, and the model-level impact still stands. diff --git a/docs/docs/usage/tool.md b/docs/docs/usage/tool.md index e31f362e9f..20a7d498c3 100644 --- a/docs/docs/usage/tool.md +++ b/docs/docs/usage/tool.md @@ -80,3 +80,7 @@ The daemon listens on a local socket (a named pipe on Windows) under the Altimat ## Claude Code routing For clients that cannot use the `altimate-code` MCP server, the Claude Code plugin adds CLI routing guidance at session start: `altimate-code tool context` followed by `altimate-code tool run` for data questions, and `altimate-code run` for long multi-step jobs. To persist the same guidance in the repository, run `altimate-code link --claude-md`; it writes a managed block to the project's `CLAUDE.md` and never changes content outside the `` / `` markers. + +## Plugin events + +`altimate-code tool report-event --session claude:` is called by the Claude Code plugin to record what a person did with its lineage report (shown, opened, built, failed to build). It sends one `lineage_report` usage event (see [Telemetry](../reference/telemetry.md)) and nothing when telemetry is off. It is not meant to be run by hand. diff --git a/packages/opencode/src/altimate/provider/claude-agent/claude/probe.ts b/packages/opencode/src/altimate/provider/claude-agent/claude/probe.ts index 0661977a4f..6dc57aa3bc 100644 --- a/packages/opencode/src/altimate/provider/claude-agent/claude/probe.ts +++ b/packages/opencode/src/altimate/provider/claude-agent/claude/probe.ts @@ -76,7 +76,7 @@ export const run = Effect.fn("ClaudeProbe.run")(function* (options: Options) { }).pipe( Effect.timeoutOrElse({ duration: "30 seconds", - orElse: () => Effect.fail(new ProbeError({ cause: new Error("claude did not start within 30 seconds") })), + orElse: () => Effect.fail(new ProbeError({ cause: new Error("claude did not start within 30 seconds. Check the network, and any proxy (HTTPS_PROXY) or custom CA (NODE_EXTRA_CA_CERTS) it needs") })), }), ) // No prompt is sent here, so an old Claude Code can still list its models. diff --git a/packages/opencode/src/altimate/provider/claude-agent/claude/sessions.ts b/packages/opencode/src/altimate/provider/claude-agent/claude/sessions.ts index 620a9f9ebc..df158efe05 100644 --- a/packages/opencode/src/altimate/provider/claude-agent/claude/sessions.ts +++ b/packages/opencode/src/altimate/provider/claude-agent/claude/sessions.ts @@ -192,7 +192,7 @@ export function registry() { attempt(() => process.session.ready).pipe( Effect.timeoutOrElse({ duration: "30 seconds", - orElse: () => Effect.fail(new Error("claude did not start within 30 seconds")), + orElse: () => Effect.fail(new Error("claude did not start within 30 seconds. Check the network, and any proxy (HTTPS_PROXY) or custom CA (NODE_EXTRA_CA_CERTS) it needs")), }), ), ).pipe(Effect.onError(() => stop(entry).pipe(Effect.ignore))) diff --git a/packages/opencode/src/altimate/provider/model-hint.ts b/packages/opencode/src/altimate/provider/model-hint.ts new file mode 100644 index 0000000000..08263895bd --- /dev/null +++ b/packages/opencode/src/altimate/provider/model-hint.ts @@ -0,0 +1,10 @@ +// altimate_change - new file +// +// Extra guidance for a "Model not found" error. The Anthropic provider lost its Claude Pro/Max sign-in +// in 0.12.11, so a saved `anthropic/...` model with only that login now fails to resolve; the bare +// error gave no reason. +// With suggestions the provider is there and the model name is likely a typo, so no hint. +export function modelNotFoundHint(providerID: string | undefined, suggestions?: readonly string[]) { + if (providerID !== "anthropic" || suggestions?.length) return undefined + return "The Anthropic provider needs an API key. For a Claude Pro or Max plan, run /connect and pick Claude subscription." +} diff --git a/packages/opencode/src/altimate/tools/impact-analysis.ts b/packages/opencode/src/altimate/tools/impact-analysis.ts index 7585749257..868e2a5575 100644 --- a/packages/opencode/src/altimate/tools/impact-analysis.ts +++ b/packages/opencode/src/altimate/tools/impact-analysis.ts @@ -136,7 +136,13 @@ export const ImpactAnalysisTool = Tool.define("impact_analysis", { columnReach: reach, columnReachError: reachError, }) - const output = answer ? `${report}\n${describeAnswer(answer)}` : report + // A failed column answer is said in the report, so it does not read as "no column impact". The same + // reason as column reach's is already in the report. + const output = answer + ? `${report}\n${describeAnswer(answer)}` + : answerError && answerError !== reachError + ? `${report}\nColumn answer unavailable: ${answerError}` + : report const totalAffected = downstream.length const severity = diff --git a/packages/opencode/src/altimate/workspace/skill-publish.ts b/packages/opencode/src/altimate/workspace/skill-publish.ts index 353c6b4e38..9d8cc033c3 100644 --- a/packages/opencode/src/altimate/workspace/skill-publish.ts +++ b/packages/opencode/src/altimate/workspace/skill-publish.ts @@ -1074,7 +1074,7 @@ export function describePublish(report: PublishReport): string { return `Already waiting for review: "${name}" was sent to ${owner} with the same content. Nothing new was sent.` if (review.duplicate) return `Already approved: "${name}" is in "${workspace}" with the same content. Nothing new was sent.` if (review.status === "active") return `Published "${name}" to "${workspace}" ${detail}.` - return `Sent "${name}" for review to ${owner} ${detail}. It reaches the workspace once approved; \`altimate-code workspace review status\` shows where it stands.` + return `Sent "${name}" for review to ${owner} ${detail}. It reaches the workspace once approved in the Altimate web app; \`altimate-code workspace review status\` shows where it stands.` } /** Every error this module raises on purpose, with its stable code for clients that explain it in their own words diff --git a/packages/opencode/src/cli/error.ts b/packages/opencode/src/cli/error.ts index fe2287a6bb..db48134de6 100644 --- a/packages/opencode/src/cli/error.ts +++ b/packages/opencode/src/cli/error.ts @@ -1,6 +1,8 @@ import { NamedError } from "@opencode-ai/core/util/error" import { errorFormat } from "@/util/error" import { isRecord } from "@/util/record" +// altimate_change — explain a missing Anthropic provider (Claude Pro/Max sign-in removed) +import { modelNotFoundHint } from "@/altimate/provider/model-hint" type ConfigIssue = { message: string; path: string[] } @@ -67,6 +69,9 @@ export function FormatError(input: unknown): string | undefined { return [ `Model not found: ${stringField(providerModelNotFound, "providerID")}/${stringField(providerModelNotFound, "modelID")}`, ...(suggestions.length ? ["Did you mean: " + suggestions.join(", ")] : []), + ...[modelNotFoundHint(stringField(providerModelNotFound, "providerID"), suggestions)].filter( + (x): x is string => !!x, + ), `Try: \`altimate models\` to list available models`, `Or check your config (altimate-code.json) provider/model names`, ].join("\n") diff --git a/packages/opencode/src/plugin/tui/altimate/rules.tsx b/packages/opencode/src/plugin/tui/altimate/rules.tsx index 46da86d6c4..aab9b42404 100644 --- a/packages/opencode/src/plugin/tui/altimate/rules.tsx +++ b/packages/opencode/src/plugin/tui/altimate/rules.tsx @@ -692,7 +692,8 @@ function requestLine(r: WorkspaceRequest): string { return `${status}${by}${update}${expired}${r.reason ? ` — ${printable(r.reason)}` : ""}` } -/** Withdraw a waiting request, or remove an approved one from the workspace: each after a confirm. */ +/** Withdraw a waiting request, or remove an approved one from the workspace. Removing stops serving it to the + * whole team, so it asks again, opening on "No" so a stray Enter cannot remove it. */ function showRequestActions(api: TuiPluginApi, request: WorkspaceRequest) { const what = `${request.kind === "skill" ? "skill" : "knowledge base"} "${printable(request.name)}"` const options: TuiDialogSelectOption[] = [ @@ -708,25 +709,56 @@ function showRequestActions(api: TuiPluginApi, request: WorkspaceRequest) { { - if (option.value !== "withdraw" && option.value !== "remove") return void showMenu(api) - api.ui.dialog.clear() - const result = await post<{ ok: boolean; error?: string; code?: string; request?: WorkspaceRequest }>( - api, - `/altimate/workspace/requests/${encodeURIComponent(request.public_id)}/${option.value}`, - { expected_version: request.version }, - ).catch(() => undefined) - if (!result?.ok) - return api.ui.toast({ variant: "error", message: `Not ${option.value === "withdraw" ? "withdrawn" : "removed"}: ${printable(result?.error ?? "the session server did not answer")}`, duration: 8000 }) - api.ui.toast({ - variant: "success", - message: option.value === "withdraw" ? `Withdrew your ${what}.` : `Removed your ${what} from the workspace.`, - duration: 6000, - }) + onSelect={(option) => { + if (option.value === "withdraw") return void runRequestAction(api, request, what, "withdraw") + if (option.value === "remove") return confirmRemove(api, request, what) + return void showMenu(api) + }} + /> + )) +} + +function confirmRemove(api: TuiPluginApi, request: WorkspaceRequest, what: string) { + api.ui.dialog.replace(() => ( + + title={`Remove your ${what} from the workspace?`} + options={[ + { title: "No, keep it", value: "no", description: "Nothing changes." }, + { title: "Yes, remove it", value: "yes", description: "Teammates stop getting it. You can send it again later." }, + ]} + current="no" + onSelect={(choice) => { + if (choice.value === "yes") return void runRequestAction(api, request, what, "remove") + return showRequestActions(api, request) }} /> )) } + +async function runRequestAction( + api: TuiPluginApi, + request: WorkspaceRequest, + what: string, + action: "withdraw" | "remove", +) { + api.ui.dialog.clear() + const result = await post<{ ok: boolean; error?: string; code?: string; request?: WorkspaceRequest }>( + api, + `/altimate/workspace/requests/${encodeURIComponent(request.public_id)}/${action}`, + { expected_version: request.version }, + ).catch(() => undefined) + if (!result?.ok) + return api.ui.toast({ + variant: "error", + message: `Not ${action === "withdraw" ? "withdrawn" : "removed"}: ${printable(result?.error ?? "the session server did not answer")}`, + duration: 8000, + }) + api.ui.toast({ + variant: "success", + message: action === "withdraw" ? `Withdrew your ${what}.` : `Removed your ${what} from the workspace.`, + duration: 6000, + }) +} // altimate_change end const tui: TuiPlugin = async (api) => { diff --git a/packages/opencode/src/session/prompt.ts b/packages/opencode/src/session/prompt.ts index 0c5c86172d..ca2e8a9dd0 100644 --- a/packages/opencode/src/session/prompt.ts +++ b/packages/opencode/src/session/prompt.ts @@ -23,6 +23,8 @@ import { Provider } from "../provider/provider" import { ModelID, ProviderID } from "../provider/schema" // altimate_change — a session's last-used model can be a stale keyless public-Zen pick; see lastModel() import { FreeTier } from "../altimate/free/client" +// altimate_change — explain a missing Anthropic provider (Claude Pro/Max sign-in removed) +import { modelNotFoundHint } from "../altimate/provider/model-hint" // altimate_change start — shared family→vendor classifier (#888 J1) import { familyVendor } from "../provider/family" // altimate_change end @@ -1313,10 +1315,12 @@ export namespace SessionPrompt { const model = await Provider.getModel(lastUser.model.providerID, lastUser.model.modelID).catch((e) => { if (Provider.ModelNotFoundError.isInstance(e)) { const hint = e.data.suggestions?.length ? ` Did you mean: ${e.data.suggestions.join(", ")}?` : "" + // altimate_change — explain a missing Anthropic provider + const guidance = modelNotFoundHint(e.data.providerID, e.data.suggestions) Bus.publish(Session.Event.Error, { sessionID, error: new NamedError.Unknown({ - message: `Model not found: ${e.data.providerID}/${e.data.modelID}.${hint}`, + message: `Model not found: ${e.data.providerID}/${e.data.modelID}.${hint}${guidance ? ` ${guidance}` : ""}`, }).toObject(), }) } @@ -4881,9 +4885,13 @@ NOTE: At any point in time through this workflow you should feel free to ask the if (Provider.ModelNotFoundError.isInstance(e)) { const { providerID, modelID, suggestions } = e.data const hint = suggestions?.length ? ` Did you mean: ${suggestions.join(", ")}?` : "" + // altimate_change — explain a missing Anthropic provider + const guidance = modelNotFoundHint(providerID, suggestions) Bus.publish(Session.Event.Error, { sessionID: input.sessionID, - error: new NamedError.Unknown({ message: `Model not found: ${providerID}/${modelID}.${hint}` }).toObject(), + error: new NamedError.Unknown({ + message: `Model not found: ${providerID}/${modelID}.${hint}${guidance ? ` ${guidance}` : ""}`, + }).toObject(), }) } throw e diff --git a/packages/opencode/test/altimate/impact-analysis-column-answer.test.ts b/packages/opencode/test/altimate/impact-analysis-column-answer.test.ts index ac27d6b651..5f20405e0e 100644 --- a/packages/opencode/test/altimate/impact-analysis-column-answer.test.ts +++ b/packages/opencode/test/altimate/impact-analysis-column-answer.test.ts @@ -157,6 +157,8 @@ describe("impact_analysis: column answer", () => { expect(result.metadata.column_reach_error).toBe(error) expect(result.metadata.column_answer_error).toBe(error) expect(result.output).toContain(`Column Reach: not traced (${error}); the model-level impact above stands`) + // The shared reason is said once. + expect(result.output).not.toContain("Column answer unavailable") }) test("the MCP structured result carries it", async () => { diff --git a/packages/opencode/test/cli/error.test.ts b/packages/opencode/test/cli/error.test.ts index 7110161223..9ce674b398 100644 --- a/packages/opencode/test/cli/error.test.ts +++ b/packages/opencode/test/cli/error.test.ts @@ -81,6 +81,22 @@ describe("cli.error", () => { expect(FormatError({ _tag: "ProviderModelNotFoundError", ...data })).toBe(expected) }) + test("a missing Anthropic provider says how to connect a Claude plan", () => { + // 0.12.11 removed the Claude Pro/Max sign-in, so a saved `anthropic/...` model with only that login + // no longer resolves; the provider is missing, so there is nothing to suggest. + const output = FormatError({ + name: "ProviderModelNotFoundError", + data: { providerID: "anthropic", modelID: "claude-sonnet-4-6", suggestions: [] }, + }) + expect(output).toContain("run /connect and pick Claude subscription") + expect( + FormatError({ + name: "ProviderModelNotFoundError", + data: { providerID: "openai", modelID: "gpt-x", suggestions: [] }, + }), + ).not.toContain("Claude subscription") + }) + test("formats legacy and tagged provider init errors the same way", () => { const data = { providerID: "anthropic" } const expected = 'Failed to initialize provider "anthropic". Check credentials and configuration.' diff --git a/packages/opencode/test/skill/release-v0.12.11-adversarial.test.ts b/packages/opencode/test/skill/release-v0.12.11-adversarial.test.ts new file mode 100644 index 0000000000..1b1c90e1ba --- /dev/null +++ b/packages/opencode/test/skill/release-v0.12.11-adversarial.test.ts @@ -0,0 +1,186 @@ +/** + * Adversarial coverage for the v0.12.11 payload (v0.12.10..HEAD, 17 PRs), on top of the suites each PR + * shipped with. The largest change is #1706 "Claude subscription support through a Claude Agent + * provider"; its suites (`test/altimate/provider/claude-agent/`, `test/altimate/provider/subscriptions.test.ts`, + * `test/server/altimate-subscriptions-route.test.ts`) replay real Claude sessions and cover detection, + * the route and the deleted-chat cleanup. The workspace review PRs (#1685, #1707, #1708, #1716) and the + * column answer (#1710) carry their own suites. + * + * This file adds the boundary classes those suites do not reach: + * + * - Subscription detection against hostile or malformed login files: a prototype-pollution key, JSON + * that is not an object, an empty or huge file, a directory where a file is expected, and a symlink to + * a file outside the folder. Detection must report names and sources only, never throw, and never + * report a login from a key that is not the file's own. + * - The removed Claude Pro/Max sign-in: only a saved Anthropic OAuth login is flagged, whatever else is + * saved beside it, and the flag survives a Claude Code login that hides it from `found`. + * - The "Model not found" hint added for that removal, as a truth table over provider ids and + * suggestions. + * - The Claude Agent storage key guard against traversal, absolute paths and separators. + * - Source guards that keep the removed sign-in removed and the subscription route behind the + * cross-site guard, so a later upstream merge cannot quietly restore them. + */ +import { afterEach, beforeEach, describe, expect, test } from "bun:test" +import fs from "fs/promises" +import os from "os" +import path from "path" +import * as Auth from "@/auth" +import { scan } from "@/altimate/provider/subscriptions" +import { modelNotFoundHint } from "@/altimate/provider/model-hint" +import { ClaudeAgentStorage } from "@/altimate/provider/claude-agent/storage" + +const src = path.join(import.meta.dir, "../../src") +const read = (file: string) => fs.readFile(path.join(src, file), "utf8") + +describe("v0.12.11: subscription detection against hostile login files", () => { + const saved = { ...process.env } + let root: string + + beforeEach(async () => { + root = await fs.mkdtemp(path.join(os.tmpdir(), "release-v0.12.11-")) + process.env.HOME = path.join(root, "home") + // A custom folder keeps the macOS keychain check off, so the developer's own login is never seen. + process.env.CLAUDE_CONFIG_DIR = path.join(root, "claude") + process.env.CODEX_HOME = path.join(root, "codex") + process.env.XDG_CONFIG_HOME = path.join(root, "config") + delete process.env.OPENCODE_AUTH_CONTENT + for (const dir of ["home", "claude", "codex", "config"]) await fs.mkdir(path.join(root, dir), { recursive: true }) + for (const key of Object.keys(await Auth.all())) await Auth.remove(key) + }) + + afterEach(async () => { + for (const key of Object.keys(await Auth.all())) await Auth.remove(key) + for (const key of ["HOME", "CLAUDE_CONFIG_DIR", "CODEX_HOME", "XDG_CONFIG_HOME", "OPENCODE_AUTH_CONTENT"]) { + if (saved[key] === undefined) delete process.env[key] + else process.env[key] = saved[key] + } + await fs.rm(root, { recursive: true, force: true }) + }) + + const write = (file: string, text: string) => fs.writeFile(path.join(root, file), text) + + test("a `tokens` key only in __proto__ is not a ChatGPT login", async () => { + await write("codex/auth.json", '{"__proto__":{"tokens":{"id_token":"x"}}}') + await write("claude/.claude.json", '{"__proto__":{"oauthAccount":{}}}') + expect((await scan()).found).toEqual([]) + // Parsing the file must not pollute Object.prototype either. + expect(({} as Record).tokens).toBeUndefined() + }) + + test("JSON that is not an object, or is empty, is not a login", async () => { + for (const text of ["[]", '"tokens"', "42", "null", "true", "", " ", "{", '{"tokens":']) + await write("codex/auth.json", text).then(async () => expect((await scan()).found).toEqual([])) + }) + + test("`tokens: null` and a Codex API key alone are not a ChatGPT subscription", async () => { + await write("codex/auth.json", JSON.stringify({ tokens: null, OPENAI_API_KEY: "sk-not-a-subscription" })) + expect((await scan()).found).toEqual([]) + }) + + test("a directory where a login file is expected is not a login, and does not throw", async () => { + await fs.mkdir(path.join(root, "claude/.credentials.json"), { recursive: true }) + await fs.mkdir(path.join(root, "codex/auth.json"), { recursive: true }) + await fs.mkdir(path.join(root, "config/github-copilot/apps.json"), { recursive: true }) + expect((await scan()).found).toEqual([]) + }) + + test("a large login file is read without reporting its contents", async () => { + const token = "secret-" + "x".repeat(2_000_000) + await write("codex/auth.json", JSON.stringify({ tokens: { access_token: token } })) + const result = await scan() + expect(result.found).toEqual([{ subscription: "chatgpt", source: "codex" }]) + expect(JSON.stringify(result)).not.toContain("secret-") + }) + + test("a symlinked credentials file counts, and its target's contents never appear", async () => { + const outside = path.join(root, "outside.json") + await fs.writeFile(outside, JSON.stringify({ claudeAiOauth: { accessToken: "sk-ant-oat-leak" } })) + await fs.symlink(outside, path.join(root, "claude/.credentials.json")) + const result = await scan() + expect(result.found).toEqual([{ subscription: "claude", source: "claude-code" }]) + expect(JSON.stringify(result)).not.toContain("sk-ant-oat-leak") + }) + + test("only a saved Anthropic OAuth login is flagged as the removed sign-in", async () => { + await Auth.set("anthropic", { type: "api", key: "sk-ant-api-not-oauth" }) + await Auth.set("openai", { type: "oauth", refresh: "r", access: "a", expires: 1 }) + expect((await scan()).retiredAnthropicLogin).toBe(false) + + await Auth.set("anthropic", { type: "oauth", refresh: "r", access: "a", expires: 1 }) + const result = await scan() + expect(result.retiredAnthropicLogin).toBe(true) + // It marks a Claude plan in `found`, and never claims to be a working connection. + expect(result.found).toContainEqual({ subscription: "claude", source: "anthropic-login" }) + }) + + test("a Claude Code login hides the removed sign-in from `found`, but the flag stays", async () => { + await Auth.set("anthropic", { type: "oauth", refresh: "r", access: "a", expires: 1 }) + await write("claude/.credentials.json", "{}") + const result = await scan() + expect(result.found).toEqual([{ subscription: "claude", source: "claude-code" }]) + expect(result.retiredAnthropicLogin).toBe(true) + }) +}) + +describe("v0.12.11: the Model not found hint for a missing Anthropic provider", () => { + test("shows only for the anthropic provider with nothing to suggest", () => { + expect(modelNotFoundHint("anthropic")).toContain("/connect and pick Claude subscription") + expect(modelNotFoundHint("anthropic", [])).toContain("Claude subscription") + }) + + test("a likely model typo (suggestions present) gets no hint", () => { + expect(modelNotFoundHint("anthropic", ["claude-sonnet-4-6"])).toBeUndefined() + }) + + test("other or malformed provider ids get no hint", () => { + for (const id of [undefined, "", "Anthropic", " anthropic", "anthropic ", "claude-agent", "openai", "anthropic/claude"]) + expect(modelNotFoundHint(id, [])).toBeUndefined() + }) +}) + +describe("v0.12.11: Claude Agent storage keys stay inside their folder", () => { + test("traversal, absolute paths and escapes through the root are refused", async () => { + for (const key of ["../outside", "sessions/../../outside", "/etc/passwd", "sessions/../../../x"]) { + const refused = await ClaudeAgentStorage.read(key).then( + () => `${key}: read`, + (error: Error) => error.message, + ) + expect(refused).toBe(`Invalid Claude Agent storage key: ${key}`) + } + }) + + test('a key of ".." stays inside the folder, as the file "...json"', async () => { + expect(await ClaudeAgentStorage.read("..")).toBeUndefined() + }) + + test("a missing key reads as nothing, and remove of a missing key is not an error", async () => { + expect(await ClaudeAgentStorage.read("sessions/release-v0.12.11-missing")).toBeUndefined() + await ClaudeAgentStorage.remove("sessions/release-v0.12.11-missing") + }) +}) + +describe("v0.12.11: source guards", () => { + test("the direct Claude Pro/Max sign-in and the Claude Code beta flag stay removed", async () => { + const plugins = await read("plugin/index.ts") + expect(plugins).not.toMatch(/["'`]opencode-anthropic-auth/) + expect(await read("provider/provider.ts")).not.toContain("claude-code-20250219") + }) + + test("the subscription route keeps its cross-site guard and returns names only", async () => { + const server = await read("server/server.ts") + const route = server.slice(server.indexOf('"/altimate/provider/subscriptions"')) + expect(route.slice(0, 1200)).toContain("browserOriginRefusal(") + const detection = await read("altimate/provider/subscriptions.ts") + // Detection checks that a login exists; it never returns a file's contents. + expect(detection).not.toMatch(/return\s+JSON\.parse/) + expect(detection).toContain('"find-generic-password", "-s"') + expect(detection).not.toMatch(/find-generic-password[^\n]*"-w"/) + }) + + test("removing a workspace request asks again, opening on No", async () => { + const rules = await read("plugin/tui/altimate/rules.tsx") + const confirm = rules.slice(rules.indexOf("function confirmRemove"), rules.indexOf("async function runRequestAction")) + expect(confirm).toContain('current="no"') + expect(confirm).toContain('runRequestAction(api, request, what, "remove")') + }) +}) diff --git a/packages/tui/src/component/dialog-provider.tsx b/packages/tui/src/component/dialog-provider.tsx index d550d1a1c9..a5981caa39 100644 --- a/packages/tui/src/component/dialog-provider.tsx +++ b/packages/tui/src/component/dialog-provider.tsx @@ -462,7 +462,10 @@ function AutoMethod(props: AutoMethodProps) { variant: "error", message: "name" in result.error && result.error.name === "ProviderAuthOauthCallbackFailed" - ? "OAuth authorization failed. Try /connect again." + ? // A Claude subscription waits for a Claude Code login instead of running an OAuth flow. + props.providerID === "claude-agent" + ? "No Claude Code login was found. Run `claude auth login` in a terminal (Claude Code 2.1.296 or later, see `claude --version`), then /connect again." + : "OAuth authorization failed. Try /connect again." : JSON.stringify(result.error), }) dialog.clear() From 821c4cae7904272849ad60a4b4a253a2956d3f21 Mon Sep 17 00:00:00 2001 From: Haider Date: Mon, 16 Nov 2026 08:43:05 +0530 Subject: [PATCH 2/3] fix: release review follow-ups from the bot reviews - The "Model not found" hint for Anthropic keys on a new `providerMissing` flag on `ProviderModelNotFoundError`, set only when the provider is absent. Suggestions no longer decide it: for a missing provider they are other provider names, and an Anthropic provider with an unknown model name gets no key advice. - The Claude subscription `/connect` failure toast also covers Claude Code failing to start (network, proxy, custom CA); nested ternary replaced. - One shared `START_TIMEOUT_MESSAGE` for the probe and chat-turn timeouts. - `impact_analysis`: nested ternary replaced with if/else. - Docs: the `report-event` actions are listed; a failed Claude Code transcript delete is logged and the chat is still removed; the column answer report gives counts, and each may-carry model with its reason is in `metadata.column_answer`. - Tests: the hint test covers a missing provider with suggestions and a present provider; the symlink case skips on Windows. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01XM3J9mB75wZRnzTSGcW2kc --- docs/docs/configure/providers.md | 2 +- .../data-engineering/tools/lineage-tools.md | 2 +- docs/docs/usage/tool.md | 2 +- .../provider/claude-agent/claude/probe.ts | 6 ++- .../provider/claude-agent/claude/sessions.ts | 3 +- .../src/altimate/provider/model-hint.ts | 8 ++-- .../src/altimate/tools/impact-analysis.ts | 9 ++-- packages/opencode/src/cli/error.ts | 11 +++-- packages/opencode/src/provider/provider.ts | 5 +- packages/opencode/src/session/prompt.ts | 4 +- packages/opencode/test/cli/error.test.ts | 18 +++++-- .../release-v0.12.11-adversarial.test.ts | 48 ++++++++++++------- .../tui/src/component/dialog-provider.tsx | 20 ++++---- 13 files changed, 88 insertions(+), 50 deletions(-) diff --git a/docs/docs/configure/providers.md b/docs/docs/configure/providers.md index 462c482bfc..3f5ab71b3b 100644 --- a/docs/docs/configure/providers.md +++ b/docs/docs/configure/providers.md @@ -190,7 +190,7 @@ How it behaves: - `claude` must be installed on the same machine. Set `OPENCODE_CLAUDE_PATH` to run a specific `claude` binary instead of the one on `PATH`, for example the full path to `claude.exe` on Windows if the login check does not finish. - `claude` runs with your environment, as it does when you start it yourself. An `ANTHROPIC_API_KEY` or `ANTHROPIC_AUTH_TOKEN` set in your shell is therefore used instead of your subscription and billed to that key; unset it to use the subscription. Proxy settings (`HTTPS_PROXY`, and `NODE_EXTRA_CA_CERTS` for a company certificate) reach `claude` the same way. - The model list comes from Claude Code, so it appears after the first successful connect. If `claude` cannot reach Anthropic, `/connect` keeps checking and then says no login was found. -- Deleting a chat in Altimate Code also deletes Claude Code's copy of that conversation, so it no longer appears in `claude --resume`. +- Deleting a chat in Altimate Code also deletes Claude Code's copy of that conversation, so it no longer appears in `claude --resume`. If that delete fails, the error is logged and the chat is still removed. Connection settings in config map to Claude Code variables: diff --git a/docs/docs/data-engineering/tools/lineage-tools.md b/docs/docs/data-engineering/tools/lineage-tools.md index ce0b308137..531b8bd089 100644 --- a/docs/docs/data-engineering/tools/lineage-tools.md +++ b/docs/docs/data-engineering/tools/lineage-tools.md @@ -106,4 +106,4 @@ impact_analysis({ model: "fct_orders", column: "revenue", change_type: "modify", | `direction` | With a column: `downstream` (default) says where its value goes; `upstream` traces where it comes from | | `dialect` | Optional SQL dialect; read from the manifest when left out | -The report lists the directly and transitively affected models, their tests, and the exposures (dashboards) on them. With a column, it also traces each model's compiled SQL hop by hop and adds a column answer: the columns that carry the value, in which models, how many hops, and where it ends. A model the trace cannot settle (for example a `select *`, a natural join, or SQL the engine cannot read) is listed as one that *may carry* it, with the reason, rather than dropped. The full answer is in the tool's `metadata.column_answer`. If the column answer cannot be built, the report says why, and the model-level impact still stands. +The report lists the directly and transitively affected models, their tests, and the exposures (dashboards) on them. With a column, it also traces each model's compiled SQL hop by hop and adds a column answer: the columns that carry the value, in which models, how many hops, and where it ends. A model the trace cannot settle (for example a `select *`, a natural join, or SQL the engine cannot read) counts as one that *may carry* it rather than being dropped. The report gives the counts; each model, with its reason, is in the tool's `metadata.column_answer`. If the column answer cannot be built, the report says why, and the model-level impact still stands. diff --git a/docs/docs/usage/tool.md b/docs/docs/usage/tool.md index 20a7d498c3..648fc94ad8 100644 --- a/docs/docs/usage/tool.md +++ b/docs/docs/usage/tool.md @@ -83,4 +83,4 @@ For clients that cannot use the `altimate-code` MCP server, the Claude Code plug ## Plugin events -`altimate-code tool report-event --session claude:` is called by the Claude Code plugin to record what a person did with its lineage report (shown, opened, built, failed to build). It sends one `lineage_report` usage event (see [Telemetry](../reference/telemetry.md)) and nothing when telemetry is off. It is not meant to be run by hand. +`altimate-code tool report-event --session claude:` is called by the Claude Code plugin to record what a person did with its lineage report. `` is one of `summary_shown`, `open_pressed`, `command_run`, `built`, `build_failed` or `no_browser`. It sends one `lineage_report` usage event (see [Telemetry](../reference/telemetry.md)) and nothing when telemetry is off. It is not meant to be run by hand. diff --git a/packages/opencode/src/altimate/provider/claude-agent/claude/probe.ts b/packages/opencode/src/altimate/provider/claude-agent/claude/probe.ts index 6dc57aa3bc..c770fb8832 100644 --- a/packages/opencode/src/altimate/provider/claude-agent/claude/probe.ts +++ b/packages/opencode/src/altimate/provider/claude-agent/claude/probe.ts @@ -4,6 +4,10 @@ import type { AccountInfo, ModelInfo, Options, Query } from "@anthropic-ai/claud import { Effect, Schema } from "effect" import { ClaudeSDK } from "./sdk" +/** Why `claude` may not start in time; the probe and a chat turn both show it. */ +export const START_TIMEOUT_MESSAGE = + "claude did not start within 30 seconds. Check the network, and any proxy (HTTPS_PROXY) or custom CA (NODE_EXTRA_CA_CERTS) it needs" + export interface Model extends ModelInfo { contextWindow?: number } @@ -76,7 +80,7 @@ export const run = Effect.fn("ClaudeProbe.run")(function* (options: Options) { }).pipe( Effect.timeoutOrElse({ duration: "30 seconds", - orElse: () => Effect.fail(new ProbeError({ cause: new Error("claude did not start within 30 seconds. Check the network, and any proxy (HTTPS_PROXY) or custom CA (NODE_EXTRA_CA_CERTS) it needs") })), + orElse: () => Effect.fail(new ProbeError({ cause: new Error(START_TIMEOUT_MESSAGE) })), }), ) // No prompt is sent here, so an old Claude Code can still list its models. diff --git a/packages/opencode/src/altimate/provider/claude-agent/claude/sessions.ts b/packages/opencode/src/altimate/provider/claude-agent/claude/sessions.ts index df158efe05..ce0045b94e 100644 --- a/packages/opencode/src/altimate/provider/claude-agent/claude/sessions.ts +++ b/packages/opencode/src/altimate/provider/claude-agent/claude/sessions.ts @@ -20,6 +20,7 @@ import { ConvertToClaudeMessage } from "../language-model/convert-to-claude-mess import { PendingTools } from "../tools/pending" import { ToolNames } from "../tools/names" import { ToolResult } from "../tools/result" +import { START_TIMEOUT_MESSAGE } from "./probe" export const HANDOVER_MS = 10_000 export const IDLE_MS = 5 * 60_000 @@ -192,7 +193,7 @@ export function registry() { attempt(() => process.session.ready).pipe( Effect.timeoutOrElse({ duration: "30 seconds", - orElse: () => Effect.fail(new Error("claude did not start within 30 seconds. Check the network, and any proxy (HTTPS_PROXY) or custom CA (NODE_EXTRA_CA_CERTS) it needs")), + orElse: () => Effect.fail(new Error(START_TIMEOUT_MESSAGE)), }), ), ).pipe(Effect.onError(() => stop(entry).pipe(Effect.ignore))) diff --git a/packages/opencode/src/altimate/provider/model-hint.ts b/packages/opencode/src/altimate/provider/model-hint.ts index 08263895bd..64fa4eba4d 100644 --- a/packages/opencode/src/altimate/provider/model-hint.ts +++ b/packages/opencode/src/altimate/provider/model-hint.ts @@ -2,9 +2,9 @@ // // Extra guidance for a "Model not found" error. The Anthropic provider lost its Claude Pro/Max sign-in // in 0.12.11, so a saved `anthropic/...` model with only that login now fails to resolve; the bare -// error gave no reason. -// With suggestions the provider is there and the model name is likely a typo, so no hint. -export function modelNotFoundHint(providerID: string | undefined, suggestions?: readonly string[]) { - if (providerID !== "anthropic" || suggestions?.length) return undefined +// error gave no reason. Only a missing provider gets the hint: an Anthropic provider that is there +// with an unknown model name needs a different model, not a key. +export function modelNotFoundHint(providerID: string | undefined, providerMissing: boolean | undefined) { + if (providerID !== "anthropic" || providerMissing !== true) return undefined return "The Anthropic provider needs an API key. For a Claude Pro or Max plan, run /connect and pick Claude subscription." } diff --git a/packages/opencode/src/altimate/tools/impact-analysis.ts b/packages/opencode/src/altimate/tools/impact-analysis.ts index 868e2a5575..a0dd5763f7 100644 --- a/packages/opencode/src/altimate/tools/impact-analysis.ts +++ b/packages/opencode/src/altimate/tools/impact-analysis.ts @@ -138,11 +138,10 @@ export const ImpactAnalysisTool = Tool.define("impact_analysis", { }) // A failed column answer is said in the report, so it does not read as "no column impact". The same // reason as column reach's is already in the report. - const output = answer - ? `${report}\n${describeAnswer(answer)}` - : answerError && answerError !== reachError - ? `${report}\nColumn answer unavailable: ${answerError}` - : report + let output = report + if (answer) output = `${report}\n${describeAnswer(answer)}` + else if (answerError && answerError !== reachError) + output = `${report}\nColumn answer unavailable: ${answerError}` const totalAffected = downstream.length const severity = diff --git a/packages/opencode/src/cli/error.ts b/packages/opencode/src/cli/error.ts index db48134de6..a447c7b63e 100644 --- a/packages/opencode/src/cli/error.ts +++ b/packages/opencode/src/cli/error.ts @@ -59,7 +59,7 @@ export function FormatError(input: unknown): string | undefined { return stringField(input, "message") ?? "" } - // ProviderModelNotFoundError: { providerID: string, modelID: string, suggestions?: string[] } + // ProviderModelNotFoundError: { providerID: string, modelID: string, suggestions?: string[], providerMissing?: boolean } const providerModelNotFound = configData(input, "ProviderModelNotFoundError") if (providerModelNotFound) { const suggestions = Array.isArray(providerModelNotFound.suggestions) @@ -69,9 +69,12 @@ export function FormatError(input: unknown): string | undefined { return [ `Model not found: ${stringField(providerModelNotFound, "providerID")}/${stringField(providerModelNotFound, "modelID")}`, ...(suggestions.length ? ["Did you mean: " + suggestions.join(", ")] : []), - ...[modelNotFoundHint(stringField(providerModelNotFound, "providerID"), suggestions)].filter( - (x): x is string => !!x, - ), + ...[ + modelNotFoundHint( + stringField(providerModelNotFound, "providerID"), + providerModelNotFound.providerMissing === true, + ), + ].filter((x): x is string => !!x), `Try: \`altimate models\` to list available models`, `Or check your config (altimate-code.json) provider/model names`, ].join("\n") diff --git a/packages/opencode/src/provider/provider.ts b/packages/opencode/src/provider/provider.ts index 7cc5bad05c..f9c3a72ebf 100644 --- a/packages/opencode/src/provider/provider.ts +++ b/packages/opencode/src/provider/provider.ts @@ -2285,7 +2285,8 @@ export namespace Provider { const availableProviders = Object.keys(s.providers) const matches = fuzzysort.go(providerID, availableProviders, { limit: 3, threshold: -10000 }) const suggestions = matches.map((m) => m.target) - throw new ModelNotFoundError({ providerID, modelID, suggestions }) + // altimate_change — mark a missing provider, so the error can say how to connect it + throw new ModelNotFoundError({ providerID, modelID, suggestions, providerMissing: true }) } const info = provider.models[modelID] @@ -2595,6 +2596,8 @@ export namespace Provider { providerID: ProviderID, modelID: ModelID, suggestions: Schema.optional(Schema.mutable(Schema.Array(Schema.String))), + // altimate_change — true when the provider itself is not available, not only the model + providerMissing: Schema.optional(Schema.Boolean), }) export const InitError = NamedError.create("ProviderInitError", { diff --git a/packages/opencode/src/session/prompt.ts b/packages/opencode/src/session/prompt.ts index ca2e8a9dd0..93187d0201 100644 --- a/packages/opencode/src/session/prompt.ts +++ b/packages/opencode/src/session/prompt.ts @@ -1316,7 +1316,7 @@ export namespace SessionPrompt { if (Provider.ModelNotFoundError.isInstance(e)) { const hint = e.data.suggestions?.length ? ` Did you mean: ${e.data.suggestions.join(", ")}?` : "" // altimate_change — explain a missing Anthropic provider - const guidance = modelNotFoundHint(e.data.providerID, e.data.suggestions) + const guidance = modelNotFoundHint(e.data.providerID, e.data.providerMissing) Bus.publish(Session.Event.Error, { sessionID, error: new NamedError.Unknown({ @@ -4886,7 +4886,7 @@ NOTE: At any point in time through this workflow you should feel free to ask the const { providerID, modelID, suggestions } = e.data const hint = suggestions?.length ? ` Did you mean: ${suggestions.join(", ")}?` : "" // altimate_change — explain a missing Anthropic provider - const guidance = modelNotFoundHint(providerID, suggestions) + const guidance = modelNotFoundHint(providerID, e.data.providerMissing) Bus.publish(Session.Event.Error, { sessionID: input.sessionID, error: new NamedError.Unknown({ diff --git a/packages/opencode/test/cli/error.test.ts b/packages/opencode/test/cli/error.test.ts index 9ce674b398..72d441464a 100644 --- a/packages/opencode/test/cli/error.test.ts +++ b/packages/opencode/test/cli/error.test.ts @@ -83,16 +83,28 @@ describe("cli.error", () => { test("a missing Anthropic provider says how to connect a Claude plan", () => { // 0.12.11 removed the Claude Pro/Max sign-in, so a saved `anthropic/...` model with only that login - // no longer resolves; the provider is missing, so there is nothing to suggest. + // no longer resolves. Suggestions for a missing provider are other provider names, so they do not hide it. const output = FormatError({ name: "ProviderModelNotFoundError", - data: { providerID: "anthropic", modelID: "claude-sonnet-4-6", suggestions: [] }, + data: { + providerID: "anthropic", + modelID: "claude-sonnet-4-6", + suggestions: ["altimate-backend"], + providerMissing: true, + }, }) expect(output).toContain("run /connect and pick Claude subscription") + // An Anthropic provider that is there with an unknown model name gets no key advice. + expect( + FormatError({ + name: "ProviderModelNotFoundError", + data: { providerID: "anthropic", modelID: "gpt-4", suggestions: [] }, + }), + ).not.toContain("Claude subscription") expect( FormatError({ name: "ProviderModelNotFoundError", - data: { providerID: "openai", modelID: "gpt-x", suggestions: [] }, + data: { providerID: "openai", modelID: "gpt-x", suggestions: [], providerMissing: true }, }), ).not.toContain("Claude subscription") }) diff --git a/packages/opencode/test/skill/release-v0.12.11-adversarial.test.ts b/packages/opencode/test/skill/release-v0.12.11-adversarial.test.ts index 1b1c90e1ba..a0f91f69ae 100644 --- a/packages/opencode/test/skill/release-v0.12.11-adversarial.test.ts +++ b/packages/opencode/test/skill/release-v0.12.11-adversarial.test.ts @@ -92,14 +92,18 @@ describe("v0.12.11: subscription detection against hostile login files", () => { expect(JSON.stringify(result)).not.toContain("secret-") }) - test("a symlinked credentials file counts, and its target's contents never appear", async () => { - const outside = path.join(root, "outside.json") - await fs.writeFile(outside, JSON.stringify({ claudeAiOauth: { accessToken: "sk-ant-oat-leak" } })) - await fs.symlink(outside, path.join(root, "claude/.credentials.json")) - const result = await scan() - expect(result.found).toEqual([{ subscription: "claude", source: "claude-code" }]) - expect(JSON.stringify(result)).not.toContain("sk-ant-oat-leak") - }) + // Creating a symlink on Windows needs Developer Mode or elevation. + test.skipIf(process.platform === "win32")( + "a symlinked credentials file counts, and its target's contents never appear", + async () => { + const outside = path.join(root, "outside.json") + await fs.writeFile(outside, JSON.stringify({ claudeAiOauth: { accessToken: "sk-ant-oat-leak" } })) + await fs.symlink(outside, path.join(root, "claude/.credentials.json")) + const result = await scan() + expect(result.found).toEqual([{ subscription: "claude", source: "claude-code" }]) + expect(JSON.stringify(result)).not.toContain("sk-ant-oat-leak") + }, + ) test("only a saved Anthropic OAuth login is flagged as the removed sign-in", async () => { await Auth.set("anthropic", { type: "api", key: "sk-ant-api-not-oauth" }) @@ -123,18 +127,27 @@ describe("v0.12.11: subscription detection against hostile login files", () => { }) describe("v0.12.11: the Model not found hint for a missing Anthropic provider", () => { - test("shows only for the anthropic provider with nothing to suggest", () => { - expect(modelNotFoundHint("anthropic")).toContain("/connect and pick Claude subscription") - expect(modelNotFoundHint("anthropic", [])).toContain("Claude subscription") + test("shows only when the anthropic provider itself is missing", () => { + expect(modelNotFoundHint("anthropic", true)).toContain("/connect and pick Claude subscription") }) - test("a likely model typo (suggestions present) gets no hint", () => { - expect(modelNotFoundHint("anthropic", ["claude-sonnet-4-6"])).toBeUndefined() + test("an Anthropic provider that is there, with an unknown model, gets no hint", () => { + expect(modelNotFoundHint("anthropic", false)).toBeUndefined() + expect(modelNotFoundHint("anthropic", undefined)).toBeUndefined() }) test("other or malformed provider ids get no hint", () => { - for (const id of [undefined, "", "Anthropic", " anthropic", "anthropic ", "claude-agent", "openai", "anthropic/claude"]) - expect(modelNotFoundHint(id, [])).toBeUndefined() + for (const id of [ + undefined, + "", + "Anthropic", + " anthropic", + "anthropic ", + "claude-agent", + "openai", + "anthropic/claude", + ]) + expect(modelNotFoundHint(id, true)).toBeUndefined() }) }) @@ -179,7 +192,10 @@ describe("v0.12.11: source guards", () => { test("removing a workspace request asks again, opening on No", async () => { const rules = await read("plugin/tui/altimate/rules.tsx") - const confirm = rules.slice(rules.indexOf("function confirmRemove"), rules.indexOf("async function runRequestAction")) + const confirm = rules.slice( + rules.indexOf("function confirmRemove"), + rules.indexOf("async function runRequestAction"), + ) expect(confirm).toContain('current="no"') expect(confirm).toContain('runRequestAction(api, request, what, "remove")') }) diff --git a/packages/tui/src/component/dialog-provider.tsx b/packages/tui/src/component/dialog-provider.tsx index a5981caa39..7d713717d4 100644 --- a/packages/tui/src/component/dialog-provider.tsx +++ b/packages/tui/src/component/dialog-provider.tsx @@ -458,16 +458,16 @@ function AutoMethod(props: AutoMethodProps) { if (result.error) { // altimate_change — surface the failure instead of clearing silently. The // precise reason is also logged server-side by the plugin callback. - toast.show({ - variant: "error", - message: - "name" in result.error && result.error.name === "ProviderAuthOauthCallbackFailed" - ? // A Claude subscription waits for a Claude Code login instead of running an OAuth flow. - props.providerID === "claude-agent" - ? "No Claude Code login was found. Run `claude auth login` in a terminal (Claude Code 2.1.296 or later, see `claude --version`), then /connect again." - : "OAuth authorization failed. Try /connect again." - : JSON.stringify(result.error), - }) + let message = JSON.stringify(result.error) + if ("name" in result.error && result.error.name === "ProviderAuthOauthCallbackFailed") { + // A Claude subscription waits for a Claude Code login instead of running an OAuth flow, and the + // check also fails when `claude` cannot start or reach Anthropic. + message = + props.providerID === "claude-agent" + ? "No Claude Code login was found, or Claude Code could not start. Run `claude auth login` in a terminal (Claude Code 2.1.296 or later, see `claude --version`). If you are logged in, check the network and any proxy (HTTPS_PROXY) or custom CA (NODE_EXTRA_CA_CERTS), then /connect again." + : "OAuth authorization failed. Try /connect again." + } + toast.show({ variant: "error", message }) dialog.clear() return } From ec026a5d3ffe425a3019374b43c4b9d9120ee965 Mon Sep 17 00:00:00 2001 From: Haider Date: Mon, 16 Nov 2026 09:01:45 +0530 Subject: [PATCH 3/3] fix: the `run --model` precheck marks a missing provider for the Anthropic hint The precheck in `run.ts` throws `ProviderModelNotFoundError` itself when the provider is absent, without `providerMissing`, so after the previous commit it lost the Claude-plan hint. It now sets `providerMissing: !provider`. `FormatError` builds the hint as a plain conditional. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01XM3J9mB75wZRnzTSGcW2kc --- packages/opencode/src/cli/cmd/run.ts | 1 + packages/opencode/src/cli/error.ts | 11 +++++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/opencode/src/cli/cmd/run.ts b/packages/opencode/src/cli/cmd/run.ts index f6208dbbb5..39ec739b81 100644 --- a/packages/opencode/src/cli/cmd/run.ts +++ b/packages/opencode/src/cli/cmd/run.ts @@ -695,6 +695,7 @@ You are speaking to a non-technical business executive. Follow these rules stric providerID: parsed.providerID, modelID: parsed.modelID, suggestions: provider ? Object.keys(provider.models).slice(0, 5) : [], + providerMissing: !provider, }) } } diff --git a/packages/opencode/src/cli/error.ts b/packages/opencode/src/cli/error.ts index a447c7b63e..8922169782 100644 --- a/packages/opencode/src/cli/error.ts +++ b/packages/opencode/src/cli/error.ts @@ -66,15 +66,14 @@ export function FormatError(input: unknown): string | undefined { ? providerModelNotFound.suggestions.filter((x) => typeof x === "string") : [] // altimate_change start — upstream_fix: branding regressions in user-visible error strings + const hint = modelNotFoundHint( + stringField(providerModelNotFound, "providerID"), + providerModelNotFound.providerMissing === true, + ) return [ `Model not found: ${stringField(providerModelNotFound, "providerID")}/${stringField(providerModelNotFound, "modelID")}`, ...(suggestions.length ? ["Did you mean: " + suggestions.join(", ")] : []), - ...[ - modelNotFoundHint( - stringField(providerModelNotFound, "providerID"), - providerModelNotFound.providerMissing === true, - ), - ].filter((x): x is string => !!x), + ...(hint ? [hint] : []), `Try: \`altimate models\` to list available models`, `Or check your config (altimate-code.json) provider/model names`, ].join("\n")