Skip to content

feat: /savings, a Databricks savings check beside the chat (1.9.0) - #35

Open
shreyastelkar wants to merge 65 commits into
mainfrom
feat/savings-via-altimate-code
Open

shreyastelkar wants to merge 65 commits into
mainfrom
feat/savings-via-altimate-code

Conversation

@shreyastelkar

@shreyastelkar shreyastelkar commented Nov 18, 2026 •

Copy link
Copy Markdown

Summary (for people)

Why: this gives a Databricks user a reason to try Altimate from inside Claude Code. It shows what their workspace could save, on their own machine, with nothing sent to Altimate.

Before → after:

  • Before (plugin 1.8.2, current main): /savings is not a command. Claude Code answers "No commands match /savings".
  • After (plugin 1.9.0): /savings [connection] runs altimate-code's finops_databricks_savings tool and opens a pane beside the chat with each finding, its evidence, a monthly range at list price and a Draft the fix button.

Who is affected: only people who type /savings. It needs an altimate-code release that has the tool and assessment mode (see Depends on). With an older CLI the pane says to update, and nothing runs on the warehouse.

Also changed for everyone with the plugin: the shell reader the git push check uses moves unchanged to its own module, hooks/shell.ts, so /savings can share it. The push check still reads a shell's -c script exactly as on main.

Not tracked: main now sends anonymous plugin usage events, one per session start and one each time a panel or command opens. /savings sends none: neither the command, its buttons nor its pane is counted, so its "Nothing was sent to Altimate" line stays exactly true. README and PRIVACY say so.

Details (for agents/reviewers)

What the pane does

  • The result. Each finding shows what it rests on, and a monthly range at list price. The total counts each resource once.
  • Every workspace. One connection covers every workspace the account's system tables show. The pane counts every workspace the CLI read facts from, through its workspaces_checked field: a workspace with only clusters or jobs and no finding counts too. It names each finding's workspace when there are several. With a CLI that does not report the count, it counts the workspaces of the warehouses and findings.
  • Draft the fix. Each finding has a button that puts the change in the prompt box: serverless, a smaller cluster_size, auto-termination, or a job cluster. The request asks Claude to edit the repository's bundle or Terraform. If there is none, Claude writes the JSON for a CLI command that changes only that setting: warehouses edit, clusters update with an update mask, or jobs update. Nothing is sent until the user presses Enter, and nothing is applied.
  • What if. For each flagged warehouse, the user can press serverless or any smaller size. The pane shows its monthly cost and whether its cores still cover what its queries need. A choice that would cost more says so.
  • Spend since a change. The first run that flags a warehouse remembers its size and cost on this machine, in $.store, keyed by connection, workspace and warehouse id, with the length of the window its cost covers. A later run that finds it resized shows its observed spend a month before and after the change. The two amounts are billed in different weeks, so one note under the lines says a change in workload moves them too, and the pane never calls the difference saved. Across several workspaces, a warehouse without a workspace id is not compared.
  • At the right moment. A line appears above the prompt when the session edits a Databricks bundle or Terraform file, or runs a databricks warehouses, clusters, bundle or jobs command. The Bash line is read with the shell reader the push check uses (hooks/shell.ts). Quoted text, comments and heredoc bodies are data, a shell's -c script is read, and the program is found past the same leaders (sudo -u x, nice -n 10, assignments) and past xargs with its options. So a line that only names the CLI (echo databricks bundle deploy, a commit message, a heredoc that writes a script) offers nothing. A Terraform file that is not Databricks config offers nothing either. It names the flagged resource's saving if the file mentions it. Otherwise it offers /savings once a session.
  • What it does not check is named. When a check could not run, the pane names it with the reason: a refused read, the time limit, or core refusing its facts. When none could run, it says nothing was checked, not that nothing was found. A figure the answer lacks reads "?", never "NaN", "undefined" or 0. A total missing its amounts still lists its findings, and a finding without a title reads "Savings opportunity".
  • When it fails, it says why. A missing connection, an altimate-code too old for the tool, a source or preview build, a version that cannot be read, and a refused query each get their own message and recovery step, also shown as a notice.

Cost

/savings runs three queries on the connection's SQL warehouse, which Databricks starts if it is stopped and bills while it runs. The command says so. The tool refuses to run without confirm: true, and the plugin passes it only when the person ran the command. A plugin, the SDK or a schedule gets a refusal and no run. The CLI stops its own check after nine minutes and cancels any query still on the warehouse.

Privacy

