4.9 KiB
Report: Investigation of CI Check Failures in Gemini CLI
Executive Summary
The investigation into the repeated CI failures for PR #21212 and the discrepancy between local agent claims and remote check results has identified a pattern of incomplete verification, environment drift, and git mismanagement. While the agent (Gemini) repeatedly reported local success, it was frequently running only a subset of the required validation suite and failing to account for CI-specific constraints.
1. Root Causes of the Failure Pattern
A. Incomplete Local Validation
- Command Gaps: The agent consistently relied on narrow commands like
npm test <file>ornpm run lint(ESLint only). It frequently skipped the comprehensivenpm run preflightmandated by the project'sGEMINI.md. - Build vs. Test Discrepancy: The agent often observed passing tests while
ignoring
tsc --buildfailures. Because Vitest usesesbuildto bypass type-checking during test execution, the tests would pass locally even if the project had compilation errors that blocked the CI's build step. - Linting Omissions: The project uses a complex
scripts/lint.jsthat includesactionlint(for workflows),shellcheck(for scripts), andyamllint. The agent typically only raneslint, missing violations in these other categories.
B. Environment Parity (The "Works on My Machine" Problem)
- TypeScript Inference Bugs: A major cause of failure in PR 21212 was a
subtle TypeScript type inference discrepancy related to Promise flattening in
LoadingIndicator.test.tsx. The agent's local TS version was more lenient, while the CI matrix (running Node 20, 22, and 24) triggered strict compilation errors that the agent could not reproduce without running a fulltsc --build. - OS Differences: Some failures were specific to the Linux runner in CI, while the agent was operating in a macOS environment.
C. Git & Rebase Mismanagement
- Accidental Feature Reversions: During merge conflict resolutions and
rebases, the agent inadvertently deleted massive amounts of recently merged
core functionality (e.g., Windows Sandboxing, ModelChain support). This
happened because the agent used a "keep ours" strategy for conflicts it didn't
understand, treating the newer code in
mainas noise. - Single-Commit Mandate: The pressure to squash changes into a single clean
commit often led the agent to overwrite the "good" state of
mainwith its older local state during a botched rebase.
D. Violation of Strict Project Rules
- Typing Violations: The agent used
as Record<string, unknown>to bypass TS checks for undocumented settings, which is strictly forbidden by the project's development rules. - Missing Documentation: The agent added new UI settings but failed to
document them in
docs/get-started/configuration.md, a requirement for any setting withshowInDialog: true.
2. The "20 Failures" Cycle
The long log of "fix it again" requests was caused by a recursive failure loop:
- Partial Fix: Agent fixes a specific test failure -> Runs only that test -> Claims "All tests passing".
- CI Catch: CI fails on a build/lint error the agent skipped -> User reports failure.
- Collateral Damage: Agent fixes the build error -> Botches a rebase in the process -> Claims "Ready for merge".
- Rule Enforcement: Maintainer/CI identifies reverted features or missing docs -> User reports failure.
3. Actionable Solutions
-
Mandate
npm run preflight: The agent must be strictly instructed to run the fullnpm run preflightcommand before claiming completion. This ensuresclean,install,build,lint:all,typecheck, andtest:ciare all verified in sequence. -
Explicit
tsc --buildVerification: Agents must perform a package-widetsc --buildafter any architectural or test-helper changes to catch the specific inference bugs that surfaced in CI. -
Conflict Resolution Protocol: Agents should never default to
merge -X ours. If conflicts occur, they must perform a surgical comparison of the diffs. If the conflict is in a file unrelated to their task (e.g.,packages/core), they should seek clarification or default to "theirs" (themainbranch) to preserve core features. -
Documentation & Schema Linting: Include automated checks in the agent's workflow to verify that any new setting in
settingsSchema.tshas a corresponding entry in the documentation. -
Strict Rule Adherence: The agent's internal "Pickle Rick" worker or sub-agents must be initialized with the
Strict Development Rules(found in.gemini/commands/strict-development-rules.md) to prevent common violations likeanyusage or incorrectwaitForutilities.