Skip to content

fix(store): include SQL diagnostics in conditional write failures - #3954

Open
wenwenwu999-maker wants to merge 2 commits into
agentscope-ai:mainfrom
wenwenwu999-maker:fix/3948-store-sql-diagnostics
Open

wenwenwu999-maker wants to merge 2 commits into
agentscope-ai:mainfrom
wenwenwu999-maker:fix/3948-store-sql-diagnostics

Conversation

@wenwenwu999-maker

@wenwenwu999-maker wenwenwu999-maker commented Nov 3, 2026 •

Copy link
Copy Markdown

AgentScope-Java Version

2.1.0-SNAPSHOT, based on main at 4af86c5.

Description

Fixes #3948.

When a conditional store write fails with a database error, the top-level exception currently only identifies the store and insert/update operation. Callers that report just the exception message lose the diagnostic SQLState and database message, even though the original SQLException is already retained as the cause.

Include both fields in the failure messages for insert and update paths in the unified JDBC store and the legacy MySQL and PostgreSQL stores. Preserve the original cause, message prefix, and duplicate-key/CAS behavior. Update the English and Chinese JDBC documentation.

Add regression coverage for both paths with data-length, missing-table, missing-column, connection, serialization, and null SQLStates, plus successful writes and duplicate inserts. Tests use mocked JDBC objects and require no database service or provider credentials.

Validation on Windows with JDK 21 (Java release 17 target):

  • Before the fix, the 48 new regression cases ran: 36 diagnostic assertions failed as expected and the 12 success/duplicate controls passed. After the fix, all 48 passed.
  • All 27 default test classes across the three affected storage modules passed: JDBC 195, MySQL 27, PostgreSQL 164; 386 tests total, no failures, errors, or skips. Test classes were explicitly selected with -Dtest in a -pl ... -am test reactor build to avoid running unrelated prerequisite test suites. JDBC's opt-in Testcontainers integration profile was not enabled.
  • Scoped spotless:apply and the default Spotless checks in the test build passed; git diff --check passed.
  • Documentation: all 13 npm test tests and npm run validate passed.
  • Full mvn -B -T1C clean verify was attempted. It failed in the unchanged core DangerousPathBypassTest.symlinkToSshIsDetected and symlinkToDotEnvIsDetected tests because this Windows account lacks symbolic-link privileges. Core reported 2,968 tests, zero assertion failures, two errors, nine skips. No assertions or tests were weakened or disabled in the repository.
  • npm run broken-links reported 2,224 broken links in 328 files. Re-running with both edited documents restored to HEAD produced byte-for-byte identical normalized diagnostics. The two new paragraphs contain no new links.

AI assistance: OpenAI Codex assisted with investigation, implementation, and validation.

Checklist

  • Code has been formatted with mvn spotless:apply
  • All tests are passing (mvn test)
  • Javadoc comments are complete and follow project conventions (no public API additions)
  • Related documentation has been updated
  • Code is ready for review; the full-build and pre-existing documentation-check limitations are documented above

Windows CI follow-up

The Windows run failed in the existing HarnessAgentSubagentStreamEventsTest.streamEvents_sameTypeSubagentInstancesGetDistinctSources: it observed one child-start event instead of two. This is separate from the local Windows symbolic-link privilege limitation noted above.

The test scripts six sequential responses on a model shared by the parent and spawned children. Default background memory extraction also calls that model and can consume responses intended for the next conversation turn. A controlled diagnostic run observed ten calls, including four memory-extraction calls; disabling memory hooks for this test restored exactly six conversation calls.

Disable memory hooks only in this multi-instance event test. Keep all existing source/session assertions and additionally require one child start in each turn and exactly six scripted model calls. Production behavior and CI configuration are unchanged.

Validation on Windows/JDK 21:

  • Temporarily repeated the corrected scenario 25 times, alongside the five other tests in its class: all 30 executions passed. Restored the normal @Test annotation afterward.
  • Ran the final Harness suite with mvn -B -T1C -pl agentscope-harness -am test "-Dtest=**/harness/**" "-Dsurefire.failIfNoSpecifiedTests=false": 1,595 tests, zero failures/errors, 37 existing skips; the affected event test class passed all six tests.
  • Default Spotless checks and git diff --check passed. Temporary diagnostic prints and background-task waits were removed.

The new push triggers a fresh CI run; its final outcome is recorded in GitHub Checks.

@mintlify

mintlify Bot commented Nov 3, 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 10235a4.

Approve preview

@CLAassistant

CLAassistant commented Nov 3, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@wenwenwu999-maker
wenwenwu999-maker force-pushed the fix/3948-store-sql-diagnostics branch from fdd4667 to eb50a90 Compare November 3, 2026 11:22
@jujn jujn added the P3 不重要不紧急 label Nov 3, 2026

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

P3 不重要不紧急

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: putIfVersion discards the underlying SQLState and message, so JDBC store failures are undiagnosable

3 participants