The tool runs with ALTIMATE_TELEMETRY_DISABLED=true, ALTIMATE_ASSESSMENT_MODE=true and --no-daemon, always through the CLI (the MCP server would drop both). Assessment mode (AltimateAI/altimate-code#1762) also stops the CLI's own startup contacts: the one-time telemetry opt-out event, the model catalog and the ripgrep download. The warehouse is then the only host the run reaches. A reused tool daemon would not see the opt-out, which is why the run uses --no-daemon. The plugin adds no usage event for /savings, and its skill tells Claude to ask the user to type /savings rather than call the tool itself, so the tool is not run through a path without these switches. The findings stay in the pane until the user sends a Draft the fix request. PRIVACY.md has a section for the check, a line under Plugin usage events saying /savings sends none, and a change-log entry.

Merge with main

main is merged in up to 1.8.3 and its unreleased fixes, keeping its content and versions: the dbt helpers, the plugin usage events and the /clear and health fixes. /savings ships as 1.9.0 on top, and the changelog keeps main's Unreleased section above it. The savings feature runs before the dbt helpers in every phase, each in its own try.

The shell reader (simpleCommands, leaderEnd and their helpers) moves from hooks/features/health.tsx to hooks/shell.ts, taken from main's latest version. health.tsx now differs from main only by importing it from there, so the push check and its written-files reader keep main's -c rule (any -c after the shell). One new helper, shellScript, serves only the /savings offer. It reads the script from the shell's own options (bash -cx, -o pipefail -c, -euo pipefail -c), and any word it does not take for one of them ends the scan, so the line shows no note. That covers a redirection, an option it does not know, and -oc pipefail. A missed note is the safe outcome, and each wider reading drew new mismatches. health.test.tsx passes, with a new case showing the push check still holds bash 2>/dev/null -c 'git push' and zsh --emulate sh -c 'git push'.

Validation (at 34e210d)

  • claude plugin test . in plugins/altimate-code: 1400 of 1401 pass at f1d0d16 on a clean copy; at 34e210d the savings and health files pass, 218 of 218. The one failure is main's timing test in runs.test.tsx ("a dbt call that starts while another call reads its artifact"), in a file this PR does not touch. The /savings tests use the real --json output of a full run as their fixture, with ids replaced. They cover the pane, each kind of evidence and fix request, what-if, the observed spend after a resize (both directions, never "saved"), the workspace count (a second workspace with no findings, and invalid counts), the skipped-check note, the band and the failure messages. hooks/usage.test.tsx runs /savings, Draft the fix, a what-if and Run again, and asserts no report-event call. As a control, the same fake CLI records the next counted panel. Removing the workspace count, or adding a usage event to /savings, each fails its test (checked). Tests also cover:
    • the version probe: a prerelease of the minimum, a preview or source build, no version, a timeout, a non-zero exit, a runtime note on stderr;
    • the shell-line reader: leaders, xargs options, shell -c scripts, comments, heredoc bodies, substitutions, shifts;
    • answers missing a field: a total's amounts, a finding's evidence, amounts, name or title, a what-if figure, a blank or numeric string;
    • per-workspace baselines;
    • the single press of Run again.
  • bash tests/*.sh: all 8 pass.
  • Local review script (fresh Claude reviewer, whole diff from main) after each round of fixes. Its P1s and P2s are fixed. The later wider readings of -c (a fallback for unknown options and redirections) were reverted by decision. The P2 at 1ccb810 is fixed with a test: Run again pressed in the same tick as a /clear could leave the pane on "Checking…". A /clear now drops a run it beats, whether /savings or Run again started it, and a skipped check's reason is cleaned and safe for a non-string. The remaining item is the version placeholder below. The reviews from 1ccb810 to 34e210d found no P0 or P1. A table-driven test fires /clear at each await point of a run (pane open, version probe, tool run, baseline read, baseline write) and checks that nothing is left running, no old report shows and the next /savings runs. The one P2, at 1ccb810, is fixed; the rest were P3.
  • claude plugin validate --strict . passes. claude plugin validate --strict ./plugins/altimate-code reports 6 type warnings in cost.test.tsx, runs.test.tsx, lineage-graph.ts and usage.test.tsx. All are in code from main, and an export of origin/main reports the same 6 on this Claude Code (2.1.329). tsc --noEmit against the generated plugin types shows the same 7 errors as origin/main (all in main's tests and lineage-graph.ts) and none in this PR's code.
  • Real session. A captioned recording (3 min) of an earlier head of this branch in Claude Code, from one clean run, is attached to the internal core PR https://github.com/AltimateAI/altimate-core-internal/pull/785. It covers the first run with no connection, connecting a workspace, the result and what-if, Draft the fix, a six-workspace account and an altimate-code too old for the tool. It was not re-recorded for this round's wording changes. Not recorded: Claude writing the change after Draft the fix, and the band above the prompt. Both need a model turn; tests cover the plugin's side.

Depends on

The tool and assessment mode from AltimateAI/altimate-code#1762, in a released altimate-code. That PR also adds the workspaces_checked count. /savings runs altimate --version first, which starts no telemetry. It does not start a CLI older than SAVINGS_MIN_ALTIMATE_CODE (hooks/features/savings.tsx) for the check, and says to update instead. Measured on 0.12.11 against a local telemetry listener: --version sent nothing, while tool run sent the one-time opt-out event.

The constant is 0.12.12 for now, the first version after the latest release. It is a provisional placeholder. Before this PR merges, it is set to the published release that carries the tool and assessment mode, so no release without them passes the check. Until then the PR is held.

🤖 Generated with Claude Code

shreyastelkar and others added 10 commits November 17, 2026 15:25
- `hooks/features/savings.tsx`: `/savings [connection]` runs altimate-code's
  `finops_databricks_savings` tool through `runTool` with
  `ALTIMATE_TELEMETRY_DISABLED=true` and draws the findings, evidence and
  monthly ranges in a pane beside the chat; nothing enters the conversation
- the plugin holds no detector logic: altimate-code measures the facts and
  altimate-core decides the savings
- refusals are explained with the step that fixes them: no altimate-code,
  an altimate-code without the tool, no Databricks connection, a connection
  that is not a SQL warehouse, a refused system-table query
- `runTool`/`runAltimate` take an optional environment for one CLI run
- registered in `features/index.ts` like the other features; README,
  PRIVACY, SKILL tool table, CHANGELOG, version 1.8.0

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…iew fixes

- each finding gets "Draft the fix": it fills the prompt box with the
  change to make (serverless, or the smaller `cluster_size`) for Claude to
  draft against the repo's bundle or Terraform, or as `databricks warehouses
  edit` JSON; nothing is sent until the person presses Enter
- editing a bundle, `resources/*.yml` or Terraform file, or running a
  `databricks` warehouses/clusters/bundle/jobs command, shows a band: the
  flagged warehouse's saving when the file names it, else a once-a-session
  offer of /savings; Run /savings and Hide buttons; nothing runs by itself
- the savings run uses `--no-daemon`: a reused tool daemon keeps the
  environment it started with, so the telemetry opt-out could be lost
- a non-Databricks connection and a warehouse not yet in
  `system.compute.warehouses` get their own recovery steps
- PRIVACY: change-log entry and revision date

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… saved

- reads altimate-code's combined report: idle all-purpose clusters and
  jobs on all-purpose compute beside the two warehouse checks, each with
  its own evidence lines and Draft the fix request (auto-termination, a job
  cluster), and names any check the connection could not read
- what if: each flagged warehouse gets a row of buttons (serverless and every
  smaller size, marked when too small); pressing one says what it would
  cost a month and whether its cores cover what its queries need
- saved since: the first run that flags a warehouse keeps its size, type and
  weekly cost in the local plugin store; a later run that finds it resized
  says what it cost a month then and now
- README, CHANGELOG and PRIVACY describe the four checks and the local store

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rite

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ength

- No findings with a check skipped says which checks ran, in the pane and the toast.
- Draft the fix with no prompt box says what to ask Claude, instead of pointing at text the
  pane does not show.
- The band offers /savings for any `databricks` warehouses/clusters/bundle/jobs command, also
  after `cd … &&` or an environment assignment; its Run button never starts a second run.
- A finding is named in a file only as a whole word (`dev` is not in `devices`).
- Days come from the report's window, not a fixed seven; the refused-query advice names
  `system.lakeflow`; a query cut at 10,000 rows is named in the pane (view shape bumped).
- Tests for each, including that a second run keeps the first baseline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…fers

- A what-if choice that costs more than now says how much more, in the warning colour.
- The band offers the check for Terraform only when it names a `databricks_` resource, and names a
  flagged job by its name, not its numeric id.
- The running pane says Databricks starts the SQL warehouse if it is stopped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The pane counts the workspaces it read, names each finding's workspace when there are several,
  and the fix request names it.
- A failed run also comes as a notice, for a terminal too narrow for the pane.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…no answer"

- `runTool` hands back the CLI's raw output as `raw` when it is not the answer object.
- /savings reads an old CLI's usage banner as "this altimate-code has no Databricks savings check".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kilo-code-bot

kilo-code-bot Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Incremental review of the latest commit (f1d0d16..34e210d, 2 files, 8 lines). The added generation checks after the busy-state write and after openPane are consistent: sessionEnd bumps generation before its first await, so a /clear at either point now returns the split-out cleared message, leaves no run scheduled, and the guarded atom updater preserves whatever the new session holds. The new test assertion covers the pane-open path. Nothing else in the changed lines needs action.

Files Reviewed (2 files)
  • plugins/altimate-code/hooks/features/savings.tsx
  • plugins/altimate-code/hooks/features/savings.test.tsx
Previous Review Summaries (12 snapshots, latest commit f1d0d16)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit f1d0d16)

Status: 1 Issue Found | Recommendation: Address before merge

Incremental review of 36ad2fd..f1d0d16 (1 file, 2 lines). The commit moves the "is this run still current" check inside the busyAtom write in both places that mark a run running, which closes the race where a /clear between the earlier generation check and the write left "Checking the workspace's..." set in the new conversation with no run to clear it. The guard itself is correct: sessionEnd increments generation before its first await, so an updater that applies after the clear sees live() false and preserves whatever the new session holds. One leftover follows from the write now being skippable.

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1
Issue Details (click to expand)

SUGGESTION

File Line Issue
plugins/altimate-code/hooks/features/savings.tsx 697 A /clear during the busy-flag write skips the write, but the command handler still opens the pane, schedules a run that immediately drops, and returns "Running the Databricks savings check in the side pane" for a check that never starts. Re-check generation after the update and return the dropped-run message; this race is also uncovered by the existing /clear-at-each-step test.
Files Reviewed (1 file)
  • plugins/altimate-code/hooks/features/savings.tsx - 1 suggestion

Fix these issues in Kilo Cloud

Previous review (commit 36ad2fd)

Status: No Issues Found | Recommendation: Merge

Incremental review of a35bb98..36ad2fd (2 files, 71 lines). The new commit guards every write in runCheck on the run still being current: the message/band/what-if/report updaters apply only while mine === generation, say suppresses the toast after a drop, trackChanges returns early when a /clear lands during its baseline reads, and the finally clears busyAtom only for the live run. The added live() check after clock.now() and after trackChanges covers the awaits that have no internal guard, and a dropped run still leaves busyAtom cleared by sessionEnd, so the next /savings starts. The new parameterized test drives a /clear at each await point and asserts nothing lands, no stale report renders, and the next run works; the baseline-write step correctly allows the in-flight persistent write it cannot cancel.

Files Reviewed (2 files)
  • plugins/altimate-code/hooks/features/savings.tsx
  • plugins/altimate-code/hooks/features/savings.test.tsx

Previous review (commit a35bb98)

Status: No Issues Found | Recommendation: Merge

Incremental review of 6b4f911..a35bb98 (2 files, 30 lines). Both findings from the previous round are fixed at this HEAD: at is now captured before any wait in command.run, so a /clear during the pane open or the busy read drops the run instead of landing a billable tool run in the new conversation; and the runsDatabricksCompute doc now states the split correctly (shellScript reads only the shell's own options, while the push check keeps its wider any--c rule at health.tsx:174).

The reordering holds: the generation re-check runs before busyAtom is set, the scheduled runCheck drops on a generation mismatch, and sessionEnd already clears busyAtom, so a dropped run leaves no stuck "Checking…" state. The new test drives the interleaving through an awaited ui.open handler, which the harness supports, and asserts both that the dropped run starts nothing and that the next /savings runs.

Files Reviewed (2 files)
  • plugins/altimate-code/hooks/features/savings.tsx
  • plugins/altimate-code/hooks/features/savings.test.tsx

Previous review (commit 6b4f911)

Status: 2 Issues Found | Recommendation: Address before merge

Incremental review of e15f923..6b4f911. The only change in this range is pressRun / bandLine in savings.tsx: the band press now receives a live() check, re-checks the generation after clearing the band and after reading busyAtom, and opens the pane only while live. Those checks hold (the final live() and the busyAtom write run in one continuation with no await between them, and sessionEnd already resets pressQueued), so the commit introduces no new issue. Both points below are unchanged code from the previous round, re-verified at this HEAD.

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 2
Issue Details (click to expand)

SUGGESTION

File Line Issue
plugins/altimate-code/hooks/features/savings.tsx 678 at is captured after await openPane($) in command.run, so a /clear during the open is already in at: the scheduled runCheck passes its asked === generation guard and starts the version probe and the billable tool run in the new conversation
plugins/altimate-code/hooks/features/savings.tsx 106 "as the push check reads it" overstates the match: the push check takes any -c after the shell (health.tsx:174) while shellScript reads only the shell's own options, so bash 2>/dev/null -c … is a script for the push check and not for /savings
Files Reviewed (1 file)
  • plugins/altimate-code/hooks/features/savings.tsx - 2 suggestions (both carried over; the new live() plumbing in pressRun/bandLine introduces none)

Fix these issues in Kilo Cloud

Previous review (commit e15f923)

Status: 2 Issues Found | Recommendation: Address before merge

Incremental review of 8212734..e15f923. This round restores the push check's own -c rule (pushes / filesWrittenBy scan every word after the shell, exactly as main does), so the previous round's two suggestions about shellScript no longer describe the push check. The new skipped / limited mapping is safe for non-array and non-string fields, and both /clear drop tests match the code. The two points below are on the new /savings generation gate and its documentation.

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 2
Issue Details (click to expand)

SUGGESTION

File Line Issue
plugins/altimate-code/hooks/features/savings.tsx 678 at is captured after await openPane($), so a /clear that lands while the pane opens is folded into the snapshot: the scheduled runCheck passes asked === generation and starts the version probe and the billable tool run after the clear, writing the report into the new conversation - the case the new drop rule and the runCheck doc say they prevent
plugins/altimate-code/hooks/features/savings.tsx 106 "read as a line of its own, as the push check reads it" is no longer true: the push check reads any -c after the shell (health.tsx:174) while shellScript reads only the shell's own options, so the two disagree on bash 2>/dev/null -c …, the exact form the new test pins
Files Reviewed (5 files)
  • plugins/altimate-code/hooks/shell.ts - no issues in the code; line 200 is main's heredoc rule again (a shell's -c body is not its script), and the new doc block at 22-23 states the push check's wider rule correctly
  • plugins/altimate-code/hooks/features/health.tsx - no issues; pushes and filesWrittenBy are byte-identical to the base, so the restored -c scan introduces no behaviour change against main
  • plugins/altimate-code/hooks/health.test.tsx - no issues; the new cases match the restored helpers (-cx, -eo pipefail and +o history still resolve through the plain -c word)
  • plugins/altimate-code/hooks/features/savings.tsx - 2 suggestions; the Array.isArray guards, oneLine sanitation and the runCheck / pressRun generation checks behave as the new tests describe (busyAtom cannot be left set: sessionEnd clears it after any generation bump that drops a run)
  • plugins/altimate-code/hooks/features/savings.test.tsx - no issues; the four added tests match the reader and the pane (42 reason, control characters, << none), and the /clear cases settle before the scheduled run can start

Fix these issues in Kilo Cloud

Previous review (commit 8212734)

Status: 2 Issues Found | Recommendation: Address before merge

Incremental review of e749896..8212734. This round reverts the wider -c reading back to the 4fba9456 rule, so the previous round's two suggestions no longer apply to existing code: REDIRECT_WORD and the unknown-option fallback are gone, and bash deploy.sh -c 'git push' is correctly false again. The two points below are on the new, narrower scan.

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 2
Issue Details (click to expand)

SUGGESTION

File Line Issue
plugins/altimate-code/hooks/shell.ts 27 the scan ends at the first non-option word, so a redirect target or an unknown option's value hides -c: bash 2>/dev/null -c 'git push', bash >/dev/null -c ... and zsh --emulate sh -c ... return null here, though main and the PR description count them
plugins/altimate-code/hooks/shell.ts 33 ?? null conflates "-c with no script" with "no -c", and the heredoc rule at shell.ts:199 keys on null, so bash -c <<EOF now reads the heredoc body as the shell's script
Files Reviewed (3 files)
  • plugins/altimate-code/hooks/shell.ts - 2 suggestions; the option-cluster rule (-cx, -o pipefail -c, -euo pipefail -c, +o history -c), -- handling and bash deploy.sh -c x behave as intended, and the pushes / filesWrittenBy / runsDatabricksCompute call sites are unaffected by the removed '' return except through the heredoc gate
  • plugins/altimate-code/hooks/health.test.tsx - no issues; the remaining cases match the helper and no test references the removed forms
  • plugins/altimate-code/hooks/features/savings.test.tsx - no issues; the removed lines leave no dangling coverage

Fix these issues in Kilo Cloud

Previous review (commit e749896)

Status: 2 Issues Found | Recommendation: Address before merge

Incremental review of f5867bc..e749896. Both findings from the last round are fixed: bash deploy.sh -c x, bash ./run.sh -force x and sh ./ci.sh -check x no longer count as running the script (the fallback now fires only past an unrecognised option), and a redirect before or after -c (bash 2>/dev/null -c x, bash -c >log x) is skipped, so the script bash runs is returned. The two open points are inside the new fallback and the new redirect pattern.

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 2
Issue Details (click to expand)

SUGGESTION

File Line Issue
plugins/altimate-code/hooks/shell.ts 52 the fallback's /^-[a-z]*c$/ differs from the main loop's cluster pattern, so after an unknown option zsh --emulate sh -Ec 'git push' returns null (a push missed), and the scan still runs past the first non-option word, so zsh --emulate sh deploy.sh -c 'git push' returns 'git push' though zsh runs deploy.sh
plugins/altimate-code/hooks/shell.ts 21 REDIRECT_WORD duplicates the identical literal in leaderEnd (line 259); use the constant in both so the two skip rules cannot drift
Files Reviewed (3 files)
  • plugins/altimate-code/hooks/shell.ts - 2 suggestions; the option-cluster rule (-euo pipefail, -o pipefail -c, -c with no script returning ''), -- handling and the pushes / filesWrittenBy / runsDatabricksCompute call sites behave as before on every case in the tests
  • plugins/altimate-code/hooks/health.test.tsx - no issues; the new negative cases and the redirect loop pass by inspection against simpleCommands (2>&1 becomes 2>& + 1, >/dev/null becomes > + target)
  • plugins/altimate-code/hooks/features/savings.test.tsx - no issues; the bash 2>/dev/null -c and bash deploy.sh -c cases match the helper

Fix these issues in Kilo Cloud

Previous review (commit f5867bc)

Status: 2 Issues Found | Recommendation: Address before merge

Incremental review of 90ec299..f5867bc. The new fallback does what it claims for the case it targets: an option the reader does not know (zsh --emulate sh -c x, ksh -R x -c x) no longer hides the -c, and it also repairs a redirect before -c, which the previous round flagged. Both open points are about where that fallback stops and what the strict path still returns. A -c that is an argument to the script (bash deploy.sh -c 'git push') is now read as the shell's own option, so the push gate can hold a command that never pushes; and a redirect after -c is still returned as the script, so a real push there is missed. The two identical cluster regexes in shellScript should be hoisted or kept in step.

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 2
Issue Details (click to expand)

SUGGESTION

File Line Issue
plugins/altimate-code/hooks/shell.ts 37 the fallback ignores where the shell's options end, so bash deploy.sh -c 'git push' returns 'git push' and the push gate can hold a command that never pushes; only fall back when an unrecognised option was passed
plugins/altimate-code/hooks/shell.ts 36 carried: a redirect after -c (bash -c >log 'git push', bash -c 2>/dev/null 'git push') is returned as the script, so pushes / filesWrittenBy / runsDatabricksCompute miss the script bash runs
Files Reviewed (3 files)
  • plugins/altimate-code/hooks/shell.ts - 2 suggestions; the option-cluster rule (-euo pipefail, -eo pipefail, +o history, -oc pipefail, -c with no script word returning '') is unchanged and still matches every caller's !== null check
  • plugins/altimate-code/hooks/health.test.tsx - no issues on its own; it replaces the bash deploy.sh -c negative case with the positive zsh --emulate / ksh -R cases, so the false-positive case is no longer covered
  • plugins/altimate-code/hooks/features/savings.test.tsx - no issues; the zsh --emulate sh -c case matches the helper

Fix these issues in Kilo Cloud

Previous review (commit 90ec299)

Status: 1 Issue Found | Recommendation: Address before merge

Incremental review of 4fba9456..90ec299. The new option-cluster rule is correct for the forms it targets: -euo pipefail, -eo pipefail, +o history, -oO clusters and -oc pipefail consume one word per o/O, and -c with no script word now returns '' rather than a word. The '' sentinel is safe at every call site (pushes, filesWrittenBy, runsDatabricksCompute and the heredoc reader all use !== null), so bash -c <<EOF is no longer read as running the heredoc body. The remaining gap from the previous round is unchanged: a redirect word in the option scan still ends the script lookup.

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1
Issue Details (click to expand)

SUGGESTION

File Line Issue
plugins/altimate-code/hooks/shell.ts 32 carried: the option loop only advances over -/+ words, so a redirect between the shell and its options ends the scan (bash 2>/dev/null -c 'git push' returns null), and a redirect after -c is taken as the script (bash -c >log 'git push' returns '>'). Both miss the script that bash actually runs; skip a redirect word together with its target, as leaderEnd does
Files Reviewed (4 files)
  • plugins/altimate-code/hooks/shell.ts - 1 carried suggestion; the /^[-+][A-Za-z]+$/ skip counts o/O per cluster and the '' return is handled by all four callers
  • plugins/altimate-code/hooks/health.test.tsx - no issues; the -oc, -eoc and bash -c <<EOF cases match the helper
  • plugins/altimate-code/hooks/features/savings.test.tsx - no issues; the added -oc pipefail case matches
  • plugins/altimate-code/CHANGELOG.md - no issues; the unreleased entries move under 1.9.0 without duplicating the 1.8.3 list

The rest of the incremental range is origin/main content already in the base (e36c74f), so it is outside this PR's diff and was not re-reviewed.

Previous review (commit 4fba945)

Status: 1 Issue Found | Recommendation: Address before merge

Incremental review of b60c2948..4fba9456. The shell option-cluster rule is now correct: -euo pipefail, -eo pipefail and +o history skip their value, the doc comment matches the code, and both test files cover the new forms. The gap from the previous round remains: a redirect word between the shell and -c still ends the shellScript scan.

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1
Issue Details (click to expand)

SUGGESTION

File Line Issue
plugins/altimate-code/hooks/shell.ts 30 a redirect between the shell and -c (bash 2>/dev/null -c 'git push') stops the scan, so pushes/filesWrittenBy miss the script; skip the redirect and its target as leaderEnd does
Files Reviewed (3 files)
  • plugins/altimate-code/hooks/shell.ts - 1 suggestion; the /^[-+][A-Za-z]*[oO]$/ value skip covers -o, +o, -O, +O, -euo and -eo clusters, and merging the -c test with the value skip does not change --rcfile/--init-file or -- handling
  • plugins/altimate-code/hooks/features/savings.test.tsx - no issues; the new -euo pipefail -c positive case matches the helper and the bash deploy.sh -c negative case still holds
  • plugins/altimate-code/hooks/health.test.tsx - no issues; the -eo, -euo, +o and filesWrittenBy cases match the helper

Previous review (commit b60c294)

Status: 1 Issue Found | Recommendation: Address before merge

Incremental review of ca44a261..b60c2948. Both earlier suggestions are addressed: shellScript in hooks/shell.ts is now the single -c rule, used by pushes, filesWrittenBy, the heredoc reader and runsDatabricksCompute, so bash deploy.sh -c x no longer counts as running x while -cx, -Ec and -o pipefail -c do; and health.tsx no longer re-exports simpleCommands, with health.test.tsx importing it from ./shell. The -o pipefail value skip is right for every shell in SHELLS, and the added xargs value options (-J, --max-args 1) match the new tests. One new gap remains.

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1
Issue Details (click to expand)

SUGGESTION

File Line Issue
plugins/altimate-code/hooks/shell.ts 26 the new shellScript loop only advances over -/+ words, so a redirect word between the shell and -c (bash 2>/dev/null -c 'git push', bash 2>&1 -c …, bash >/dev/null -c …) ends the scan and the script is lost; skip the redirect and its target as leaderEnd does
Files Reviewed (5 files)
  • plugins/altimate-code/hooks/shell.ts - 1 suggestion; SHELL_VALUE_OPTIONS, the -- handling and the cluster rule (-cx, -Ec, -lc) match bash's "first word after the options" semantics, and bash deploy.sh -c x correctly returns null
  • plugins/altimate-code/hooks/features/savings.tsx - no issues; the xargs value set now covers the BSD and GNU long forms, and the shell branch defers to shellScript
  • plugins/altimate-code/hooks/features/health.tsx - no issues; pushes and filesWrittenBy call the shared helper, and the simpleCommands re-export is gone
  • plugins/altimate-code/hooks/features/savings.test.tsx - no issues; the -cx, -Ec, -o pipefail -c, -J % and --max-args cases and the negative bash deploy.sh -c case match the implementation
  • plugins/altimate-code/hooks/health.test.tsx - no issues; the ./shell import and the new -c test match the helper

Fix these issues in Kilo Cloud

Previous review (commit ca44a26)

Status: 2 Issues Found | Recommendation: Address before merge

Incremental review of 5ce8bb8b..ca44a261. Both earlier suggestions are addressed: xargs options that take a separate value (-n, -I, -P, -L, -s, -d, -E, -a) are now skipped with it, so xargs -n 1 …, xargs -I {} … and xargs -P 4 … read the command again; and tenths now uses the same known test as the other figure helpers, so a blank or non-numeric task_hours/estimated_dbus reads ? instead of under 0.1 (the new test pins the blank-array and blank-string cases, and every other caller passes numbers or numeric strings). The new shell -c branch matches the push check's reader: bash -c '…' and sh -lc "…" are read, and bash -c 'echo databricks …' is refused; recursion always terminates because each script word is strictly shorter than the line. Two small points remain: one new redundancy in the new code, and one earlier suggestion that is still present.

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 2
Issue Details (click to expand)

SUGGESTION

File Line Issue
plugins/altimate-code/hooks/features/savings.tsx 120 the new SHELLS + /^-[a-z]*c$/ scan is a third copy of the rule pushes (health.tsx:154-157) and filesWrittenBy (health.tsx:191-193) already hold,

[Snapshot truncated.]

Additional previous summary content was truncated to keep this comment within platform limits.


Reviewed by deepseek-v4.1-flash-1017 · Input: 118.1K · Output: 11.5K · Cached: 692.5K

shreyastelkar and others added 5 commits November 17, 2026 19:00
`/savings` set only `ALTIMATE_TELEMETRY_DISABLED`, which still lets the CLI send its one-time
telemetry opt-out event and fetch the model catalog and ripgrep. The run now also sets
`ALTIMATE_ASSESSMENT_MODE=true`, so the Databricks warehouse is the only host it reaches.
An altimate-code without assessment mode ignores the variable. PRIVACY.md and the changelog
state this, the window the cost covers, and what is not assessed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…they show

Each amount was rounded on its own: whole dollars from $100, cents below. A line
comparing $125.50 with $19.05 read "$19.05 a month instead of $126, $106 less".
`compared()` formats both amounts and their gap at one precision, to the cent when
either is under $100, and takes the gap from the amounts it shows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lagged setting

The cluster request named `databricks clusters edit <id> --json`, which the CLI
rejects (cluster_id and spark_version go in the JSON) and which replaces the whole
configuration. The job request named `databricks jobs reset <id> --json`: `reset`
takes no id and overwrites every job setting. They now name `clusters update --json`
with an update mask, and `jobs update --json` with job_id and the whole tasks list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…wording

`compared()` used whole dollars whenever both amounts were $100 or more, so
$300.40 against $300.20 read "$300 instead of $300, $0 less". It now keeps cents
when the gap itself is under $100. The jobs draft no longer says `jobs update`
replaces each field it names: it changes only the settings it is given.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nged task whole

A task given to `jobs update` replaces that whole task, so a draft holding only
the new cluster would drop the task's notebook, libraries and retries. The draft
now asks Claude to start from `databricks jobs get <id>` and give each changed
task whole, with only its cluster changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
shreyastelkar and others added 2 commits November 17, 2026 23:49
`runTool` keeps main's first-line text for a failure with no answer object and
this branch's `raw` (the whole output); main's test now expects `raw` too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…first line

Since `runTool` returns only the first line of a failure's output as text, an
altimate-code too old for `tool run` (exit 1, its banner and usage on stderr) read
as a generic failure. The pane now checks the whole output (`raw`) for the usage
and shows "has no Databricks savings check". The test feeds the old CLI's real
output through the CLI helper.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@ichandann ichandann left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed bbe331096e24fc79e672fa39a91bf1722bdd95ca. Requesting changes for the unmet assessment-mode compatibility boundary below, which is also identified as a pre-merge dependency in the PR body.

The new savings flow correctly passes both environment switches, uses the CLI directly with --no-daemon, rejects connection-name flag injection, keeps findings in the pane, and fills rather than submits Draft the fix. I read the full changed source and tests, the integration wiring, privacy text and prior review responses. The documented CLI commands preserve fields for cluster/job changes; the cosmetic/unused-field and band-matching suggestions are non-blocking. Cross-workspace baseline-key scoping remains a follow-up.

Validation: the complete plugin test run finished with 506 passes and one failure in the unchanged 500-node lineage timing assertion (368 ms against a 300 ms limit), 70.55 s wall. An isolated actual-base run of that unchanged file passed all 30 tests, with that case at 75 ms; this is not evidence that the full base suite passes or that no regression exists. Both strict plugin validators and both shell suites pass. A separate focused copy passed all 39 existing savings tests and two new controls, with one expected negative failure: an unsupported CLI is invoked before the compatibility refusal (11.98 s wall on repeat). The probe mocks process creation; the old release's opt-out path was confirmed by source inspection, not a live telemetry request. The engine also logs missing ui.status implementations in the reused test helper; the negative assertion itself is the observed invocation count (expected 0, actual 1).

Current GitHub shell/security/review checks report success; no required contexts are reported. I did not connect to Databricks, replay the private recording, install/run an old CLI, validate production savings, send telemetry, or test a live Claude model turn. The dependency on code #1762/core #785 and a compatible released CLI remains material. No author source edit, commit, push, merge or deployment was performed.

Reviewed by Codex on behalf of @ichandann.

…altimate-code

Up to 0.12.11 altimate-code has neither the savings tool nor assessment mode, so
its `tool run` sent the one-time telemetry opt-out event before failing, while
the pane says nothing is sent. `/savings` now runs `altimate --version` first
(measured on 0.12.11 against a local telemetry listener: `--version` sends
nothing; `tool run` sends the opt-out event) and starts the check only on
0.12.12 or later, or a source build (`local`). A version it cannot read is
refused. README, CHANGELOG and PRIVACY.md say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@shreyastelkar

Copy link
Copy Markdown
Author

@ichandann Thanks for the review. The compatibility boundary is now enforced before launch, in 38066b2 (details on the inline thread):

  • /savings asks altimate --version first, which I measured as sending nothing on 0.12.11.
  • It never starts an older CLI for the check.

The remaining dependency is unchanged. The minimum gets set to the published altimate-code release that carries the tool and assessment mode before this merges, and the PR is held until then.

I did not change the cross-workspace baseline key or the non-blocking suggestions in this round.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@ichandann ichandann left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed 5f52bdb2ac70bfb3dd46e7303406d7c40efd5efa against the previous reviewed head bbe331096e24fc79e672fa39a91bf1722bdd95ca. The numbered-release preflight now addresses the original normal-install launch path: 0.12.11 is refused before tool run, with both environment switches on the version probe. The serverless scope wording also now matches the implementation. Requesting changes for the remaining unknown-source-build bypass below.

Independent validation: all 509 plugin tests passed (37.72 s wall), and both strict validators passed. An isolated exact-head overlay ran the 41 savings tests plus three independent controls: 43 passed, one expected negative failed because local launches the unsupported tool (9.61 s). A separate copy changing only the unknown-local guard passed all three independent controls (1.00 s). Earlier tests' ui.status-helper logs are retained; the negative result is the observed process count, not a UI-helper exception. The old source's version fallback and opt-out path were inspected; no actual old CLI or telemetry sink was run by this review.

All current GitHub checks are successful; no required contexts are reported. The published assessment-compatible CLI dependency and minimum-version pin remain an explicit owner hold. This review does not clear code #1762's missing-core-export/cost-gate findings, core #785's owner/spec gate, actual savings accuracy, a private recording, model turns or live Databricks/telemetry. No author source edits, commits, pushes, merges or deployments were made.

Reviewed by Codex on behalf of @ichandann.

…t mode

A source build prints `local` for `--version` whatever its age, so an old checkout
without assessment mode passed the check and its `tool run` could still send the
one-time telemetry opt-out event. `local` is now refused like an unreadable
version, with a message to use a released altimate-code; a build made with the
release script carries its version. README, CHANGELOG and PRIVACY.md say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- `xargs` options that take a value (`-n 1`, `-I {}`, `-P 4`) are skipped with it, so the command after
  them is read again.
- A shell's `-c` script (`bash -c 'databricks bundle deploy'`) is read as a line of its own, as the push
  check reads it.
- A job figure the answer leaves blank reads "?", not "under 0.1": `tenths` uses the same `known` test
  as the other figure helpers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`shellScript` in `hooks/shell.ts` gives the script a shell runs from its `-c` option, read from the
shell's own options only (a cluster such as `-lc`, `-cx` or `-Ec`, past `-o pipefail`). The push check,
its written-files reader, the heredoc reader and the /savings offer all use it in place of four copies
of one pattern. So `bash deploy.sh -c x` no longer counts as running `x`, and `bash -cx` and
`bash -o pipefail -c` now do.

- The /savings reader also knows BSD xargs's `-J`, `-R` and `-S` and the GNU long options that take a
  value.
- `health.test.tsx` imports the shell reader from `hooks/shell.ts`, and the health feature no longer
  re-exports it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread plugins/altimate-code/hooks/shell.ts Resolved
`shellScript` stopped at the value of a cluster such as `-eo pipefail` or `-euo pipefail` and never saw
the `-c` after it, so the push check let `bash -euo pipefail -c "git push"` through. Any `-`/`+` cluster
ending in `o` or `O` now takes the next word as its value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread plugins/altimate-code/hooks/shell.ts Resolved
shreyastelkar and others added 3 commits November 19, 2026 21:22
Brings in main's 1.8.3 and its unreleased fixes (`/clear` keeping comments and health, plugin dbt
runs in their own target folder, the push check's `${...}` and per-call start folder, and more).

- main's newer shell reader goes to `hooks/shell.ts` as before, with this branch's exports and its shared
  `-c` rule; the health feature keeps the rest of main's changes.
- `runTool` keeps main's `env` option (it forces the CLI route) and adds `noDaemon`.
- The plugin stays at 1.9.0 over main's 1.8.3; the changelog keeps main's Unreleased and 1.8.3 sections,
  and the README keeps main's `altimate-dbt` section before the savings section.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ipt runs none

- `shellScript` skips one word for every `o` or `O` in a `-`/`+` option cluster, wherever it sits, so
  `bash -oc pipefail 'git push'` is read as running `git push`.
- A `-c` with no script word after it runs no script, so a heredoc fed to it is not read as one (the push
  check no longer refuses `bash -c <<EOF ... git push ... EOF`, which bash rejects).
- The changelog lists main's unreleased fixes under 1.9.0, the version that ships them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…m the push check

`shellScript` read only the options it knows, so a value-taking option it does not know
(`zsh --emulate sh -c 'git push'`, `ksh -R x -c ...`) hid the `-c` and let the push through. When its own
reading finds no `-c`, any `-c` after the shell's name now counts, with the word after it as the script,
as the push check always read it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread plugins/altimate-code/hooks/shell.ts Resolved
Comment thread plugins/altimate-code/hooks/shell.ts Resolved
shreyastelkar and others added 2 commits November 19, 2026 21:50
When the strict reading finds no `-c`, the fallback now matches `-c` only as the push check always did
(`/^-[a-z]*c$/`), so a script's own `-check` or `-force` argument is not read as `-c`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Redirections are the calling shell's, so they are dropped with their targets before the options are
  read: `bash 2>/dev/null -c x`, `bash 2>&1 -c x` and `bash -c >log x` all run `x`.
- The any-`-c` fallback applies only past an option this reader does not know (`zsh --emulate sh`,
  `ksh -R f`), so `bash deploy.sh -c x` runs deploy.sh again, with `-c` as its argument.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread plugins/altimate-code/hooks/shell.ts Resolved
Comment thread plugins/altimate-code/hooks/shell.ts Resolved
shreyastelkar and others added 4 commits November 19, 2026 22:01
…n cluster takes a value; -c without a script runs none"

This reverts the `hooks/shell.ts` and test changes of commit 90ec299. Its changelog change (main's
unreleased fixes listed under 1.9.0) is kept.

The `-c` scan goes back to its 4fba945 rule: a word it does not read as one of the shell's options (a
redirection, an option it does not know) ends the scan, so the line shows no note. A missed note is the
safe outcome; each wider reading drew new mismatches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread plugins/altimate-code/hooks/shell.ts Resolved
Comment thread plugins/altimate-code/hooks/shell.ts Resolved
shreyastelkar and others added 2 commits November 19, 2026 22:16
…run it beats

- The push check and its written-files reader go back to main's own rule for a shell's `-c` script (any
  `-c` after the shell's name, the word after it as the script), and so does the heredoc reader. They
  hold `bash 2>/dev/null -c 'git push'` and `zsh --emulate sh -c 'git push'` again. The strict scan,
  `shellScript`, now serves only the /savings offer, which shows no note for those forms.
- A /savings run takes its generation when it is asked for, so a /clear or session end in the same tick,
  before the scheduled run starts, drops it: a late run never lands in the new conversation.
- A skipped check's name and reason, and the limited checks, go through `oneLine`: a non-string reason
  no longer fails the run, and a reason's control characters never reach the pane.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the check running

The press took its generation when pressed but checked it only in `runCheck`, after marking the check
running, so a /clear in between left the pane on "Checking…" for good and every later /savings said it
was already running. The press now returns before anything is marked when a /clear came in between.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e check running

The press re-checks for a /clear at each step: before clearing the band, before opening the pane and
again after reading whether a check is running, so a /clear landing between those steps leaves no stray
pane and no check stuck on "running".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… its own -c rule

- The command reads the generation before anything is awaited, and returns before marking the check
  running if a /clear came while it read the busy state, so a /clear while the pane opens drops the run
  and nothing is left marked running.
- The Bash reader's doc says a shell's `-c` script is found from the shell's own options only, and that
  the push check keeps its own wider rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
shreyastelkar and others added 2 commits November 19, 2026 23:10
…t writes

A run takes its generation once, before its first await, and after every await it checks it again: each
atom write is made only while the run is current (checked inside the write), each notice only then,
and the baseline reader keeps nothing after a /clear. A dropped run leaves the running flag as the
/clear left it. session.end resets the same state as before.

A table-driven test fires /clear at each await point of a run in turn (pane open, version probe, tool
run, baseline read, baseline write) and checks that nothing is left running, no old report or notice
shows, no baseline is kept, and the next /savings runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ed inside the write

The two writes that mark a /savings check running (the command and a press) check the generation inside
the write as every other atom write of a run does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e and no "running" answer

After the write that marks the check running and after the pane opens, the command checks its
generation again. If a /clear came, it opens no pane, schedules no run and says the conversation was
cleared, rather than that a check is running.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants