Qwen Code’s June 22 Nightly Turns Loop Detection Into a CI Failure

Qwen Code’s June 22 Nightly Turns Loop Detection Into a CI Failure

Loop detection is one of those agent-runtime features that sounds like UX polish until the agent is running in CI. Then it becomes a contract. If the model gets stuck, the process must fail loudly, not politely return green because the wrapper completed without crashing.

That is the useful story in Qwen Code’s June 22 nightly. The release is not a splashy feature drop. It is a tightening pass on the parts of a local coding-agent control plane that decide whether automation can be trusted: non-interactive failure semantics, resume visibility, log-boundary behavior, and release synchronization between the CLI and VS Code companion.

The headline fix is in PR #5564: when Qwen Code detects a loop in non-interactive mode, it now exits with code 1, skips pending tool calls, and marks JSON output as an error with isError: true and is_error: true. Before the change, a loop-detected non-interactive run could exit 0 and emit successful-looking JSON. That is not a small bug. That is a pipeline lying about whether work happened.

A stuck agent is a failed build, not a successful command

The difference between exit 0 and exit 1 is the difference between “the agent failed” and “the rest of the system may now act on the agent’s output.” In unattended workflows, that distinction is everything. A CI job, scheduled fixer, release bot, or repository maintenance task does not read vibes. It reads status codes, JSON fields, artifacts, and logs.

If a coding agent enters a tool or reasoning loop, the requested task has not completed. It does not matter that the runtime noticed the loop and stopped eventually. Returning success after that event lets downstream automation merge a branch, publish an artifact, close an issue, or declare a scheduled repair done. That is how “AI helped with maintenance” becomes “AI silently skipped maintenance and the dashboard stayed green.”

Qwen’s choice to skip pending tool calls after loop detection is the second important detail. Once the runtime has decided the model is stuck, any queued tool calls should be treated as residue from a failed control loop, not as trustworthy intent. Letting those calls continue would be cleanup theater at best and a safety bug at worst. Fail closed, stop executing, report error. Boring, correct, shippable.

The PR changed two files with 153 additions and 12 deletions. The maintainers documented focused verification with npm ci --ignore-scripts, code generation, targeted Vitest coverage for src/nonInteractiveCli.test.ts, ESLint, workspace lint, Prettier, and git diff --check. They also disclosed unrelated existing Ink import/type failures outside the touched surface. That disclosure matters. Agent infrastructure teams should get comfortable saying exactly what was verified and what was not.

The control plane is becoming the product

This nightly makes more sense when read against the June 21 v0.18.5 stable release. Qwen Code has been hardening the surfaces around local agent execution: workspace-boundary enforcement for shell directories, strict parsing for token/env/port values, ACP glob max-results validation, session reaper timeout validation, temp/installation/custom-theme path boundaries, provider support, Web Shell fixes, and model token-plan entries for qwen3.7-plus, glm-5.2, and kimi-k2.7-code.

That is the shape of the category now. A local coding agent is no longer just a prompt loop beside your repository. Qwen’s README describes a terminal coding agent with Auto-Memory, Auto-Skills, SubAgents, Agent Teams, MCP, dynamic workflows, OpenAI/Anthropic/Gemini/Qwen/local-provider support, IDE plugins, a Desktop app, qwen serve daemon mode over HTTP+SSE/ACP, SDKs, and IM bots. Once a project has that many entry points, success semantics and boundary checks are not implementation details. They are the product.

The repository scale reinforces the point: during the research run, Qwen Code showed 25,438 GitHub stars, 2,546 forks, 743 open issues, and a push timestamp of 2026-06-22T11:41:32Z. This is not a weekend toy trying to impress Hacker News. It is an actively moving agent runtime with enough adoption that small semantics bugs can propagate into real workflows.

Resume history is incident-review infrastructure

PR #5565 fixes qwen --resume previews so loaded conversation history renders through Ink static output. Long resumed thinking blocks can now remain visible in terminal scrollback instead of being clipped by the Space-preview frame. The regression test renders a 40-line thinking block and checks that the first line, last line, and final answer marker all appear.

That sounds like terminal polish. It is not only that. Resume previews are part of incident review for agent systems. When an agent fails, drifts, loops, or edits the wrong thing, the human trying to recover needs to see the actual conversation state, not a neatly clipped fragment. Long reasoning/history blocks often contain the assumptions that explain the failure. If the resume surface hides those lines, debugging becomes archaeology with missing pages.

This is one of the underappreciated differences between chat products and agent runtimes. Chat products can optimize for readability. Agent runtimes need reconstructability. If the system cannot show how it got somewhere, it is harder to resume safely, harder to audit, and harder to decide whether the next instruction should continue, rewind, or throw the session away.

A zero log limit should mean zero logs

PR #5569 fixes a classic JavaScript boundary bug: OpenAILogger.getLogFiles(0) previously treated 0 as falsy and returned all log files, because the old truthy check interpreted it like “no limit.” The fix checks limit === undefined, preserving unlimited behavior only when the argument is absent. The change was small — two files, 11 additions, one deletion, with 38 focused unit tests passing in openaiLogger.test.ts — but the semantics are not small.

In agent tooling, logs can contain prompts, code snippets, file paths, tool output, provider metadata, user identifiers, and sometimes secrets if upstream systems are sloppy. A caller that passes 0 may be enforcing a policy: do not include logs in this response, export, preview, or diagnostic bundle. Silently widening that to “all files” is exactly the kind of bug that turns convenience telemetry into a privacy incident.

The broader lesson is simple: agent frameworks need literal boundary semantics. Zero means zero. Timeout means timeout. Deny means stop. Loop means fail. These are not places for helpful interpretation.

Release hygiene is also trust hygiene

The nightly also wires automatic VS Code companion publishing after stable CLI releases via PR #5572. The workflow now listens for release.published events so non-prerelease v* CLI GitHub Releases can enqueue the VSIX publish path automatically, while manual dispatch and dry runs remain available.

That belongs in the same trust story. Coding agents increasingly ship as split systems: CLI, daemon, desktop app, IDE extension, SDK, browser UI, MCP bridge, and sometimes chat integrations. If the CLI ships a safety or behavior change and the companion extension lags because a manual publish step was missed, users get mismatched semantics across entry points. The IDE says one thing, the terminal does another, and the agent runtime becomes harder to reason about.

For teams evaluating Qwen Code, the practical checklist is straightforward. Do not only test the interactive happy path. Run a non-interactive task that intentionally triggers loop detection and assert exit code 1, JSON error fields, and no pending tool execution. Resume a long session and verify the preview includes the history needed for review. Pass 0 to any log/file listing surface and confirm it returns nothing. Test the same expectations through qwen serve, the CLI, and IDE surfaces. If those surfaces disagree about success, history, or boundaries, the runtime is not ready for unattended work.

The take: Qwen Code’s June 22 nightly is important precisely because it is unglamorous. Coding agents become infrastructure the moment they run without a human staring at the terminal. Infrastructure must fail closed when the model gets stuck. Anything else is just green paint on a failed build.

Sources: Qwen Code v0.18.5 nightly release, Qwen Code v0.18.5 release, PR #5564, PR #5565, PR #5569, PR #5572.