MTA-7135: Agent Mode Compilation Guardrails AST Verification - #380
MTA-7135: Agent Mode Compilation Guardrails AST Verification#380anarnold97 wants to merge 17 commits into
Conversation
📝 WalkthroughWalkthroughAgent Mode documentation now covers local validation guardrails, validation checks, compiler-failure autocorrection, and enablement. The developer-lightspeed assembly includes the new concept, reference, and procedure pages before the benefits content. ChangesAgent Mode Documentation
Estimated code review effort: 1 (Trivial) | ~5 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Pkylas007
left a comment
There was a problem hiding this comment.
Suggested minor clarification questions.
LGTM, thanks!
rromannissen
left a comment
There was a problem hiding this comment.
Overall LGTM, but the bit about refining the prompt needs to be changed.
Signed-off-by: A.Arnold <anarnold@redhat.com>
5ce42ef to
827d05f
Compare
mpershina
left a comment
There was a problem hiding this comment.
Left some suggestions.
Co-authored-by: Mariya Pershina <53339200+mpershina@users.noreply.github.com>
Co-authored-by: Mariya Pershina <53339200+mpershina@users.noreply.github.com>
Co-authored-by: Mariya Pershina <53339200+mpershina@users.noreply.github.com>
Co-authored-by: Mariya Pershina <53339200+mpershina@users.noreply.github.com>
Co-authored-by: Mariya Pershina <53339200+mpershina@users.noreply.github.com>
Co-authored-by: Mariya Pershina <53339200+mpershina@users.noreply.github.com>
Co-authored-by: Mariya Pershina <53339200+mpershina@users.noreply.github.com>
Signed-off-by: A.Arnold <anarnold@redhat.com>
mpershina
left a comment
There was a problem hiding this comment.
Just some minor suggestions, otherwise, LGTM!
…cks.adoc Co-authored-by: Mariya Pershina <53339200+mpershina@users.noreply.github.com>
….adoc Co-authored-by: Mariya Pershina <53339200+mpershina@users.noreply.github.com>
Co-authored-by: Mariya Pershina <53339200+mpershina@users.noreply.github.com>
|
@rromannissen - please can you re-review as your "request changes" is blocking us from merging thanks |
Co-authored-by: Mariya Pershina <53339200+mpershina@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/topics/developer-lightspeed/con_agent-mode-guardrails.adoc`:
- Line 28: Update the dry-run behavior description near the {mta-dl-plugin} flow
to state that automatic correction is attempted only for minor errors and is
limited to two attempts, after which the output is marked unverified. Preserve
the existing successful dry-run approval behavior and avoid implying that all
errors trigger correction.
- Around line 15-19: Reword the verification-mechanism bullets in the developer
lightspeed guardrails documentation to state that compilation or a dry run can
detect syntax errors and unresolved or incompatible references, without claiming
it validates API-call semantics or catches deprecated methods. Qualify the
hallucinated API and removed/deprecated method bullets accordingly, and retain
the existing syntactically broken output coverage.
In `@docs/topics/developer-lightspeed/ref_agent-mode-validation-checks.adoc`:
- Around line 16-18: Update the “Method signature and reference checks” and
“Import and dependency consistency” descriptions to use ecosystem-neutral
dependency and module-resolution terminology. Cover both Java Maven/Gradle
projects and JavaScript/TypeScript npm/Yarn projects without implying that all
checks use a compiler or classpath; split the explanations by ecosystem where
needed while preserving the existing validation behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 4c0230dd-0666-4d00-b4fd-124e57dea2c3
📒 Files selected for processing (5)
docs/topics/developer-lightspeed/assembly_understanding_dl.adocdocs/topics/developer-lightspeed/con_agent-mode-autocorrection.adocdocs/topics/developer-lightspeed/con_agent-mode-guardrails.adocdocs/topics/developer-lightspeed/proc_enabling-agent-mode.adocdocs/topics/developer-lightspeed/ref_agent-mode-validation-checks.adoc
🚧 Files skipped from review as they are similar to previous changes (2)
- docs/topics/developer-lightspeed/assembly_understanding_dl.adoc
- docs/topics/developer-lightspeed/proc_enabling-agent-mode.adoc
| The verification mechanism provides a programmatic guardrail against common large language model (LLM) risks: | ||
|
|
||
| * Hallucinated application programming interface (API) signatures | ||
| * References to removed or deprecated methods | ||
| * Syntactically broken output |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Qualify what compilation can verify.
A dry run can catch syntax errors and unresolved or incompatible references, but compilation alone does not prove that a resolved API call is semantically correct, and deprecated methods commonly remain compilable. Reword these bullets to avoid implying unconditional protection against all listed risks.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/topics/developer-lightspeed/con_agent-mode-guardrails.adoc` around lines
15 - 19, Reword the verification-mechanism bullets in the developer lightspeed
guardrails documentation to state that compilation or a dry run can detect
syntax errors and unresolved or incompatible references, without claiming it
validates API-call semantics or catches deprecated methods. Qualify the
hallucinated API and removed/deprecated method bullets accordingly, and retain
the existing syntactically broken output coverage.
| Method signature and reference checks:: The compiler resolves all newly introduced classes, method calls, field accesses, and variable references against your project's full dependency classpath. This classpath includes libraries that are declared in the `pom.xml`, `build.gradle`, or `package.json` files. This verification prevents hallucinated or deprecated application programming interface (API) calls from entering the codebase. | ||
|
|
||
| Import and dependency consistency:: The {mta-dl-plugin} confirms that every `import` statement that the suggestion adds corresponds to a type that is available on the classpath. The {mta-dl-plugin} flags missing or incorrect imports for correction. |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== candidate files =="
git ls-files | rg 'docs/topics/developer-lightspeed/(ref_agent-mode-validation-checks|con_agent-mode-guardrails)\.adoc$|agent-mode|lightspeed|dependency' || true
echo "== target snippet =="
if [ -f docs/topics/developer-lightspeed/ref_agent-mode-validation-checks.adoc ]; then
nl -ba docs/topics/developer-lightspeed/ref_agent-mode-validation-checks.adoc | sed -n '1,80p'
fi
echo "== guardrails snippet =="
if [ -f docs/topics/developer-lightspeed/con_agent-mode-guardrails.adoc ]; then
nl -ba docs/topics/developer-lightspeed/con_agent-mode-guardrails.adoc | sed -n '1,120p'
fi
echo "== references to mta-dl-plugin/classpath/module resolution in docs =="
rg -n "mta-dl-plugin|classpath|module-resolution|package\.json|npm|yarn|dependency" docs/topics/developer-lightspeed docs || true
echo "== source references to classpath/package.json =="
rg -n "classpath|package\.json|resolveAll|Import.*statement|missing or incorrect imports|npm|yarn" --glob '!build/**' --glob '!target/**' --glob '!dist/**' || trueRepository: migtools/mta-documentation
Length of output: 2746
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== candidate files =="
git ls-files | rg 'docs/topics/developer-lightspeed/(ref_agent-mode-validation-checks|con_agent-mode-guardrails)\.adoc$|agent-mode|lightspeed|dependency' || true
echo "== target snippet =="
if [ -f docs/topics/developer-lightspeed/ref_agent-mode-validation-checks.adoc ]; then
nl -ba docs/topics/developer-lightspeed/ref_agent-mode-validation-checks.adoc | sed -n '1,80p'
fi
echo "== guardrails snippet =="
if [ -f docs/topics/developer-lightspeed/con_agent-mode-guardrails.adoc ]; then
nl -ba docs/topics/developer-lightspeed/con_agent-mode-guardrails.adoc | sed -n '1,120p'
fi
echo "== references in docs/topics/developer-lightspeed =="
rg -n "mta-dl-plugin|classpath|module-resolution|package\.json|npm|yarn|dependency" docs/topics/developer-lightspeed || true
echo "== broader source references to classpath/package.json/npm/yarn =="
rg -n "classpath|package\.json|resolveAll|Import.*statement|missing or incorrect imports|npm|yarn" --glob '!build/**' --glob '!target/**' --glob '!dist/**' || trueRepository: migtools/mta-documentation
Length of output: 2746
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== candidate files =="
git ls-files | rg 'docs/topics/developer-lightspeed/(ref_agent-mode-validation-checks|con_agent-mode-guardrails)\.adoc$|agent-mode|lightspeed|dependency' || true
echo "== target snippet =="
if [ -f docs/topics/developer-lightspeed/ref_agent-mode-validation-checks.adoc ]; then
nl -ba docs/topics/developer-lightspeed/ref_agent-mode-validation-checks.adoc | sed -n '1,100p'
fi
echo "== guardrails snippet =="
if [ -f docs/topics/developer-lightspeed/con_agent-mode-guardrails.adoc ]; then
nl -ba docs/topics/developer-lightspeed/con_agent-mode-guardrails.adoc | sed -n '1,140p'
fi
echo "== references in docs/topics/developer-lightspeed =="
rg -n "mta-dl-plugin|classpath|module-resolution|package\.json|npm|yarn|dependency" docs/topics/developer-lightspeed || trueRepository: migtools/mta-documentation
Length of output: 2746
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== target file lines 1-120 =="
sed -n '1,120p' docs/topics/developer-lightspeed/ref_agent-mode-validation-checks.adoc
echo "== guardrails file lines 1-120 =="
sed -n '1,120p' docs/topics/developer-lightspeed/con_agent-mode-guardrails.adoc
echo "== dependencies/build manifests referenced in docs/topics/developer-lightspeed =="
rg -n "pom\.xml|build\.gradle|package\.json|npm|yarn|classpath|mta-dl-plugin|Import|import|type" docs/topics/developer-lightspeed || trueRepository: migtools/mta-documentation
Length of output: 32325
Use ecosystem-neutral dependency terminology throughout agent mode docs.
These checks apply to package.json/npm/Yarn-backed JavaScript and TypeScript projects as well as Maven/Gradle Java projects, so wording like “compiler resolves … against your project’s full dependency classpath” and “import statement … corresponds to a type available on the classpath” is misleading for Node toolchains. Split the Java and JavaScript/TypeScript explanations, or use neutral terms such as dependency/module-resolution context.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/topics/developer-lightspeed/ref_agent-mode-validation-checks.adoc`
around lines 16 - 18, Update the “Method signature and reference checks” and
“Import and dependency consistency” descriptions to use ecosystem-neutral
dependency and module-resolution terminology. Cover both Java Maven/Gradle
projects and JavaScript/TypeScript npm/Yarn projects without implying that all
checks use a compiler or classpath; split the explanations by ecosystem where
needed while preserving the existing validation behavior.
JIRA
PREVIEW
DESCRIPTION
Add documentation for Agent Mode guardrails and the build-tool validation loop introduced in MTA-7135.
New content:
con_agent-mode-guardrails.adoc— explains how the extension passes each AI-generated code suggestion through a local build dry-run (mvn compile, gradle compileJava, npm run build, or yarn build) before applying it to the workspace, covering syntax verification, method signature and classpath resolution, import consistency checks, and the auto-correction retry loop on compilation failureproc_enabling-agent-mode.adoc— step-by-step procedure for enabling Agent Mode via the VS Code command palette or settings panel, with a verification example using the Lightspeed output panelThe two new modules are included in assembly_understanding_dl.adoc after the existing Agent AI concept and before the benefits reference.
Summary by CodeRabbit