Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.pem
.claude/scheduled_tasks.lock
.coverage*
.env*
.history
Expand Down
4 changes: 4 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

## Development Commands

### Shell Environment (Claude already inherits it)

The user starts this session with `source .env && source .venv/bin/activate && claude`, so `.env` vars and the `.venv` are already on PATH for every Bash tool call. Do not prepend `source .env` or `source .venv/bin/activate` to commands. Use `pytest`, `python`, `ruff`, etc. directly. For pytest specifically, use `python -m pytest ...` (not `pytest ...` or `uv run pytest ...`) so cwd is added to `sys.path` and top-level imports like `from constants.models ...` resolve without setting `PYTHONPATH`.

### Running Locally

```bash
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "GitAuto"
version = "1.55.0"
version = "1.55.2"
requires-python = ">=3.14"
dependencies = [
"annotated-doc==0.0.4",
Expand Down
4 changes: 4 additions & 0 deletions utils/logs/detect_infra_failure.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Local imports
from utils.error.handle_exceptions import handle_exceptions
from utils.logging.logging_config import logger
from utils.logs.strip_jest_noise import strip_jest_noise

# Patterns for transient infrastructure failures (not code bugs). Add more as we encounter them.
INFRA_FAILURE_PATTERNS = [
Expand Down Expand Up @@ -33,10 +34,13 @@

@handle_exceptions(default_return_value=None, raise_on_error=False)
def detect_infra_failure(error_log: str):
# Strip console.warn/log blocks and AWS SSM-fallback warnings before scanning so app-level noise (e.g. "AccessDeniedException" from a console.warn that fell back to a default) can't false-positive this classifier.
error_log = strip_jest_noise(error_log)
lower_log = error_log.lower()
for pattern in INFRA_FAILURE_PATTERNS:
if pattern.lower() in lower_log:
logger.info("Infrastructure failure detected: '%s'", pattern)
return pattern

logger.info("No infrastructure failure pattern matched")
return None
3,510 changes: 3,510 additions & 0 deletions utils/logs/fixtures/foxden_rating_quoting_pr714_circleci_log.txt

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions utils/logs/test_detect_infra_failure.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@
# Real CI log from SpiderPlus PR 13615 (segfault during PHPUnit)
SEGFAULT_LOG_PATH = Path("payloads/github/check_suite/segfault_phpunit_log.txt")

# Real CircleCI `test` job log from Foxquilt/foxden-rating-quoting-backend PR 714.
# App-level console.warn at the top contains "AccessDeniedException" (SSM fetch fell back to defaults — harmless).
# Jest ran to completion and reported `Tests: 2 failed, 35 skipped, 4500 passed` from real assertion bugs in the PR.
# detect_infra_failure used to match "AccessDeniedException" and send the PR down the infra-retry branch, burning 3 empty-commit retries without ever invoking the LLM fix path.
# Must now classify as None (code bug).
PR714_FOXDEN_RATING_QUOTING_LOG_PATH = Path(
"utils/logs/fixtures/foxden_rating_quoting_pr714_circleci_log.txt"
)

NORMAL_TEST_FAILURE_LOG = """\
PHPUnit 9.6.27 by Sebastian Bergmann and contributors.

Expand Down Expand Up @@ -123,3 +132,11 @@ def test_detect_infra_failure_matches(error_log, expected):
def test_detect_infra_failure_no_match(error_log, expected):
result = detect_infra_failure(error_log)
assert result == expected


def test_strip_jest_noise_removes_app_level_access_denied_warn():
# Real PR 714 CircleCI log: app-level console.warn at the top prints "AccessDeniedException" from an SSM fetch that fell back to a default.
# strip_jest_noise removes that console block inside detect_infra_failure, so the spurious match no longer routes the PR to the infra-retry path.
# Jest still ran and reported real assertion failures further down; classifier must return None so the LLM fix path handles them.
real_log = PR714_FOXDEN_RATING_QUOTING_LOG_PATH.read_text(encoding="utf-8")
assert detect_infra_failure(real_log) is None
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.