fix(agent): pass interceptor-set system message to model requests (issue #270) #339
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.43) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.43 · 356 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.352
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #339"
general
weight: 0.35
yuluo-yx
Describe what this PR does / why we need it
Fixes #270: the standalone ReAct agent's
invokeModelbuilt theChatRequestfromrequest.getMessages()only, silently droppingModelRequest.getSystemMessage()— so the four framework interceptors that inject system prompts through that field (Skills, Filesystem, SubAgent, TodoList, all using the null-then-appendTextmerge pattern) lost their injection entirely on the standalone ReAct path ("system message sent=false" in the issue's repro).Does this pull request fix one issue?
Fixes #270
Describe how you did it
A single composition point in
invokeModelbuilds the outgoing message list: when an interceptor set a system message, it becomes the single SYSTEM entry at the head of the request and replaces any SYSTEM messages already present in the conversation list (two SYSTEM entries would be transmitted verbatim by the Spring/LangChain4j adapters and concatenated by the Google ADK adapter, so the explicit field wins); all non-SYSTEM messages keep their order. With no interceptor-set system message the incoming list is passed through unchanged.The composition is a local copy for this call only — the run-level message list is never written back, so nothing accumulates across tool-call turns. Streaming and non-streaming share the same construction point, so both paths behave identically. No public API, event, or configuration changes;
ModelRequest's existing SYSTEM role validation already guarantees plain messages are never promoted.Describe how to verify it
ReActAgentTest(+6 cases, all offline via the existing ScriptedClient pattern): the issue's repro (interceptor sets "required-policy", the recorded request starts with that SYSTEM entry); an existing user-provided SYSTEM message is replaced with exactly one SYSTEM entry transmitted; without an interceptor system message the conversation is passed through byte-for-byte (user SYSTEM preserved); system message count stays exactly 1 across tool-call turns (no accumulation); the streaming path receives the same system message; non-SYSTEM messages keep their order around the injected entry.Red before the fix: system-message assertions fail (
sent.get(0)has no SYSTEM role). Green after:ReActAgentTest22/22, argi-agent-core full module 133/133 (with upstream reactor), checkstyle clean, studio compiles.Special notes for reviews
The replace rule (interceptor system message wins over conversation SYSTEM entries) follows the interceptors' own merge convention: they treat the
systemMessagefield as the single system-prompt carrier (null-then-appendText), so no second protocol is introduced. If a stricter merge (e.g. appending the interceptor prompt to the conversation's existing SYSTEM text) is preferred, the change is confined to the single composition method.