Private
Public Access
0
0

fix(tier2): chdir to repo_path before state/report calls

The failcount _state_dir() and write_report _failures_dir() now default
to Path.cwd()-relative paths (scripts/tier2/state/<track>/ and
scripts/tier2/failures/ respectively, per the previous 2 commits).

run_track.py is the CLI entry point; it now does os.chdir(repo_path)
before invoking load_state/save_state/write_failure_report so the
relative paths resolve to <clone>/scripts/tier2/.

The Tier 2 agent's CWD is the clone root already, so this is a no-op
when run by the agent; it ensures the CLI works regardless of where
the user invokes it from.

Refs: conductor/tracks/tier2_no_appdata_20260618
This commit is contained in:
2026-06-18 14:27:48 -04:00
parent 846f107359
commit 78dddf9b7c
+3
View File
@@ -7,6 +7,7 @@ itself is a thin wrapper that calls this CLI.
from __future__ import annotations
import argparse
import os
import subprocess
import sys
from datetime import datetime, timezone
@@ -74,6 +75,7 @@ def run_init(args: argparse.Namespace) -> int:
print(f"[tier2] ERROR: git switch -c failed: {err}", file=sys.stderr)
return 1
os.chdir(repo_path)
state = load_state(args.track_name) if args.resume else FailcountState()
save_state(args.track_name, state)
started_at = datetime.now(timezone.utc)
@@ -95,6 +97,7 @@ def run_report(args: argparse.Namespace) -> int:
repo_path = Path(args.repo_path)
branch_name = _git_current_branch(repo_path) or f"tier2/{args.track_name}"
started_at = datetime.now(timezone.utc)
os.chdir(repo_path)
state = load_state(args.track_name)
path = write_failure_report(
track_name=args.track_name,