Skip to content

Basis for java agent rule skill - #12816

Open
colin-higgins wants to merge 12 commits into
masterfrom
colin.higgins/rule-agent-skill
Open

colin-higgins wants to merge 12 commits into
masterfrom
colin.higgins/rule-agent-skill

Conversation

@colin-higgins

Copy link
Copy Markdown
Member

What Does This Do

Add a skill for guiding agentic static analysis rule suggestions

Motivation

See above

Additional Notes

None

Contributor Checklist

Jira ticket: [PROJ-IDENT]

@colin-higgins
colin-higgins requested a review from a team as a code owner October 9, 2026 15:03
@colin-higgins
colin-higgins requested review from amarziali and removed request for a team October 9, 2026 15:03
@dd-octo-sts

dd-octo-sts Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Hi! 👋 Thanks for your pull request! 🎉

To help us review it, please make sure to:

  • Add at least one type, and one component or instrumentation label to the pull request

If you need help, please check our contributing guidelines.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-09T15:12:38.751819Z d27fba9 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d27fba9cb6

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread .agents/skills/spotbugs/SKILL.md
Comment thread .agents/skills/spotbugs/SKILL.md Outdated
Comment thread .agents/skills/spotbugs/references/other-vehicles.md Outdated
Comment thread .agents/skills/spotbugs/references/other-vehicles.md Outdated
Comment thread .agents/skills/spotbugs/SKILL.md Outdated
Comment thread .agents/skills/spotbugs/SKILL.md Outdated

Use this file after the [SpotBugs skill](../SKILL.md) classification step finds no matching detector. Do not start here.

Pick the **narrowest** vehicle that can fail CI with low false positives. One rule per change, same as SpotBugs.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Account for non-blocking Forbidden APIs modules

For repository-wide banned-call rules, Forbidden APIs is not currently a blocking gate in every production module: dd-java-agent/agent-otel/otel-bootstrap/build.gradle overrides forbiddenApis.ignoreFailures to true. A violation confined to that module therefore does not fail CI, contrary to the selection criterion here; either document the coverage exception, remove the override as part of enabling the rule, or choose a vehicle that can enforce it there.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion: This is true, and this is intentional, on some specific modules only, currently only 3 modules disable it.
It might be worth mentioning it though.

Comment thread .agents/skills/spotbugs/references/other-vehicles.md Outdated
Comment thread .agents/skills/spotbugs/SKILL.md Outdated

Use when the rule is “never call this method/class” with **no location qualifier** (not “only in `@Advice`”, not “only in premain”).

1. Append **one** signature (and optional `@defaultMessage`) to `main.txt`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reset the inherited Forbidden APIs message

When a signature is appended without its own message, it inherits the last @defaultMessage in the file; the parser retains that value for every subsequent signature until another directive replaces or clears it (implementation). Because main.txt currently ends with the OkHostnameVerifier message, following this instruction literally gives the new rule that unrelated CVE message; require an inline message or an explicit @defaultMessage reset before appending.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion: Maybe adding an example there would be useful, to teach the agent how this file format works.
In particular if the rule is not added to an existing one, then require an explicit message for each new rule, either inline or through its own @defaultMessage?

See my message on https://github.com/DataDog/dd-trace-java/pull/12816/changes#r4295777114 that addresses the two points.

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bits Code Review: FAIL

The skill can retain a newly enabled visitor after checking only the main source set, although blocking CI also analyzes Java 11 production sources.

Open Bits AI session

🤖 Bits Code Review · Commit d27fba9

Comment thread .agents/skills/spotbugs/SKILL.md
@datadog-datadog-prod-us1

This comment has been minimized.

@dd-octo-sts

dd-octo-sts Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

🟢 Java Benchmark SLOs — All performance SLOs passed

