Skip to content

L06b: callPassModel, passes settings and the Background passes card - #1072

Merged
LinuxDevil merged 1 commit into
mainfrom
fb-l06b
Nov 12, 2026
Merged

LinuxDevil merged 1 commit into
mainfrom
fb-l06b

Conversation

@LinuxDevil

Copy link
Copy Markdown
Owner

Summary

  • server/passes/passModel.ts: callPassModel — the one way a background pass talks to a model. Resolves the provider like the judge (stored keys before env vars via buildAgentFromSpec + providerOf), asks for a JSON object at temperature 0, validates it against the pass's zod schema, records model/usage/costUsd on the PassContext before parsing (an unusable reply was still billed), and maps failures onto the L06a classes: PassSkippedError (kind off in settings), PassUnavailableError (missing provider key), PassRefusedError (content_filter), PassOutputError (no JSON object / schema mismatch, retried by the runner).
  • server/passes/jsonReply.ts: firstJsonObject moved out of judge.ts so judge and passes share one implementation; judge behavior unchanged (its 18 tests pass).
  • shared/wireTypes.ts + server/settingsStore.ts: PassKind/PASS_KINDS/PASS_KIND_LABELS declared once on the wire, PassSettings/PassSettingsPatch/PassSpendSummary, SettingsFile.passes, and passes()/setPasses() merging stored values over the anthropic/claude-haiku-5-5 defaults while leaving profiles untouched.
  • server/passes/passRoutes.ts + app.ts + index.ts: GET/PUT /settings/passes (400 on a non-provider/model model or an unknown/non-boolean enabled kind) and the PassRunner's isEnabled hook reading settings.passes().enabled.
  • runtimeClient.ts + src/components/PassesSection.tsx + passes.css: getPassSettings/savePassSettings/getPassSpend and the screen-variant Background passes card after Deploy target — two provider/model inputs (save on blur), six kind switches (save on toggle), this month's spend total + per-kind table, Saved pill for 2 s, errors under the field, "Couldn't load spend" state.

Test plan

  • passModel.test.ts (9): parsed value + model/usage/cost recorded; provider costUsd wins over estimateCost; no usage → model only; missing key → PassUnavailableError; content_filter → PassRefusedError; prose → PassOutputError; schema mismatch names the issue path; disabled kind → PassSkippedError without calling the model; timeout aborts the provider signal.
  • settingsStore.test.ts (+3): defaults on a fresh file, patch merge preserving profiles and other keys, model/kind validation.
  • passRoutes.test.ts (+2): GET defaults, PUT merge round-trip, 400s on bad model / unknown kind / non-boolean.
  • PassesSection.test.tsx (6): renders defaults + spend, blur saves model, blank/unchanged doesn't save, switch → { enabled: { auto_approval: false } }, rejected save under the field, spend error state.
  • SettingsPanel.test.tsx updated for the new card; full client suite 3916 pass, server suite 1378 pass (one unrelated idleVersions debounce flake, green in isolation).
  • npm run typecheck, typecheck:server, typecheck:tests, typecheck:examples clean; fallow audit --base origin/main clean.

Acceptance criteria

  • Valid JSON reply returns parsed value; model, usage and cost recorded.
  • Missing key / content_filter / no-JSON / schema mismatch / disabled kind map to the right error classes.
  • judge.ts behavior unchanged after the firstJsonObject move.
  • PUT rejects model: 'haiku' and enabled: { foo: true }.
  • Settings shows the card with defaults on a fresh .lousho/, saves edits, shows this month's spend.

Generated with Devin

…passes card

- server/passes/passModel.ts: callPassModel resolves the provider like the
  judge (stored keys first), asks for a JSON object, validates it against a
  zod schema, records model/usage/cost on the PassContext before parsing,
  and maps failures onto the PassRunner's settle classes.
- server/passes/jsonReply.ts: firstJsonObject moved out of judge.ts so the
  judge and the passes share one implementation.
- shared/wireTypes.ts + settingsStore.ts: PassSettings, PassSettingsPatch,
  PassSpendSummary, PASS_KINDS/PASS_KIND_LABELS and SettingsFile.passes;
  passes()/setPasses() merge stored values over the haiku-5-5 defaults.
- passRoutes.ts + app.ts + index.ts: GET/PUT /settings/passes and the
  PassRunner's isEnabled hook reading settings.passes().enabled.
- runtimeClient.ts + PassesSection.tsx + passes.css: getPassSettings/
  savePassSettings/getPassSpend and the screen-variant "Background passes"
  card (model inputs save on blur, kind switches on toggle, this month's
  spend table).

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@LinuxDevil
LinuxDevil merged commit 4ac18c4 into main Nov 12, 2026
6 checks passed
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.

1 participant