8000 feat(budgets): ask for an overall AI budget in setup, with soft and hard limits by adeelahmad · Pull Request #281 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content

feat(budgets): ask for an overall AI budget in setup, with soft and hard limits - #281

Merged
adeelahmad merged 9 commits into
mainfrom
claude/project-thread-nz53p7
Oct 10, 2026
Merged

adeelahmad merged 9 commits into
mainfrom
claude/project-thread-nz53p7

Conversation

@adeelahmad
Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Description

Before: neither setup wizard asked about spending. Budgets covered only single routines, pipelines, workflows or namespaces. The web installer had a separate Extras step and showed folder, port and network up front.

After: the in-app setup wizard has a Budget step, and the web installer asks for a budget when a cloud provider is picked. Both use a scale for a hard limit (none by default), with a soft limit at 80% that warns, and take the model's price so the spending is counted. More sets the soft limit, the period and what happens at the limit. At the hard limit, runs wait (or are skipped) and model calls that cost money stop with the reason. Local, unpriced models keep working. The web installer now asks only the essentials: folder, port, network and version sit under Advanced, and the optional extras sit under More options on the review.

How: a new all budget resource in budgets.py sums all activity. budgets.hard_stop() (cached for 30 s) is checked in activity.Call.__init__ and raises activity.OverBudget. PUT /api/v1/setup/budget saves the budget and ai.price_in/price_out, and GET /api/v1/setup shows it. LENS_SETUP_SETTINGS accepts a budget section, which is how the installer passes its answers. The OpenAPI schema and client were regenerated with make openapi.

Motivation and Context

Adeel asked for the setup wizard to ask for a budget, as a scale or as soft/hard limits, and for wizards to ask only the minimum while everything stays configurable in Settings.

Screenshots

Installer AI model step with the spending limit, and the review with More options (checked in Chromium).

Steps to reproduce

  1. Fresh install: open the setup wizard, step 3 Budget, slide to $25, enter the prices, save.
  2. GET /api/v1/budgets lists all with usd: 25, warn_at: 0.8.

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist

  • Tests added (backend budgets/setup, installer, wizard)
  • Docs updated (budgets, get-started, configuration, CHANGELOG)

🤖 Generated with Claude Code

https://claude.ai/code/session_01XvwHFwvrDy4awJHkXCMaVe


Generated by Claude Code

…ard limits

A new `all` budget caps everything Lens spends. The in-app setup wizard gets a
Budget step and the web installer asks for one with a cloud provider: a scale
for the hard limit, the soft limit at 80% (warns), the model's price so the
spending is counted. At the hard limit runs wait or are skipped and priced model
calls stop; local models keep working. The web installer now asks only the
essentials, with folder/port/network under Advanced and the extras under More
options on the review.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XvwHFwvrDy4awJHkXCMaVe
@adeelahmad adeelahmad self-assigned this Oct 10, 2026
Copy link
Copy Markdown
Owner Author

One-line install failed at the step where the upgrade agent installs an upgrade the web app asks for (added in #260). The request was written to .lens-control/inbox/upgrade, but the systemd path unit never started lens-upgrade.sh. The agent wrote no upgrade-status and no upgrade.log, so the step timed out after 15 minutes. This PR doesn't touch install.sh, the agent or that step; the change to install.yml is only the web-installer job's answers. The same job passed on main at d4d12e6. I'll re-run the failed job once the rest of the run finishes (a re-run isn't allowed while it's still going). If it fails again, I'll treat the failure as real and dig into the agent.


Generated by Claude Code

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GbW6SC3MU2AmYQ9zFa5dk4
Copy link
Copy Markdown
Owner Author

Merged current main into this branch (merge commit, no rebase): the only conflict was CHANGELOG.md, where main gained the 0.7.0 section; this PR's entry stays under ## Unreleased. Also ported #310's one-line openapi.json version fix (main's schema check is red since v0.7.0). Locally on the merge: ruff, mypy, OpenAPI drift, eslint, tsc, Jest 737/737 and pytest 810 passed. It merges once CI is green.


Generated by Claude Code

The budget meter (#275) and this PR both name the overall budget "all"; keep one
constant (ALL) and the REF that accepts it, and check the meter shows it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GbW6SC3MU2AmYQ9zFa5dk4
…survey follows the installer

A model on this machine or its network costs nothing, so the setup wizard asks
for a budget only after a cloud model, as the web installer does. The clicks
survey's install journey no longer waits for the Extras step (now More options on
the review): one click fewer, recorded in the baseline.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XvwHFwvrDy4awJHkXCMaVe
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XvwHFwvrDy4awJHkXCMaVe
…-nz53p7

# Conflicts:
#	CHANGELOG.md
#	ci/clicks/baseline.json
…-nz53p7

# Conflicts:
#	ci/clicks/journeys.mjs
@adeelahmad
adeelahmad merged commit d4d0371 into main Oct 10, 2026
17 checks passed
@adeelahmad
adeelahmad deleted the claude/project-thread-nz53p7 branch October 10, 2026 23:16
adeelahmad added a commit that referenced this pull request Oct 11, 2026
…349)

"Stay private and safe" now covers flagging instruction-like text (patterns or the optional local classifier, #329,
#347), asking before the browser acts on what the assistant wrote (#333), breaking up links in chat-room answers
(#338), the archive as data over MCP (#343) and the audit log of what was caught (#344). "See what it costs" adds the
overall budget asked for in setup (#281). "In progress" drops what merged and adds #337, #341 and #346.


Claude-Session: https://claude.ai/code/session_01HDx7PPUauyjMn1LZs8JAsS

Co-authored-by: Adeel Ahmad <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

0