Repository navigation
fix(harness): close index connections when initialization fails - #3912
Conversation
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
|
Two things worth having in the body: WorkspaceIndex.close() swallows SQLException, so closing from the catch cannot turn the null fallback into a throw; and the ownership chain is already complete (HarnessAgent.ownedWorkspaceIndex, WorkspaceManager.ownsIndex), which makes the documentation sentence accurate rather than aspirational. SqliteSessionStorage does the same close-on-failure dance, so there is an in-repo precedent worth citing. |
|
LGTM |
Backport the verified fix to the 2.0.x implementation and retain its existing public contracts where the upstream kernel differs. (cherry picked from commit 2b4a1cb) Backport-review-patch: cc572eb4fc97c9d5de1ed07c30c6e1d5272e8b10 Constraint: No AgentScope Service or SDK migration Confidence: high Not-tested: Whole-repository verification pending after lane integration
AgentScope-Java Version
2.1.0-SNAPSHOT, based on main4399f75fcdc699465733b4a4dc71794c741b92c9.Description
Closes #3911.
WorkspaceIndex.open()can acquire a SQLite connection and then fail while configuring it or initializing the schema. The factory returnsnullfor the optional-index fallback, but previously left the connection open with no returned index for callers to close. A corrupt.index/workspace.dbreproduces this with the real SQLite driver.Take ownership of the acquired connection before initialization and close the partially initialized index on failure. Preserve the existing best-effort
nullfallback and keep successful connections open until the returned index is closed. There are no public API or dependency changes.Add three lifecycle regressions covering failure before connection acquisition, real corrupt-database initialization failure, and successful read/write use followed by explicit closure. The SQLite connections are real; the static JDBC interception only makes the factory's connection observable, following the existing JDBC static-mocking approach in this module. Tests also release the captured connection on assertion failure. Document ownership in Javadoc and both filesystem guides.
Validation
Environment: Windows, Temurin 17.0.15, Maven 3.9.12, SQLite JDBC 3.47.1.0. No external providers or services.
open() == nullbutconnection.isClosed() == false. The normal-open control passed.mvn -B -T1C -pl :agentscope-harness -am -DskipTests clean install(dependency build; tests intentionally skipped in this command).mvn -B -T1C -pl :agentscope-harness clean verify— 1,594 tests, 0 failures, 0 errors, 37 skipped (1,557 passed), BUILD SUCCESS. This includes Spotless, packaging and Javadoc. The full-repository test suite was not run.git diff --checkpassed.npm test— 13 passed;npm run validate— passed.npm run broken-linksexits nonzero on the existing documentation baseline. Modified and original HEAD documents both report 2,222 links in 328 files; comparing the file/target multisets gives no additions or removals. The two documents were restored after the baseline comparison.The first dependency install encountered an old Maven compiler cache encoding error after switching to UTF-8; a clean build with process-local
JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8resolved it. No global environment settings or unrelated code were changed.Checklist
AI assistance: Codex assisted with source investigation, implementation, regression tests and documentation. The stated checks were executed locally and the full staged diff was inspected.