Skip to content

ci: explain a missing Bazel workspace in fetch.sh - #368

Merged
tbhb-agent merged 1 commit into
mainfrom
agent/r19-fetch-diag
Nov 23, 2026
Merged

tbhb-agent merged 1 commit into
mainfrom
agent/r19-fetch-diag

Conversation

@tbhb-agent

Copy link
Copy Markdown
Contributor

Why

Push runs on a consumer's main failed twice in fetch.sh with ERROR: Bazel 'query' must be invoked from within a workspace, 0.4 s into the step. The checkout had succeeded and the repository root holds MODULE.bazel, so the log gave the operator nothing to act on. The jobs ran on different self-hosted runners without overlapping, which rules out a shared work directory race.

Behavior change

  • Before it runs Bazel, fetch.sh checks each configured workspace for MODULE.bazel. A missing file prints a diagnostic and exits 1.
  • When a Bazel command prints must be invoked from within a workspace, the retry loop prints the same diagnostic and stops without retrying. The diagnostic says which Bazel command reported the error.
  • The diagnostic is a ::group:: block. It lists the workspace path, pwd, the first 40 lines of ls -la, whether MODULE.bazel and REPO.bazel exist, and the current git commit and short status when the directory is a checkout. One ::error:: line then gives the cause in plain words.
  • Failures with any other cause keep their existing retry and annotation behavior.

Decisions

  • The check runs inside the existing per-workspace shell, so it covers each entry in fetch-workspaces.
  • The diagnostic goes to stderr, so the captured output that the retry logic reads is unchanged.

Risk

A workspace in fetch-workspaces without its own MODULE.bazel now fails before Bazel runs, although Bazel could find a parent workspace. The existing cache_fetch_test fixture needed MODULE.bazel files for that reason. The consumer's root cause is still open. The next failing run prints the diagnostic.

Verification

  • //repo/tests:fetch_workspace_test covers a workspace without MODULE.bazel (the diagnostic prints and the exit is 1) and a failing command with another error (no diagnostic).
  • The run's direct Bazel gate passed 278 tests.
  • The new test has the Windows exclusion from AGENTS.md. Tracker row: //repo/tests:fetch_workspace_test, check the Bash subprocess on windows-2025 and remove the exclusion.

Opened-by: LLM effort=medium;harness=claude-code:2.1.330;model=anthropic:claude-sonnet-5-5;session=sha-256-64:debb814921f029ad;surface=cli
Generated-by: LLM harness=codex;model=openai:gpt-6.2-sol
Generated-by: LLM effort=high;harness=codex:0.171.0;model=openai:gpt-6.2-sol;session=sha-256-64:a659371582e2e1e3;surface=exec
Assisted-by: LLM effort=medium;harness=claude-code:2.1.330;model=anthropic:claude-sonnet-5-5;session=sha-256-64:debb814921f029ad;surface=cli

Generated-by: LLM harness=codex;model=openai:gpt-6.2-sol
Generated-by: LLM effort=high;harness=codex:0.171.0;model=openai:gpt-6.2-sol;session=sha-256-64:a659371582e2e1e3;surface=exec
@tbhb-agent
tbhb-agent merged commit 4ab60bf into main Nov 23, 2026
57 checks passed
@tbhb-agent
tbhb-agent deleted the agent/r19-fetch-diag branch November 23, 2026 10:33
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.

1 participant