Skip to content

Commit d965a24

Browse files
Merge origin/main into fix/serve-session-traces
Resolves the worker.ts conflict from main's trace-data-loss work (#895, #901-905), which landed in parallel with this branch's trace extraction. Both lines of work fix the same class of bug (traces losing data / being clobbered) from different angles: - this branch: extract the worker's inline event→trace logic into a shared TraceConsumer and wire it into `altimate serve`, so the VS Code chat panel (headless serve) writes traces at all (AI-6950). - main #895+: stop finalizing on session.status=idle (idle fires every turn, not at session end), rehydrate-from-disk on cache-miss re-creation, and a streamGeneration guard against concurrent stream teardown. Resolution: main's superior logic is the source of truth. The shared TraceConsumer is now a faithful 1:1 port of main's *current* worker logic (no idle finalize, rehydrateFromFile, streamGeneration guard, logUserMessage / setPrompt-vs-setTitle split, synthetic/ignored skip). The worker delegates to it; `serve` subscribes to it. This branch's earlier 2s grace-window heuristic is dropped entirely — main's rehydrate-on-cache-miss is the deterministic fix it was a stand-in for. Source-grep regression guards that asserted the trace logic lived in worker.ts are repointed at trace-consumer.ts (worker-trace-clearing, tracing-followups #902, bridge-merge-invariants), with the guard intent preserved. Verified: typecheck clean; trace-consumer, worker-trace-clearing, tracing-*, and bridge-merge-invariants suites all green; host-level `serve` smoke test writes a rich 42KB trace (session/user-message/generation spans).
2 parents 9fb60d9 + 5ffeadb commit d965a24

43 files changed

