fix(wasm): remove stale 10M fuel limit from settings DB (#2851)

* fix(wasm): remove stale 10M fuel limit from settings DB

Databases that persisted `wasm.default_fuel_limit = 10000000` before
the code default was bumped to 500M (limits.rs, config/wasm.rs) still
read the old value at startup because DB settings take priority over
code defaults. This caused WASM tools like google_slides to fail with
"Fuel exhausted: execution exceeded 10000000 fuel units" even though
the code default is 500M.

Add migration V25 (both PostgreSQL and libSQL) that deletes the stale
setting row when its value is <= 10M, so the 500M code default takes
effect. Users who intentionally set a custom limit above 10M are
unaffected.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* ci: trigger fresh run with skip-regression-check label

[skip-regression-check]

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(wasm): extract JSONB scalar before cast, narrow to exact match (#2851)

Address review feedback:
- PostgreSQL: use (value#>>'{}')::BIGINT to extract JSONB scalar as text
  before casting, preventing runtime errors on JSONB columns
- libSQL: use json_extract(value, '$') for equivalent JSON extraction
- Narrow predicate from <= to = 10000000 to avoid deleting intentionally
  lowered custom fuel limits

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: serrrfirat <f@nuff.tech>
This commit is contained in:
Pierre LE GUEN
2026-04-23 08:07:48 +02:00
committed by GitHub
parent b5ba7496f0
commit 0892f56af9
3 changed files with 23 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
-- The code default for wasm.default_fuel_limit was bumped from 10M to 500M
-- (limits.rs, config/wasm.rs), but databases that persisted the old 10M value
-- in the settings table still read it back at startup (DB-first resolution).
-- Delete the stale row so the code default takes effect.
DELETE FROM settings
WHERE key = 'wasm.default_fuel_limit'
AND (value#>>'{}')::BIGINT = 10000000;

View File

@@ -37,3 +37,4 @@ V21__backfill_conversation_source_channel = 4041142068103384561
V22__sandbox_restart_params = 12611649486554869350 V22__sandbox_restart_params = 12611649486554869350
V23__list_workspace_files_escape_like = 12519024535161914473 V23__list_workspace_files_escape_like = 12519024535161914473
V24__llm_calls_created_at_index = 2650126284755685421 V24__llm_calls_created_at_index = 2650126284755685421
V25__wasm_fuel_limit_bump = 8924323300096627270

View File

@@ -990,6 +990,21 @@ ALTER TABLE agent_jobs ADD COLUMN restart_params TEXT;
"llm_calls_created_at_index", "llm_calls_created_at_index",
r#" r#"
CREATE INDEX IF NOT EXISTS idx_llm_calls_created_at ON llm_calls(created_at); CREATE INDEX IF NOT EXISTS idx_llm_calls_created_at ON llm_calls(created_at);
"#,
),
(
25,
"wasm_fuel_limit_bump",
// The code default for wasm.default_fuel_limit was bumped from 10M to
// 500M (limits.rs, config/wasm.rs), but databases that persisted the
// old 10M value in the settings table still read it back at startup
// (DB-first resolution). Delete the stale row so the code default
// takes effect; users who intentionally lowered the limit can re-set
// it via the settings API.
r#"
DELETE FROM settings
WHERE key = 'wasm.default_fuel_limit'
AND CAST(json_extract(value, '$') AS INTEGER) = 10000000;
"#, "#,
), ),
]; ];