Suite Status
Startup 🟢 pass

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results
Scenario Candidate master Δ (95% CI of mean)
startup:insecure-bank:iast:Agent 13.95 s 13.88 s [-0.2%; +1.3%] (no difference)
startup:insecure-bank:tracing:Agent 12.86 s 12.93 s [-1.2%; +0.2%] (no difference)
startup:petclinic:appsec:Agent 17.07 s 16.95 s [-0.2%; +1.6%] (no difference)
startup:petclinic:iast:Agent 16.26 s 16.92 s [-8.1%; +0.3%] (no difference)
startup:petclinic:profiling:Agent 16.64 s 16.75 s [-1.7%; +0.4%] (no difference)
startup:petclinic:sca:Agent 17.03 s 16.87 s [-0.0%; +1.9%] (no difference)
startup:petclinic:tracing:Agent 16.12 s 15.64 s [-1.2%; +7.3%] (no difference)

Commit: 90b4c8d9 · CI Pipeline · Benchmarking Platform UI


Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion.

@bric3 bric3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Two documentation suggestions on shared conventions and justified exceptions. The existing discussions cover the source-set commands and detector selection.

Config: [`gradle/forbiddenApiFilters/main.txt`](../../../../gradle/forbiddenApiFilters/main.txt),
[`gradle/forbiddenapis.gradle`](../../../../gradle/forbiddenapis.gradle).

Use when the rule is “never call this method/class” with **no location qualifier** (not “only in `@Advice`”, not “only in premain”).

@bric3 bric3 Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion: We may want to we mention the extra signature lists for specific module types?

  • main.txt holds the common rules,
  • while the instrumentation convention also adds instrumentation.txt.

This helps the skill choose the right file for a new ban while keeping tool enablement in the module configuration.

forbiddenApis {
signaturesFiles = files(
"$rootDir/gradle/forbiddenApiFilters/main.txt",
"$rootDir/gradle/forbiddenApiFilters/instrumentation.txt"
)
}

Comment thread .agents/skills/spotbugs/SKILL.md Outdated

@bric3 bric3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Answered some messages from codex.

Comment thread .agents/skills/spotbugs/references/other-vehicles.md Outdated
Comment thread .agents/skills/spotbugs/SKILL.md
Comment thread .agents/skills/spotbugs/SKILL.md Outdated
Comment thread .agents/skills/spotbugs/references/other-vehicles.md Outdated
Comment thread .agents/skills/spotbugs/references/other-vehicles.md Outdated
Comment thread .agents/skills/spotbugs/SKILL.md Outdated

Use this file after the [SpotBugs skill](../SKILL.md) classification step finds no matching detector. Do not start here.

Pick the **narrowest** vehicle that can fail CI with low false positives. One rule per change, same as SpotBugs.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion: This is true, and this is intentional, on some specific modules only, currently only 3 modules disable it.
It might be worth mentioning it though.

Comment thread .agents/skills/spotbugs/references/other-vehicles.md Outdated
Comment thread .agents/skills/spotbugs/SKILL.md Outdated

Use when the rule is “never call this method/class” with **no location qualifier** (not “only in `@Advice`”, not “only in premain”).

1. Append **one** signature (and optional `@defaultMessage`) to `main.txt`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion: Maybe adding an example there would be useful, to teach the agent how this file format works.
In particular if the rule is not added to an existing one, then require an explicit message for each new rule, either inline or through its own @defaultMessage?

See my message on https://github.com/DataDog/dd-trace-java/pull/12816/changes#r4295777114 that addresses the two points.

@bric3 bric3 added tag: no release notes Changes to exclude from release notes comp: tooling Build & Tooling labels Oct 16, 2026
colin-higgins and others added 11 commits October 18, 2026 21:33
Co-authored-by: Brice Dutheil <brice.dutheil@gmail.com>
Co-authored-by: Brice Dutheil <brice.dutheil@gmail.com>
Co-authored-by: Brice Dutheil <brice.dutheil@gmail.com>
Co-authored-by: Brice Dutheil <brice.dutheil@gmail.com>
Co-authored-by: Brice Dutheil <brice.dutheil@gmail.com>
Co-authored-by: Brice Dutheil <brice.dutheil@gmail.com>
Co-authored-by: Brice Dutheil <brice.dutheil@gmail.com>
Co-authored-by: Brice Dutheil <brice.dutheil@gmail.com>

This branch has not been deployed

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

Labels

comp: tooling Build & Tooling tag: no release notes Changes to exclude from release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants