Skip to content

fix(rag): construct valid local image file URIs - #4637

Open
CryoThrust wants to merge 1 commit into
agentscope-ai:mainfrom
CryoThrust:fix/rag-image-file-uri-4631
Open

CryoThrust wants to merge 1 commit into
agentscope-ai:mainfrom
CryoThrust:fix/rag-image-file-uri-4631

Conversation

@CryoThrust

Copy link
Copy Markdown
Contributor

AgentScope-Java Version

2.1.0-SNAPSHOT, based on current main 2d208c57f.

Description

Fixes #4631.

ImageReader builds local image references by concatenating file:// and the input.
For path/to/image.jpg, that makes path the URI authority instead of part of the local
path. Spaces and reserved filename characters are not escaped either.

Use Path.toAbsolutePath().toUri().toASCIIString() for plain local paths. HTTP(S) URLs and
existing file:// references still pass through unchanged. Document IDs continue to be
derived from the original input, not the resolved URI. No file-existence requirement,
public API, dependency or OCR behavior changes.

The regression tests cover relative and absolute paths, spaces, +, #, % and Chinese
filename characters. They read back the original bytes through both Files and the existing
MediaUtils.urlToInputStream path. The fixture stays under target/ so relative paths do
not depend on the Windows temp directory using the same drive. Existing URL passthrough
and deterministic document-ID behavior are also checked. English and Chinese dev guides
describe the input and local-file consumer requirements.

Verification

On the unmodified reader, the 15-case ImageReader suite has one failure and two errors in
the path regression cases. After the fix, all 52 focused ImageReader/ReaderInput/MediaUtils
cases pass without skips.

The final eight-module dependency reactor verify passes on JDK 17: 4,860 cases, zero
failures/errors, 49 skips
. This includes Core, DashScope, Ollama and RAG Simple. Spotless
and git diff --check pass. Documentation tests (20 cases), strict build validation and
broken-link checks pass.

mvn -B -T1C -pl :agentscope-extensions-rag-simple -am verify

cd docs
npm test
npm run validate
npm run broken-links

An earlier clean reactor run failed in the unchanged EmbeddingUtilsTest.testBatchTimeout
(expected a timeout error, received an empty list). The final reactor run after the test-fixture
portability correction passes, including that unchanged test. No timeout, assertion or test
selection was weakened; the first failure's cause has not been established.

This validates reader-generated URI round trips and existing local media reads, not every
provider's file-URI handling. Generic downloader/converter changes such as #3319 are outside
this patch. Live model/cloud calls and the full repository reactor were not run. Native
Windows validation remains for CI.

Checklist

  • Code formatted with mvn spotless:apply
  • Affected module and dependency reactor verified
  • Relevant Javadoc updated
  • Matching English and Chinese documentation updated and validated
  • Change ready for review

@mintlify

mintlify Bot commented Dec 5, 2026

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit dbd543b.

Approve preview

@CryoThrust

Copy link
Copy Markdown
Contributor Author

CI update on unchanged head dbd543b2c06196a9f9b56caeace8f5533e2f161e: Windows, documentation, license, module-sync and CLA checks pass. The Linux job failed in RemoteSubagentAdapterTest.separateParentProcessesRecoverRemoteWorkAndReportWithoutAnotherUserTurn at line 265: Timed out waiting for durable state while waiting for the first parent process to create the remote session/turn.

That job ran all 15 ImageReader cases successfully, with no skips, and the RAG Simple module completed successfully. The failing test is in agentscope-extensions-durable-http; this patch does not change that module. I have not reproduced the failure on the base revision or established its cause, so I am not treating it as a proven flaky test or claiming the full CI run passed.

I attempted one rerun of the failed Linux job; the CLI returned job 145580896306 cannot be rerun. Could a maintainer rerun that job on this head? No test, deadline, assertion or workflow was changed to work around the failure.

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: ImageReader builds malformed file URIs from local image paths

1 participant