From 96ac7661eecc35776e656b5d4fa6f9e322bd1a5f Mon Sep 17 00:00:00 2001 From: Haider Date: Mon, 30 Nov 2026 05:46:43 +0530 Subject: [PATCH 1/3] feat(debug): `debug bundle` reports config, credentials, sessions and runtime health; add `debug probe` `debug bundle` was shaped by the Snowflake hang case and could not answer the "new sessions keep the placeholder title" report. It now records shape, never content, from local reads only, and still starts no project instance. New report sections: - Configuration: config files in merge order (parsed and validated with the loader's own `parseText` and `validateLoaded`), `model` and `small_model` with the file that set each, the last model picked, on/off settings, the permission mode (command patterns only counted), plugin names, skill folders with counts, rules files, the git root or no-project sentinel. - Credentials: per provider, where a credential was found (`auth.json` type, env var name, config `apiKey`) and OAuth expiry. No values. - Workspace: link and link method, sync status, last success and error class, read without `readLocalBinding` (it migrates the cache on read). - Runtime health: Bun and Node versions, whether `@altimateai/altimate-core`, `@parcel/watcher` and DuckDB load, log, database and cache sizes, free disk, and the newer release cached in `kv.json`. - Sessions, last 14 days, from a read-only `bun:sqlite` connection: counts, placeholder titles, error endings, median time to first output, failed replies by error class and HTTP status. - Telemetry machine id and the last non-debug launch id. New findings: small-model failures (titles, prompt enhancement) by model and error, rejected provider sign-ins, repeated reply failures, config files the loader rejects, native modules that do not load, low disk, expired sign-ins, failing workspace sync. `Log.create` writes to stderr only, so title and prompt-enhancement failures never reached `opencode.log`. Both now also write a `small model call failed` line through `fileLog` with class, kind and status, no message text. The startup line carries `launch`. `altimate-code debug probe` sends one tool-less request to the chat model and to the small model resolved as the title request resolves it, and prints model, status, latency and error class, never reply text. Also fixed: - `debug` runs are no longer counted as app starts. - Quoted log values are unescaped when parsed back. - The TUI worker's console log goes to `altimate-code/log`, not `opencode/log`. - `getSmallModel` runs the `experimental.provider.small_model` hook again (dropped in the Promise rewrite), so Copilot's utility title model is used. Docs: troubleshooting "Debug report", "Testing the models" and "Model catalogue" sections; CLI reference mentions `debug probe`. Co-Authored-By: Claude Opus 5.5 --- docs/docs/reference/troubleshooting.md | 37 +- docs/docs/usage/cli.md | 2 +- .../opencode/src/altimate/debug/collect.ts | 58 ++- .../src/altimate/debug/config-facts.ts | 339 +++++++++++++++ .../src/altimate/debug/credential-facts.ts | 88 ++++ packages/opencode/src/altimate/debug/probe.ts | 168 ++++++++ .../opencode/src/altimate/debug/report.ts | 401 +++++++++++++++++- .../src/altimate/debug/runtime-facts.ts | 151 +++++++ .../src/altimate/debug/session-stats.ts | 121 ++++++ .../src/altimate/debug/small-model-log.ts | 59 +++ .../src/altimate/debug/workspace-facts.ts | 55 +++ .../opencode/src/altimate/enhance-prompt.ts | 20 +- packages/opencode/src/cli/cmd/debug/index.ts | 6 +- packages/opencode/src/cli/cmd/debug/probe.ts | 20 + .../src/cli/tui/worker-console-guard.ts | 5 +- packages/opencode/src/index.ts | 7 +- packages/opencode/src/provider/provider.ts | 16 + packages/opencode/src/session/prompt.ts | 12 + .../test/altimate/debug/facts.test.ts | 374 ++++++++++++++++ .../test/altimate/debug/report.test.ts | 170 ++++++++ .../opencode/test/provider/provider.test.ts | 33 ++ .../opencode/test/session/title-retry.test.ts | 17 + .../test/upstream/fork-feature-guards.test.ts | 2 + 23 files changed, 2145 insertions(+), 16 deletions(-) create mode 100644 packages/opencode/src/altimate/debug/config-facts.ts create mode 100644 packages/opencode/src/altimate/debug/credential-facts.ts create mode 100644 packages/opencode/src/altimate/debug/probe.ts create mode 100644 packages/opencode/src/altimate/debug/runtime-facts.ts create mode 100644 packages/opencode/src/altimate/debug/session-stats.ts create mode 100644 packages/opencode/src/altimate/debug/small-model-log.ts create mode 100644 packages/opencode/src/altimate/debug/workspace-facts.ts create mode 100644 packages/opencode/src/cli/cmd/debug/probe.ts create mode 100644 packages/opencode/test/altimate/debug/facts.test.ts diff --git a/docs/docs/reference/troubleshooting.md b/docs/docs/reference/troubleshooting.md index 587f5e487c..98d9ef5298 100644 --- a/docs/docs/reference/troubleshooting.md +++ b/docs/docs/reference/troubleshooting.md @@ -86,6 +86,8 @@ Enable verbose logging: altimate --print-logs --log-level DEBUG ``` +To send a problem to Altimate support, a [debug report](#debug-report) is usually more useful than the raw logs: it summarizes the log and adds your configuration, credentials (presence only), session statistics and runtime health. + ## Common Issues ### Provider Connection Failed @@ -257,16 +259,47 @@ $env:ALTIMATE_DEBUG = "1"; altimate In debug mode the log records every tool call as it starts and ends, and while one is running, a line every 15 seconds naming what is still in progress. Lines are written as they happen, so if Altimate Code hangs or closes, the log still shows what it was doing. -**2. Create the report** after the problem has happened: +**2. Create the report** after the problem has happened. See [Debug report](#debug-report) below. + +### Debug report ```bash altimate debug bundle ``` -This writes `altimate-debug-report-