Skip to content

resolveRaterModel

resolveRaterModel(profile, configKey): Promise<BaseChatModel<BaseChatModelCallOptions, AIMessageChunk<MessageStructure<MessageToolSet>>>>

Defined in: _worktrees/docs-release/gaunt-sloth/packages/core/src/core/shell/raterModel.ts:54

Load the identity profile named by configKey and return ITS model.

Strict, per [[GS2-62]]: a profile that cannot be loaded, or that resolves to a config with no usable model, is an ERROR — never a silent fallback to the session’s main model. A silent fallback is precisely the failure this function exists to remove (the user asked for a stronger rater and would have been given the weak one, with nothing said). The profile’s EXISTENCE is already validated at config-load time by the loader (and by gth config validate); this is the later, separate question of whether it yields a usable model.

Global-state discipline. initConfig re-runs project discovery and calls setProjectDir(discovered?.dir) as a side effect. That is correct for the SESSION’s config load but wrong for this subsidiary one: a rater sub-config must never re-root the session. Because this call passes no customConfigPath, discovery re-walks from cwd and can legitimately land on a different dir than the session did (e.g. a session started with -c <path>), which would then silently repoint every getProjectDir() consumer — prompt files, output paths, the shell allow-list file, debug dumps. So the project dir is snapshotted and restored in a finally.

string

The identity profile name the key carried.

string

The config key that named it, for the error messages — approvals.rater or approvals.alignmentChecker. It is the only thing the user can act on, so it is required rather than defaulted: a default is how one of the two call sites would come to report the other one’s key.

Promise<BaseChatModel<BaseChatModelCallOptions, AIMessageChunk<MessageStructure<MessageToolSet>>>>

The profile’s chat model, ready to be handed to a gate call’s model option.

When the profile’s config cannot be loaded or carries no usable model.