Skip to content

fix(ci): clear the pylint/black regressions blocking every PR's merge - #4370

Merged
kovtcharov-amd merged 3 commits into
mainfrom
fix/main-quality-gate
Sep 25, 2026
Merged

kovtcharov-amd merged 3 commits into
mainfrom
fix/main-quality-gate

Conversation

@kovtcharov-amd

Copy link
Copy Markdown
Collaborator

main has been red since 2026-09-25 18:29, so nothing can leave the merge queue. Three separate regressions landed within minutes of each other; this clears all three. The worst is a literal SyntaxError — ChatAgentConfig(...) was passed device= twice, so the Agent UI backend and everything importing it failed at module load, taking out the Linux, Windows and macOS unit-test jobs. Nobody wrote that duplicate: #3666 and #4275 each added the same kwarg a few lines apart, neither diff conflicted textually, and the merge queue merged both cleanly into a file that does not parse.

The other two are one-liners: #3402 re-imported tool_cancelled over a name the module already imports (failing the pylint gate) and shipped wait_for_condition with no UI label, and #4271 landed an over-long assertion (failing the black gate).

Worth knowing: the ~13 "new pylint errors" that appear in the failing job's log are not pylint errors. They are the first 20 lines of the non-blocking MyPy output (1224 warnings, truncated for display) and have never gated anything. Only one pylint hit was real. No dependency or tool-version drift was involved — pylint 4.0.9 and black 26.5.1 both predate the last green run.

Test plan

  • python util/lint.py --black — clean (1180 files unchanged)
  • uvx pylint src/gaia --rcfile .pylintrc --disable C0103,C0301,W0246,W0221,E1102,R0401,E0401,W0718,W0212 — clean on Linux
  • python -m compileall -q src/gaia tests — no syntax errors
  • python -m pytest tests/unit/test_schedule_daemon.py -q — 28 passed
  • python -m pytest tests/unit/chat/ui -q — 1040 passed (was 17 collection errors)
🔍 Technical details

