Skip to content

Guard failures fail the round, not the run; add guard_exclude_paths - #28

Open
TON14 wants to merge 1 commit into
AMAP-ML:mainfrom
TON14:fix/guard-errors-and-excludes
Open

Guard failures fail the round, not the run; add guard_exclude_paths#28
TON14 wants to merge 1 commit into
AMAP-ML:mainfrom
TON14:fix/guard-errors-and-excludes

Conversation

@TON14

@TON14 TON14 commented Aug 12, 2026

Copy link
Copy Markdown

Fixes #27.

Two related changes for auditor read-only-guard snapshot errors (e.g. EBADF when a build directory churns underneath the walk):

1. A guard snapshot failure fails the round, not the run

classify_agent_runtime_failure now returns None when the episode carries verifier_workspace_snapshot_errors. The adapter has already rejected the audit fail-closed at that point, so the round fails and is retried — restoring the 0.1.3 behavior — instead of the whole run aborting with provider_provider_error. Genuine runtime failures (auth, quota, rate limit, network, model) keep their terminal classification; a test covers both directions.

2. New guard_exclude_paths option

A [run] guard_exclude_paths config key (and matching --guard-exclude-path CLI flag) lists volatile workspace paths the guard should not snapshot — build/cache directories such as target, node_modules, build, .venv. Unlike hidden_paths these stay fully readable to the agents: the guard just refrains from walking directories that legitimately churn during an audit window, which avoids the race in #27 at the source. Relative paths resolve against the workspace; the default is empty, so existing behavior is unchanged. lh-harness init documents the option in the generated config, including a warning not to exclude guard-protected paths like .git.

Testing

  • tests/test_provider_errors.py (new): guard-snapshot failure → None; "connection reset by peer" → still terminal with abort_reason == "provider_network".
  • Existing config/CLI tests pass; verified lh-harness init and lh-harness doctor on a real project, and a multi-hour run on a Rust workspace with guard_exclude_paths = ["target"] where 0.1.4 previously aborted twice.

🤖 Generated with Claude Code

Two related fixes for auditor read-only-guard snapshot errors (e.g. EBADF
when a build directory churns underneath the walk):

1. classify_agent_runtime_failure returns None when the episode carries
   verifier_workspace_snapshot_errors: the audit is already rejected
   fail-closed by the adapter, so the round fails and is retried instead
   of the whole run aborting with provider_provider_error. Reproduced
   twice on 0.1.4 with a large Rust workspace (cargo target/ churn).

2. New [run] guard_exclude_paths config option (and --guard-exclude-path
   CLI flag): volatile workspace paths the guard skips while snapshotting.
   Unlike hidden_paths these stay readable to the agents; relative paths
   resolve against the workspace.
@TON14

TON14 commented Aug 12, 2026

Copy link
Copy Markdown
Author

Context and reproduction details for the underlying problem are in #27 (run aborted as provider_provider_error after a transient guard-snapshot filesystem race). This PR fixes the escalation (round-level retry instead of run abort) and adds guard_exclude_paths to avoid the race at the source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0.1.4: transient auditor-guard snapshot failure (filesystem race) aborts the whole run as provider_provider_error

1 participant