Repository navigation
L06b: callPassModel, passes settings and the Background passes card - #1072
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 viabuildAgentFromSpec+providerOf), asks for a JSON object at temperature 0, validates it against the pass's zod schema, recordsmodel/usage/costUsdon thePassContextbefore 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:firstJsonObjectmoved out ofjudge.tsso judge and passes share one implementation; judge behavior unchanged (its 18 tests pass).shared/wireTypes.ts+server/settingsStore.ts:PassKind/PASS_KINDS/PASS_KIND_LABELSdeclared once on the wire,PassSettings/PassSettingsPatch/PassSpendSummary,SettingsFile.passes, andpasses()/setPasses()merging stored values over theanthropic/claude-haiku-5-5defaults while leaving profiles untouched.server/passes/passRoutes.ts+app.ts+index.ts:GET/PUT /settings/passes(400 on a non-provider/modelmodel or an unknown/non-booleanenabledkind) and thePassRunner'sisEnabledhook readingsettings.passes().enabled.runtimeClient.ts+src/components/PassesSection.tsx+passes.css:getPassSettings/savePassSettings/getPassSpendand the screen-variant Background passes card after Deploy target — twoprovider/modelinputs (save on blur), six kind switches (save on toggle), this month's spend total + per-kind table,Savedpill for 2 s, errors under the field, "Couldn't load spend" state.Test plan
passModel.test.ts(9): parsed value + model/usage/cost recorded; providercostUsdwins overestimateCost; no usage → model only; missing key →PassUnavailableError;content_filter→PassRefusedError; prose →PassOutputError; schema mismatch names the issue path; disabled kind →PassSkippedErrorwithout 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.tsxupdated for the new card; full client suite 3916 pass, server suite 1378 pass (one unrelatedidleVersionsdebounce flake, green in isolation).npm run typecheck,typecheck:server,typecheck:tests,typecheck:examplesclean;fallow audit --base origin/mainclean.Acceptance criteria
judge.tsbehavior unchanged after thefirstJsonObjectmove.model: 'haiku'andenabled: { foo: true }..lousho/, saves edits, shows this month's spend.Generated with Devin