Lines changed: 3258 additions & 373 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎CHANGELOG.md‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,41 @@ 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.8.5] - 2026-06-06
9+
10+
### Fixed
11+
12+
- **The `github/review` composite action can be downloaded by GitHub Actions again.** The release tree contained three VS Code image symlinks whose removed targets caused GitHub's action downloader to reject the entire archive before the review step started. The images are now self-contained files and a release-critical test prevents dangling links from returning.
13+
- **A valid dbt manifest is no longer mislabeled as a lint-only run.** Manifest availability is now checked independently from changed-model lookup, so new models and other valid manifests receive the correct full-run status.
14+
- **The release-version lookup is rate-limit resilient and never caches a floating `latest`.** The composite action now authenticates its GitHub release-API call with the workflow token (lifting the 60→1,000 req/hr unauthenticated limit) and skips the binary cache entirely when the version resolves to `latest`, so a single rate-limited or offline lookup can no longer pin a stale binary across all subsequent runs.
15+
- **Session traces survive worker restarts, concurrency, and long sessions without corruption or false alarms.** Three reliability follow-ups to the v0.8.4 trace-durability fix: reconstructed in-flight spans are marked `interrupted` and render with an amber "⚠" instead of red (and are excluded from the session error count) so a restart isn't misread as a failure (#901); `getOrCreateTrace` no longer resurrects a `Trace` into a cache that a concurrent stream switch already cleared, preventing an orphan writer under a dead stream (#902); and the on-disk `ses_<id>.json` projection is bounded to `MAX_SERIALIZED_SPANS` (default 5000, override via `ALTIMATE_TRACE_MAX_SPANS`), keeping head + tail and eliding the middle so long sessions no longer grow the file without bound or pay O(n²) write cost (#903).
16+
17+
### Added
18+
19+
- **Direct GitHub onboarding and a live dbt review demo.** The GitHub App installer now opens GitHub's repository-selection screen directly, and the README/docs link to the public `dbt-pr-review-demo` pull requests.
20+
21+
### Security
22+
23+
- **The hosted Altimate API key is no longer placed on the `jq` process arg list.** The credential write reads the key from the environment inside the `jq` program, keeping it out of `argv` (which is visible to other processes and printed verbatim when `ACTIONS_STEP_DEBUG` enables `set -x`).
24+
25+
## [0.8.4] - 2026-06-05
26+
27+
A trace-durability patch. Open `/traces` mid-session and you'd see a rich waterfall — then the moment the agent finished its turn the view collapsed to a single "system-prompt" span, the Summary tab's *"What was asked"* showed *"No prompt recorded"*, and the Chat tab dropped every user turn but the last. The data was genuinely gone from disk, not just hidden in the viewer. This release stops the on-disk trace from being overwritten after each turn and makes the file authoritative across worker restarts. A five-persona pre-release review drove a follow-up wording fix so a reconstructed trace isn't misread as a failed run.
28+
29+
### Fixed
30+
31+
- **Session traces no longer lose their data after every agent turn — the waterfall, summary prompt, and chat tab all stay intact.** A `session.status === "idle"` handler in the shared TUI worker fired once *per turn* (not once per session), ending the `Trace` and evicting it from cache; the next event reconstructed a fresh `Trace` whose near-empty initial state overwrote the rich `ses_<id>.json` on disk with a one-span file. Symptoms: the **Waterfall** collapsed to a lone "system-prompt" span, the **Summary** tab's *"What was asked"* went to *"No prompt recorded"*, and the **Chat** tab kept only the last user turn. The destructive idle handler is removed (sessions are long-lived — finalization happens on shutdown and `MAX_TRACES` eviction only), trace reconstruction now **rehydrates from the on-disk file** before falling back to a fresh start, and each user prompt is recorded as its own `user-message` span so multi-turn sessions render every turn in order. Authored-text scoping keeps synthetic parts (MCP banners, decoded file contents, reminders) out of the prompt and chat surfaces. Distinct from the v0.8.1 trace-corruption fix (#865), which addressed intra-instance concurrency — this is the worker-level cache lifecycle. (#895)
32+
- **A trace reconstructed after a restart no longer reads as a failed run.** When the on-disk trace is rehydrated (worker restart or `MAX_TRACES` eviction), any generation span still in flight is closed and marked so its boundary stays visible in the waterfall. The status message now states plainly that altimate-code restarted before the step finished recording and that this is **not an agent failure** — so an on-call reader debugging from a trace isn't sent chasing a phantom incident. (#895)
33+
34+
## [0.8.3] - 2026-06-04
35+
36+
A plan-mode reliability patch for the hosted gateway and other non-Anthropic models. Ask the `plan` agent to plan something benign — *"plan a feature to add a verify-output button"* — on `altimate-backend/altimate-default` (GPT-5.x) and it could refuse outright with *"I'm sorry, but I cannot assist with that request."* This release fixes the refusal at its source, hardens the fix against prompt-injection, and rewrites a warning that was misdiagnosing the symptom.
37+
38+
### Fixed
39+
40+
- **Plan mode no longer refuses benign requests on `altimate-default` and other non-Anthropic models.** The root cause was *how* altimate-code delivers its own plan instructions: a `<system-reminder>`-wrapped block attached as user-role text. Claude is trained to read that tag as authoritative system guidance, but GPT-5.x, Gemini, and other non-Anthropic models pattern-matched the same block — carrying `STRICTLY FORBIDDEN` / `ZERO exceptions` / `MUST` language — as a **prompt-injection attempt** and declined, returning *"I'm sorry, but I cannot assist with that request."* for ordinary developer tasks. altimate-code now **hoists those self-injected reminders into proper `role:"system"` messages** for non-Anthropic models, so they arrive as instructions rather than suspect user input; Anthropic models are unchanged. The hoist is scoped by **provenance** to altimate-code's own reminder parts — user-supplied files, MCP-resource bodies, and `data:`-URL content can never gain system-role priority, even when they begin with `<system-reminder>`. Gateway models are routed by `model.family` (via a shared `familyVendor` classifier) so a Claude- or Gemini-backed gateway model lands on the right base prompt instead of an Anthropic-style fallback. (#887, #888)
41+
- **The "plan agent used no tools" warning is accurate — and no longer false-fires.** Previously the warning blamed the model's *tool-use capability* (misleading — these models are fully tool-capable) and could fire on the final text-only step of a **successful** multi-step plan session, making a working session look broken. The trip-wire now scans the conversation history for prior tool calls, so a session that already explored the codebase isn't flagged. When it does fire, the copy describes the observed symptom only ("stopped without calling any tools"), lists the likely causes, and offers concrete recoveries — ask it to investigate first, rephrase, or, if it keeps refusing, `/model` to a tier more eager to explore. The plan agent is also now instructed to **read or search the codebase before drafting** any plan, with an explicit escape hatch for trivial, fully-specified changes. See [Plan mode](https://docs.altimate.sh/data-engineering/agent-modes/#plan) and [Troubleshooting](https://docs.altimate.sh/reference/troubleshooting/). (#888)
42+
843
## [0.8.2] - 2026-06-03
944

1045
A small correctness patch. The dbt PR reviewer's deterministic engine never required an altimate API key — but two tool descriptions said it did, which could push the reviewer into lint-only mode and send users chasing a key they don't need. This release corrects that and documents what "lint-only" actually means.

‎README.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ into CI pipelines and orchestration DAGs. Precision data tooling for any LLM.
1717
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](./LICENSE)
1818
[![Slack](https://img.shields.io/badge/Slack-Join%20Community-4A154B?logo=slack)](https://altimate.studio/join-agentic-data-engineering-slack)
1919
[![Docs](https://img.shields.io/badge/docs-docs.altimate.sh-blue)](https://docs.altimate.sh)
20+
[![Install GitHub App](https://img.shields.io/badge/GitHub-Install%20App-24292f?logo=github)](https://github.com/apps/altimate-code-agent/installations/new)
21+
[![Live dbt review](https://img.shields.io/badge/dbt-Live%20PR%20Demo-ff694b?logo=dbt)](https://github.com/AltimateAI/dbt-pr-review-demo/pulls)
2022

2123
</div>
2224

@@ -36,6 +38,12 @@ curl -fsSL https://www.altimate.sh/install | bash
3638

3739
The curl install drops a single self-contained binary named `altimate`. The npm install exposes both `altimate` and `altimate-code` on PATH; the curl install only exposes `altimate`. Alpine Linux (musl) and Windows on ARM64 are not currently supported by the standalone binary — use `apk add gcompat` on Alpine, or use WSL on Windows-on-ARM.
3840

41+
For GitHub, [install the Altimate Code App](https://github.com/apps/altimate-code-agent/installations/new)
42+
to select repositories for interactive agent tasks. Automatic dbt pull-request
43+
reviews use the deterministic GitHub Action documented below; see the
44+
[public demo PRs](https://github.com/AltimateAI/dbt-pr-review-demo/pulls) before
45+
installing it in your own repository.
46+
3947
Then — in order:
4048

4149
**Step 1: Configure your LLM provider** (required before anything works):

‎docs/docs/data-engineering/agent-modes.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ altimate --agent plan
142142

143143
Plan mode restricts the agent to reading files and editing plan files only. No SQL, no bash, no file modifications. Use this to outline an approach before switching to builder to execute it.
144144

145+
The plan agent investigates the repo before drafting: it makes at least one read-only call (`read`/`grep`/`glob`/`explore`) to ground the plan in your actual code, rather than guessing from the prompt alone. For a genuinely trivial, fully-specified change it will say so and skip straight to the plan.
146+
145147
### Two-step workflow
146148

147149
Plan mode uses a two-step approach to keep you in control:

‎docs/docs/reference/troubleshooting.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,15 @@ As of v0.7.1, altimate-code surfaces the **inner provider message** instead of d
125125
```
126126
3. No Python installation is required. All tools run natively in TypeScript.
127127

128+
### Plan mode refuses a benign request, or stops without exploring
129+
130+
**Symptoms:** In plan mode (`--agent plan`), the agent replies *"I'm sorry, but I cannot assist with that request"* to an ordinary planning ask, or you see the warning *"the `plan` agent … stopped without calling any tools."* Most common on the hosted `altimate-default` model (and other non-Anthropic models).
131+
132+
**Solutions:**
133+
134+
1. **Upgrade to v0.8.3 or later.** This was a known bug: altimate-code's internal plan instructions were delivered in a way that non-Anthropic models (GPT-5.x, Gemini, …) could mistake for a prompt-injection attempt and refuse. v0.8.3 delivers them as proper system-role messages, eliminating the refusal.
135+
2. If you still see the agent stop without exploring, follow the in-product warning's recoveries: reply asking it to investigate first (`read`/`grep`/`glob`/`explore`), rephrase the request more concretely, or — if it keeps refusing — `/model` to a tier more eager to explore (e.g. Claude Sonnet/Opus).
136+
128137
### Warehouse Connection Failed
129138

130139
**Symptoms:** "Connection refused", authentication errors, or "No warehouse configured".

‎docs/docs/usage/dbt-pr-review.md‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# dbt PR Review
22

3+
[**See live review PRs**](https://github.com/AltimateAI/dbt-pr-review-demo/pulls)
4+
·
5+
[**Install the GitHub App**](https://github.com/apps/altimate-code-agent/installations/new)
6+
7+
The public demo is a zero-secret DuckDB project with open PRs for broken joins,
8+
removed tests, PII exposure, `SELECT *`, unsafe incremental models, and a safe
9+
refactor. The GitHub App handles interactive repository tasks; the automatic
10+
review on every pull request is installed with the Action below.
11+
312
AI code review specialized for dbt/SQL. `dbt-pr-review` produces a single,
413
**signed** verdict on a pull request — `APPROVE`, `COMMENT`, or `REQUEST_CHANGES`
514
— where every **blocking** finding is backed by a deterministic engine call, not
@@ -172,7 +181,7 @@ jobs:
172181
with: { fetch-depth: 0 }
173182
# Produce target/manifest.json for the full verdict (adapter-specific).
174183
- run: pip install dbt-core dbt-bigquery && dbt deps && dbt compile
175-
- uses: AltimateAI/altimate-code/github/review@v1
184+
- uses: AltimateAI/altimate-code/github/review@v0.8.5
176185
with:
177186
mode: comment # `gate` to block merges
178187
manifest_path: target/manifest.json
@@ -270,7 +279,7 @@ In GitHub Actions, supply the connection from a secret — both sides of the dif
270279
run against the **same** warehouse (base-compiled vs head-compiled SQL):
271280

272281
```yaml
273-
- uses: AltimateAI/altimate-code/github/review@v1
282+
- uses: AltimateAI/altimate-code/github/review@v0.8.5
274283
with:
275284
mode: comment
276285
manifest_path: target/manifest.json

‎github/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ This will walk you through installing the GitHub app, creating the workflow, and
6060

6161
### Manual Setup
6262

63-
1. Install the GitHub app https://github.com/apps/altimate-code-agent. Make sure it is installed on the target repository.
63+
1. [Install the GitHub app](https://github.com/apps/altimate-code-agent/installations/new) and select the target repository.
6464
2. Add the following workflow file to `.github/workflows/altimate-code.yml` in your repo. Set the appropriate `model` and required API keys in `env`.
6565

6666
```yml

‎github/review/action.yml‎

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,38 @@ runs:
5757
- name: Get altimate-code version
5858
id: version
5959
shell: bash
60+
env:
61+
ACTION_REF: ${{ github.action_ref }}
62+
# Authenticated API calls lift the unauthenticated 60 req/hr IP limit to
63+
# 1,000 req/hr, so a busy org's runners don't get rate-limited into the
64+
# "latest" fallback below.
65+
GITHUB_TOKEN: ${{ github.token }}
6066
run: |
61-
VERSION=$(curl -sf https://api.github.com/repos/AltimateAI/altimate-code/releases/latest | grep -o '"tag_name": *"[^"]*"' | cut -d'"' -f4)
62-
VERSION="${VERSION#v}" # the installer's --version expects no leading 'v'
67+
set -euo pipefail
68+
if [[ "${ACTION_REF:-}" =~ ^v?([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
69+
VERSION="${BASH_REMATCH[1]}"
70+
else
71+
# Only attach the auth header when a token is present; the
72+
# ${AUTH[@]+"${AUTH[@]}"} idiom expands to nothing on an empty array
73+
# even under `set -u` (portable back to bash 3.2).
74+
AUTH=()
75+
[[ -n "${GITHUB_TOKEN:-}" ]] && AUTH=(-H "Authorization: Bearer ${GITHUB_TOKEN}")
76+
VERSION=$(
77+
curl -sf --connect-timeout 5 --max-time 15 ${AUTH[@]+"${AUTH[@]}"} \
78+
https://api.github.com/repos/AltimateAI/altimate-code/releases/latest \
79+
| grep -o '"tag_name": *"[^"]*"' | cut -d'"' -f4 || true
80+
)
81+
VERSION="${VERSION#v}" # the installer's --version expects no leading 'v'
82+
fi
6383
echo "version=${VERSION:-latest}" >> $GITHUB_OUTPUT
6484
6585
- name: Cache altimate-code
6686
id: cache
87+
# Never cache against the floating "latest" key: a single rate-limited or
88+
# offline lookup would otherwise pin whatever binary it grabbed and reuse
89+
# it forever, silently ignoring later releases. A resolved semver caches
90+
# normally; "latest" falls through to a fresh install each run.
91+
if: steps.version.outputs.version != 'latest'
6792
uses: actions/cache@v4
6893
with:
6994
path: ~/.altimate/bin
@@ -107,12 +132,15 @@ runs:
107132
echo "::error::altimate_api_key is set but altimate_instance is empty — provide the tenant/instance name."
108133
exit 1
109134
fi
135+
umask 077
110136
mkdir -p "$HOME/.altimate"
137+
# Read the API key from the environment inside the jq program rather
138+
# than passing it via --arg: argv is visible to other processes and
139+
# is printed verbatim if a user enables ACTIONS_STEP_DEBUG (set -x).
111140
jq -nc \
112141
--arg url "${IN_ALT_URL:-https://api.myaltimate.com}" \
113142
--arg inst "$IN_ALT_INSTANCE" \
114-
--arg key "$IN_ALT_KEY" \
115-
'{altimateUrl:$url, altimateInstanceName:$inst, altimateApiKey:$key}' \
143+
'{altimateUrl:$url, altimateInstanceName:$inst, altimateApiKey:$ENV.IN_ALT_KEY}' \
116144
> "$HOME/.altimate/altimate.json"
117145
echo "Advisory lane: hosted altimate model (tenant: $IN_ALT_INSTANCE)."
118146
elif [[ -n "${IN_MODEL:-}" ]]; then

‎github/review/examples/altimate-ingestion.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
- name: altimate dbt PR review
6565
# Pin to the altimate-code release that ships `altimate review`
6666
# (the first release cut after the dbt-pr-review feature merges).
67-
uses: AltimateAI/altimate-code/github/[email protected].0
67+
uses: AltimateAI/altimate-code/github/[email protected].5
6868
with:
6969
mode: comment # start non-blocking; switch to `gate` once trusted
7070
manifest_path: target/manifest.json

0 commit comments

Comments
 (0)