Keep configs in ~/.config/build-release/ and tool state in ~/.local/state/build-release/, under XDG_* where set
CI / tests (pull_request) Successful in 6m34s
CI / tests (pull_request) Successful in 6m34s
This commit is contained in:
@@ -5,7 +5,7 @@ import sys
|
||||
import typing
|
||||
|
||||
from claude_code.model_catalog import catalog_models
|
||||
from chunk_driver.claims import CLAIMS, locked
|
||||
from chunk_driver.claims import claims_folder, locked
|
||||
from loop_effects.effects import Effects, say
|
||||
from failure import Failure
|
||||
from agent_cycle.stop import needs_human, needs_terminal, Stop
|
||||
@@ -21,7 +21,7 @@ class Models:
|
||||
# The environment variables that name the judge's and the worker's model for one run, over the model saved or configured.
|
||||
JUDGE_MODEL = "BUILD_RELEASE_JUDGE_MODEL"
|
||||
WORKER_MODEL = "BUILD_RELEASE_WORKER_MODEL"
|
||||
# The file, in CLAIMS under the home folder, that save_model keeps locked with flock while it rereads and replaces the models file. The models file's own folder is a checkout of this setup, which takes no lock file.
|
||||
# The file, in the claims folder, that save_model keeps locked with flock while it rereads and replaces the models file. The models file's own folder is the config folder, which a person backs up, so it takes no lock file.
|
||||
MODELS_LOCK = "models.lock"
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ def get_or_ask_model(project_key: str, paths: Paths, driver: str, effects: Effec
|
||||
def save_model(project_key: str, chosen: str, paths: Paths, replace: typing.Callable[[pathlib.Path, bytes], Failure | None]) -> Failure | None:
|
||||
"""Adds the project's model to the models file, whose only writer this is, through replace, which writes a file as replace_file does. It holds MODELS_LOCK from its read to its write, so two entry points that save at once both keep their pick."""
|
||||
saved = paths.models_file
|
||||
with locked(paths.home / CLAIMS / MODELS_LOCK) as unlocked:
|
||||
with locked(claims_folder(paths.state_folder) / MODELS_LOCK) as unlocked:
|
||||
if unlocked:
|
||||
return Failure(f"could not save the model in {saved}: {unlocked.reason}")
|
||||
# Read under the lock: another entry point may have saved its project while this one waited on the human.
|
||||
|
||||
Reference in New Issue
Block a user