Skip to content
Draft
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
7 changes: 7 additions & 0 deletions .sonar-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"project": {
"projectKey": "org.sonarsource.java:java",
"path": ".",
"serverUrl": "https://next.sonarqube.com/sonarqube/"
}
}
37 changes: 37 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,40 @@ Read [release checks](docs/systems/release-checks.md) before preparing a release
Read [external context](docs/systems/external-context.md) before looking up rule specifications, upstream release procedures, shared operations or design proposals.

---

# Before you reply: Vortex analysis

Install the [SonarQube CLI](https://docs.sonarsource.com/sonarqube-cli/), run `sonar auth login --server https://next.sonarqube.com/sonarqube/`, and optionally configure user-level integration with `sonar integrate claude` or `sonar integrate codex`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Quality: Skip example says SonarQube Cloud, but project binds to SonarQube Server

Step 3 (line 343) gives "no SonarQube Cloud connection" as the example skip reason. This checkout is bound to a SonarQube Server instance (serverUrl: https://next.sonarqube.com/sonarqube/ in .sonar-config.json), and line 312 asks users to authenticate against that server. An agent hitting an auth or connection failure may report or diagnose it as a missing Cloud connection, sending users to the wrong service. Use a server-neutral example, or one that names the Next server.

Make the example match the configured server:

3. If analysis is skipped for another reason (for example, no connection to https://next.sonarqube.com/sonarqube/ or missing authentication), state the reason once in your reply and continue without retrying this session.
  • Apply fix

Check the box to apply the fix or reply for a change | Was this helpful? React with 👍 / 👎

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Security: Agents may install user-level hooks without the user opting in

AGENTS.md is the instruction file coding agents read. Line 312 tells the reader to install the SonarQube CLI, run sonar auth login, and "optionally configure user-level integration with sonar integrate claude or sonar integrate codex". Nothing says only a human may do this, or that the agent needs the user's explicit consent first. Line 319 then says the protocol was "installed by sonar integrate at the user's request", so an agent may assume that consent already exists. Line 335 mentions "Per-edit hooks", which tells the agent that integration adds hooks.

The risk: an agent doing an ordinary repository task could choose that "optional" step on its own. It would then change the user's global agent configuration and install hooks that keep running after the task and in other checkouts, without the user asking for it.

Fix: say that CLI installation, authentication and sonar integrate are manual setup steps for the human developer, and that agents must not run them unless the user explicitly asks. Also remove the false "installed at the user's request" provenance.

Limit persistent user-level setup to the human, or to an explicit user request:

Developer setup (manual; agents must not run these steps unless the user explicitly asks): install the [SonarQube CLI](https://docs.sonarsource.com/sonarqube-cli/), run `sonar auth login --server https://next.sonarqube.com/sonarqube/`, and optionally configure user-level integration with `sonar integrate claude` or `sonar integrate codex`.
  • Apply fix

Check the box to apply the fix or reply for a change | Was this helpful? React with 👍 / 👎

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Quality: Protocol says sonar integrate installed it, but it's committed

Line 68 tells agents "These instructions were installed by sonar integrate at the user's request." That isn't true here. The block is committed to the repository's AGENTS.md, and line 61 calls sonar integrate an optional, user-level step that contributors may skip. An agent reading this file is told the user explicitly opted in when they may never have run the CLI, which misstates where the requirement comes from. Change the sentence to say the protocol is part of the repository's agent guide (for example, "This repository requires Vortex analysis…"), or leave the CLI-generated wording out of the committed copy.

Describe the actual source of the instruction:

This repository's agent guide requires Vortex analysis. It checks the final change set for issues before you reply.
  • Apply fix

Check the box to apply the fix or reply for a change | Was this helpful? React with 👍 / 👎


On a detached HEAD, add `--branch master` to the analysis command.

<!-- sonar:begin:sonarqube-agentic-analysis-protocol -->
# Vortex analysis protocol

These instructions were installed by `sonar integrate` at the user's request. Vortex analysis checks the final change set for issues before you reply.

At the end of a turn that changed file contents in the workspace (create, edit, patch, or format), run Vortex analysis before your final reply or handoff. Analyze all files changed in the turn in one command.

Pass each modified path with `--file`, relative to the directory you run the command from (for example, `src/foo.ts`). Use `--depth DEEP` even for one file so the analysis includes cross-file findings.

```bash
sonar analyze agentic --depth DEEP --file <path/to/file1> --file <path/to/file2>
```

If you cannot reliably list every modified path, analyze the git change set with DEEP depth:

```bash
sonar analyze agentic --depth DEEP
```

Per-edit hooks use faster STANDARD analysis. The end-of-turn check uses DEEP depth, including when only one file changed.

In a repository with several Sonar projects (a monorepo), the directory you run the command from decides what is analyzed. From the monorepo root, one command analyzes every changed file against the project that owns it. From inside one project, only that project is analyzed: a `--file` path outside the current directory is rejected, and changes in other projects are listed as not analyzed. Run the command from a directory that contains every file changed this turn, usually the monorepo root. Files owned by no project are skipped in the change-set report and rejected as `--file` paths; leave them out rather than retrying.

After the analysis:

1. If no project is configured, stop analysis attempts for this session. A routine skip needs no mention in the final reply unless the user asks about Vortex analysis. If the user asks for Vortex analysis or configures a project, run the analysis again and report any error.
2. If analysis finds issues on lines you changed this turn, fix them and re-run the same scope. Continue until no touched-line findings remain. Leave findings on untouched lines to their existing owners unless the user asks you to address them.
3. If analysis is skipped for another reason (for example, no SonarQube Cloud connection), state the reason once in your reply and continue without retrying this session.
4. Include any remaining Vortex findings verbatim in your reply.
<!-- sonar:end:sonarqube-agentic-analysis-protocol -->
Loading