abc_mine.config¶
WARNING
This documentation is almost entirely "vibe coded"; while a helpful resource for humans and agents to understand this codebase, it should not be considered a source of ground truth in the way documentation normally is, and the user is responsible for verifying that all instructions given here are safe.
abc_mine.config
¶
Run configuration: the single YAML file that defines a mining run.
Shape
.. code-block:: yaml
run:
id: truchas-v1 # namespaces every output
data_root: data # where run outputs live
codebase:
name: Truchas # human-readable, used in prompts
repo: ./truchas-src # a git checkout (complete, not shallow)
source_mount: /workspace/src # where the repo appears in-container
container:
image: ./containers/truchas-dev.sqfs # Charliecloud .sqfs or unpacked dir
toolchain: # how to build/test INSIDE the container
configure: /opt/truchas-tools/configure-truchas.sh Release
build: /opt/truchas-tools/build-truchas.sh
test: /opt/truchas-tools/test-truchas.sh
test_one: /opt/truchas-tools/test-truchas.sh -R '{selector}'
env:
TRUCHAS_SOURCE_DIR: "{source}"
TRUCHAS_BUILD_DIR: "{build}"
full_build_seconds: 240 # measured by `preflight`, not guessed
selection:
mode: all # all | recent | sample | range
prompts:
pack: ./prompts # optional per-codebase slot pack
# allow_template_overrides: true # advanced; see prompts.py
Design notes
The toolchain is structured data, not prose. This is the crux of generalizing the pipeline. Three consumers need the build/test commands, and two of them are not agents at all:
- the screening/ranking agents, which are told the commands in their prompts;
- :mod:
abc_mine.preflight, which executes them to prove they work and to measure real cost; - the emitted task verifiers, which must call something that still exists at grading time — and the build stage's Layer-2 polarity check, which runs those verifiers in a clean environment.
Free-form prose could serve (1) but not (2) or (3), which is why the commands live here in a machine-readable block and are rendered into the prompts rather than being written by hand into them.
Costs are measured, not asserted. full_build_seconds exists because the
original pipeline hard-coded "a full build takes ~30+ minutes" into the screening
prompt, then had to add a correcting paragraph to the ranking prompt explaining
that it actually takes ~4 minutes and that Stage 1's cost scores were therefore
systematically wrong. Here the number is one config value — ideally written by
preflight from an actual timed build — consumed identically by every stage.
Models come from the environment. LLM_BASE_URL / LLM_MODEL /
LLM_API / LLM_API_KEY, never from this file, so a config is safe to
commit and a key is never serialized into a manifest.
ConfigError
¶
CodebaseConfig
dataclass
¶
The repository being mined.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Human-readable project name, interpolated into prompts. |
repo |
Path
|
Host path to a complete (non-shallow) git checkout. Mining reads history and builds starting states from it; a shallow clone cannot support the bundle-cutoff procedure. |
source_mount |
str
|
Absolute in-container path at which the checkout is presented to agents. |
group_id |
str
|
abc-runner task-group id for emitted tasks. Defaults to a slug of
|
group_description |
str
|
Description written into the emitted |
Source code in abc_mine/config.py
ContainerConfig
dataclass
¶
The Charliecloud image every agent runs inside.
Attributes:
| Name | Type | Description |
|---|---|---|
image |
Path
|
A SquashFS |
writable |
bool
|
Whether to run with |
Source code in abc_mine/config.py
ToolchainConfig
dataclass
¶
How to configure, build, and test the codebase inside the container.
Every command is a shell string run with bash -lc in the container, with
{source}, {build}, and {install} interpolated. test_one
additionally receives {selector}.
Attributes:
| Name | Type | Description |
|---|---|---|
configure |
str
|
Optional configure/generate step (e.g. a |
build |
str
|
Build the project. Should be parallel where possible; a serial build is the main reason a build "feels expensive". |
test |
str
|
Run the full test suite. Used by |
test_one |
str
|
Run a targeted subset, given |
build_dir, install_dir |
str
|
In-container scratch paths exposed as |
env |
dict[str, str]
|
Extra environment variables, with the same interpolation applied. |
full_build_seconds |
float or None
|
Measured wall-clock cost of a clean build, written by |
targeted_test_seconds |
float or None
|
Measured cost of one targeted test invocation. |
preflight_selector |
str
|
A test selector known to match at least one real test at HEAD, used by
|
Source code in abc_mine/config.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 | |
paths
¶
Return the interpolation variables for a given source path.
render
¶
Interpolate {source}/{build}/{install}/{selector}.
Raises:
| Type | Description |
|---|---|
ConfigError
|
If the command references an unknown placeholder. Failing here beats
shipping a literal |
Source code in abc_mine/config.py
rendered_env
¶
render_prompt_block
¶
Render the toolchain as the markdown block injected into prompts.
This is what keeps the agents' instructions and the machinery in
agreement: the commands an agent is told to use are generated from the
same strings preflight verified and the verifiers will call.
Source code in abc_mine/config.py
SelectionConfig
dataclass
¶
Which commits to screen.
Attributes:
| Name | Type | Description |
|---|---|---|
mode |
str
|
|
count |
int or None
|
Item count for |
stride |
int or None
|
Explicit stride for |
range |
tuple[str, str] or None
|
Inclusive endpoints for |
paths |
tuple[str, ...]
|
If set, keep only commits touching these pathspecs. A cheap, mechanical way to scope mining to one subsystem without spending agent budget. |
exclude_merges |
bool
|
Skip merge commits. On by default: a merge's "change" is rarely a coherent authored task, and its diff-to-first-parent is misleading. |
max_files_changed, max_diff_lines |
int or None
|
Mechanical pre-filters that drop sprawling commits before any model sees them. Filtering these in Python is far cheaper than paying an agent to score them 0. |
Source code in abc_mine/config.py
PromptsConfig
dataclass
¶
Where per-codebase prompt content comes from.
Attributes:
| Name | Type | Description |
|---|---|---|
pack |
Path or None
|
A prompt-pack directory (see :mod: |
allow_template_overrides |
bool
|
Opt-in gate for |
Source code in abc_mine/config.py
ExecutionConfig
dataclass
¶
Parallelism, retries, timeouts, and artifact retention.
Attributes:
| Name | Type | Description |
|---|---|---|
parallel |
str
|
|
workers |
int
|
Worker count for |
max_attempts |
int
|
Attempts per item before giving up. Bounded so a systematically-failing item cannot be retried forever across resumes. |
timeout_seconds |
int or None
|
Per-agent wall-clock limit. |
scratch_dir |
str
|
Node-local scratch root for heavy throwaway state (worktrees, build trees). Should NOT be on a shared/Lustre filesystem. |
keep_logs |
str
|
|
keep_telemetry |
bool
|
Keep per-item usage, cost, and tool-timing telemetry (small JSON files
under each stage's |
sandboxed |
bool
|
Route model traffic through the loopback proxy and isolate the network. |
Source code in abc_mine/config.py
InterleavingConfig
dataclass
¶
Settings for rank.method: interleaving.
Attributes:
| Name | Type | Description |
|---|---|---|
groups |
int
|
Number of random groups the candidates are split into (as evenly as possible). Each group must fit in one ranking prompt. |
seed |
int
|
Seed for the random split and for the order in which groups contribute within each interleaving round. Fixed per run: the split is recorded, and a resume that would produce a different split is refused. |
Source code in abc_mine/config.py
RankConfig
dataclass
¶
Ranking-stage settings.
Attributes:
| Name | Type | Description |
|---|---|---|
method |
str
|
One of :data: |
output |
str
|
One of :data: |
max_prompt_tokens |
int or None
|
Refuse to run when a composed ranking prompt (the harness system prompt
plus the task prompt with the candidates embedded) exceeds this many
tokens, as counted by the endpoint. Applies to each group under
|
max_candidates |
int or None
|
Hard cap on candidates fed to the ranker, applied after sorting by score. A blunter instrument than the token budget; off by default. |
interleaving |
InterleavingConfig
|
Settings for |
Source code in abc_mine/config.py
MineConfig
dataclass
¶
A fully resolved run configuration.
Source code in abc_mine/config.py
slugify
¶
Lowercase text and reduce it to a hyphen-separated slug.
load
¶
load(path: Path | str, *, overrides: Mapping[str, Any] | None = None) -> MineConfig
Load and validate a run config from YAML.
Relative paths resolve against the config file's directory, so a config plus its prompt pack and container form a relocatable bundle.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path or str
|
Path to the YAML config. |
required |
overrides
|
mapping
|
Dotted-key overrides applied after loading, e.g.
|
None
|
Raises:
| Type | Description |
|---|---|
ConfigError
|
On a missing file, malformed YAML, unknown top-level section, or any failed field validation. |
Source code in abc_mine/config.py
632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 | |
llm_env
¶
Return the model-endpoint settings from the environment (key excluded).
Raises:
| Type | Description |
|---|---|
ConfigError
|
If a required variable is missing. Checked before any agent launches so a misconfigured endpoint fails in seconds rather than after provisioning containers. |
Source code in abc_mine/config.py
llm_pricing
¶
Return model prices from the environment, or None when unpriced.
Prices are USD per 1M tokens, one per token category. They only turn token counts into money; they never change what an agent does, so they are not part of a run's comparability lock.
Raises:
| Type | Description |
|---|---|
ConfigError
|
If only some prices are set, or a price is not a non-negative number. |
Source code in abc_mine/config.py
validate_paths
¶
validate_paths(cfg: MineConfig) -> list[str]
Return human-readable problems with on-disk prerequisites.
Checks the repo exists, is a git repository, and is not shallow, and that the container image exists. Returns an empty list when everything is in order, so callers can present all problems at once instead of one per run attempt.