src/gaia/ui/agent_loop.py — the two device=session.get("device") lines were textually identical, so deleting the later one restores exactly the intended call. git blame attributes line 461 to 1caad2ade5 (#4275) and line 465 to 7a8fea58b1 (#3666); #3666 is an ancestor of the last green commit 69f76ab57, so #4275 is the one that created the duplicate.

src/gaia/agents/tools/shell_tools.py — gaia.agents.base.tools.tool_cancelled is a pure re-export of gaia.tool_cancellation.tool_cancelled, which the module already imports at line 31. Verified the bindings are the same object, so dropping the function-local import is a no-op rather than a behaviour change.

Follow-up worth a maintainer's eye, deliberately not bundled here: wait_for_condition executes arbitrary commands against the same allowlist as run_shell_command, but unlike run_shell_command it is not in _GAIA_MUTATING_TOOLS. By that set's own stated criterion ("or execute code") it looks like it belongs there, and omitting it means the tool skips the confirmation gating its sibling gets. That is a behaviour change, not a CI fix, so it should be reviewed on its own rather than smuggled into an unblock PR.

Also noted: .pylintrc uses disable = all plus an explicit enable list that does not include syntax-error, which is why the pylint gate walked past a file it could not parse. Enabling E0001 would have caught this at PR time.

The Agent UI backend would not import at all: `ChatAgentConfig(...)` in the
autonomous tick path was passed `device=` twice, which is a SyntaxError, so
`gaia.ui.server` and everything importing it died at module load. That took
out the Linux/Windows/macOS unit-test jobs on main.

Nobody wrote the duplicate. #3666 added `device=session.get("device")` and
#4275 independently added the same kwarg a few lines up, next to
`min_context_size`. Neither diff conflicted textually, so the merge queue
merged both cleanly and produced a file that does not parse. The two lines
were identical, so removing the later one restores exactly the intended call.
Two loose ends from #3402, both of which turned a CI gate red.

The pylint "critical errors" gate failed on a reimport: `_cancel_requested`
re-imported `tool_cancelled` from `gaia.agents.base.tools` while the module
already imports it at the top from `gaia.tool_cancellation`. The former is a
pure re-export of the latter, so the local import bound the identical function
object and only shadowed the existing name. Dropping it is a no-op.

The new `wait_for_condition` tool shipped with no entry in the flagship's UI
tool-label map, which `test_every_registered_tool_has_a_label` guards — an
unlabeled tool falls back to a humanized name nobody chose.
#4271 landed an assertion that exceeds the line limit, so the black gate went
red for every PR behind it. Pure line-wrapping; the assertion is unchanged.
@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Sep 25, 2026
Merged via the queue into main with commit 7d275c7 Sep 25, 2026
36 of 37 checks passed
@kovtcharov-amd
kovtcharov-amd deleted the fix/main-quality-gate branch September 25, 2026 20:00
@github-actions github-actions Bot added tests Test changes agents labels Sep 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Verdict: Approve

main was unbuildable and this unblocks it. All three fixes are the minimal correct ones: the duplicated keyword argument that made the Agent UI backend fail to even parse is gone (the remaining one still forwards the session's device, so behaviour is unchanged), the redundant re-import is dropped in favour of the binding the module already had, and the missing UI label plus the reformatted assertion are cosmetic. Scope is clean — nothing rides along.

One correction to the PR description, worth knowing before someone files the follow-up: the claim that the wait tool "skips the confirmation gating its sibling gets" isn't right. That tool is already covered by the same shell-command permission gate as its sibling; the set it's missing from only drives a cosmetic "local change" status line in the chat stream. The inconsistency is real and still worth tidying, but it's a display detail, not a permission hole — so the follow-up shouldn't be filed as a security gap.

Real-world evidence

evidence-bundle.md shows the surface actually exercised on the ubuntu-latest lane. The before/after on the crash is the core of it:

$ git show 0931395f^:src/gaia/ui/agent_loop.py > /tmp/agent_loop_parent.py
$ python -m py_compile /tmp/agent_loop_parent.py
  File "…/agent_loop_parent.py", line 465
    device=session.get("device"),
SyntaxError: keyword argument repeated: device

$ python -m py_compile src/gaia/ui/agent_loop.py
HEAD agent_loop.py compiles OK

The backend then booted and served for real (AgentLoop started, /api/health 200, /api/settings 200 via resolve_agent_mode() imported from the changed module), a session round-tripped back out through gaia mcp serve --stdio (15 tools, list_sessions returning the HTTP-created session), and the new label was driven through the real relay dispatch:

{"type": "tool_start", "tool": "wait_for_condition", "detail": "Waiting for a condition"}
label without (fallback): wait for condition          <- what the UI showed before this PR

Cancellation was checked in-process rather than through a user-facing surface (base.tools re-export is the same object: True, and both cancel channels still fire) — reasonable, since reaching that tool needs an LLM. The rendered Agent UI screenshot and a real inference tick are marked pending strix-halo lane; per the rubric that's adequate here given the route-level evidence is present. I independently re-ran compileall over all four changed files — clean. The pytest and pylint items in the test plan I could not re-run (no pytest on this runner), so those rest on the PR's own reported output.

🔍 Technical details

Verified, no findings:

  • src/gaia/ui/agent_loop.py:461 — exactly one device=session.get("device") remains, and ChatAgentConfig.device: Optional[str] exists (hub/agents/chat/python/gaia_agent_chat/agent.py:161) and is consumed at :362 and :508. The deleted line was textually identical, so the call site is restored to intent.
  • src/gaia/agents/tools/shell_tools.py:1820 — gaia.agents.base.tools imports tool_cancelled from gaia.tool_cancellation as a pure re-export (base/tools.py:16-22), and shell_tools.py:31 imports the same symbol from the source module. Identical object; removing the function-local import is a no-op. Docstring updated to match.
  • src/gaia/ui/email_sidecar/profiles.py:272 — key matches the registered tool name (_WAIT_TOOL at shell_tools.py:580, @tool def wait_for_condition at :2597).

🟢 Follow-up note is mis-scoped (not a change request on this PR) — _GAIA_MUTATING_TOOLS (profiles.py:223) has exactly one consumer: relay.py:166, which emits {"type": "status", "message": "✎ local change: <tool>"}. It gates no execution. The actual confirmation gate is _SHELL_TOOLS in src/gaia/agents/base/tool_grants.py:90, which does include wait_for_condition — with a comment explaining why. So adding it to _GAIA_MUTATING_TOOLS would only make the chat stream annotate the call like run_shell_command's. Still worth doing for consistency; just not a permission finding.

🟢 .pylintrc observation is correct and worth acting on — disable = all with an allowlist that omits E0001 is why a file that doesn't parse cleared the gate. Enabling syntax-error is a one-line change with no false-positive risk, and would have turned this incident into a red PR check instead of a red main.

Strengths

  • Each of the three regressions is fixed at the smallest possible diff, with git blame in the description identifying which PR introduced the duplicate — useful for anyone auditing the merge queue's semantic-conflict blind spot.
  • The description separates the real pylint hit from the ~13 MyPy lines misread as pylint errors, which stops the next person chasing phantom failures.
  • The mutating-tools change was deliberately not bundled into an unblock PR. Correct call.

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

Labels

agents tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant