fix(agents): pass agentDir to media understanding in ACP dispatch path [AI-assisted]#72832
Conversation
Greptile SummaryThis PR adds the missing Confidence Score: 5/5Safe to merge — minimal, focused change with no risk of regression outside the ACP media understanding path. The change is a one-line parameter addition to align the ACP path with the existing non-ACP path. The omission was silent (optional parameter), the fix is consistent with how acpAgentId is used elsewhere in the same function (delivery coordinator, etc.), and applyMediaUnderstanding failures are already caught and logged gracefully. No files require special attention. Reviews (1): Last reviewed commit: "fix(agents): pass agentDir to media unde..." | Re-trigger Greptile |
martingarramon
left a comment
There was a problem hiding this comment.
This brings the ACP dispatch path in line with the non-ACP path in get-reply.ts, where resolveAgentDir(cfg, agentId) is called at line 229 and threaded into applyMediaUnderstanding at line 250. The ACP side was calling applyMediaUnderstanding without agentDir, so agent-scoped filesystem and workspace constraints were silently ignored for ACP sessions. Importing from agent-scope.js matches the existing get-reply.ts import.
One concern not raised in the bot review: with agentDir now passed, can a previously silent path become a NEW failure for ACP agents that have no configured directory? resolveAgentDir returns string | undefined, and applyMediaUnderstanding's agentDir?: string (per get-reply.ts:134) is optional — passing undefined is functionally identical to omitting the parameter. So no new failure mode introduced.
LGTM — closes a real silent omission, no regression risk.
ad52f70 to
9cc4dc0
Compare
The ACP dispatch path calls applyMediaUnderstanding without the agentDir parameter. This prevents the media understanding pipeline from locating agent-specific models.json and auth profiles, causing image understanding to fail silently for non-visual models configured with a separate image understanding model. The non-ACP reply path (get-reply.ts) already passes agentDir correctly. This aligns the ACP path with the same behavior. Closes openclaw#55046 AI-assisted (built with Hermes orchestration).
9cc4dc0 to
7e2f3fa
Compare
Summary
applyMediaUnderstandingis called without theagentDirparameter. WithoutagentDir, the pipeline cannot locate agent-specificmodels.jsonand auth profiles, so image understanding silently falls back to raw content.agentDir: resolveAgentDir(params.cfg, acpAgentId)to theapplyMediaUnderstandingcall indispatch-acp.ts, aligning it with the non-ACP reply path inget-reply.tswhich already passesagentDircorrectly.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause
dispatch-acp.tscallsapplyMediaUnderstanding({ ctx, cfg })without the optionalagentDirparameter. WhenagentDiris missing, the media understanding pipeline falls back toresolveOpenClawAgentDir()which requires theOPENCLAW_AGENT_DIRenvironment variable — absent in most setups. Without it, the pipeline cannot findmodels.jsonor auth credentials for the configured image understanding model.get-reply.ts) already passesagentDircorrectly (line 250), but the ACP path was not updated to match when media understanding support was added to it.agentDirparameter is optional inapplyMediaUnderstanding's signature, so the omission does not cause a type error — it silently degrades.Regression Test Plan
src/auto-reply/reply/dispatch-acp.test.tsapplyMediaUnderstandingas a pass-through; adding an argument assertion would verifyagentDiris forwarded.get-reply.tspath. TheapplyMediaUnderstandingfunction's internal use ofagentDiris covered bysrc/media-understanding/apply.tstests.User-visible / Behavior Changes
Diagram (if applicable)
N/A
Security Impact (required)
agentDirthat is already used in the non-ACP path. No new file access, no new permissions — just consistent behavior between the two reply paths.