Skip to content

fix(task): cancel registered statements once - #2811

Merged
openai0229 merged 2 commits into
OtterMind:mainfrom
HandSonic:fix/task-statement-cancel-once
Sep 14, 2026
Merged

openai0229 merged 2 commits into
OtterMind:mainfrom
HandSonic:fix/task-statement-cancel-once

Conversation

@HandSonic

@HandSonic HandSonic commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Related issue

N/A - no matching issue was found.

Summary

When cancellation raced with JDBC statement registration, both requestCancellation and registerCancelable could schedule cancellation for the same resource. A previously retained synchronous compensation also risked blocking the task thread in a driver cancel call. This change linearizes token/resource publication under one lifecycle lock, claims one cancellation snapshot, and performs Future.cancel and driver cancellation outside the lock.

Affected surfaces

  • Frontend / Web
  • Backend / API / Storage
  • Database plugin / Driver
  • JCEF / Desktop packaging
  • CI / Build / Release
  • Documentation only

Verification

  • Commands and results:
    • RunningTaskTest: 3 tests passed.
    • Related task lifecycle suite: 22 tests passed.
    • Domain-core module tests after rebase: 228 passed; dependency modules passed.
    • git diff --check origin/main...HEAD: passed.
    • Latest-main revalidation: focused 3/3 and full domain-core module 228/228 passed; related combined domain-core suite 250/250 and 45/45 pairwise merge simulations passed.
  • Manual verification: N/A - controlled executors and latches deterministically reproduce the registration/cancellation interleaving.
  • UI evidence: N/A

Risk and compatibility

  • Public API or stored data: No API or storage changes.
  • Database or driver compatibility: JDBC Statement.cancel remains asynchronous and is now scheduled exactly once per registration.
  • Network, privacy, or security: N/A.
  • Community / Local / Pro boundary: Shared Community task runtime.
  • Backward compatibility: Existing cancellation tokens and Future interruption behavior are preserved.

Reviewer map

  • Start here: RunningTask.requestCancellation/registerCancelable and RunningTaskTest.
  • Failure condition: one registration queues two driver cancels, driver cancellation executes while holding the lifecycle lock, or clearCancelable removes a replacement resource.
  • Rollback or disable path: Revert commit 5441ff5; no migration is required.

Contributor declaration

  • I linked the Issue that defines this change.
  • I tested the affected behavior and reported the actual results above.
  • I did not include credentials, private data, or generated build output.
  • I disclosed substantial AI assistance below, or this PR contains no substantial AI-generated code.

AI assistance: OpenAI Codex assisted with diagnosis, implementation, automated tests, verification, and adversarial review.

@HandSonic
HandSonic requested review from a team and openai0229 as code owners August 30, 2026 06:32
@openai0229 openai0229 moved this to In Review in Chat2DB Community Aug 30, 2026
@HandSonic
HandSonic force-pushed the fix/task-statement-cancel-once branch from 5441ff5 to 4a27cca Compare September 3, 2026 18:47
@HandSonic

Copy link
Copy Markdown
Contributor Author

Exhaustive cross-PR integration update: combined this PR with #2802 in an isolated tree by preserving both cancellation-executor ownership and retryable input cleanup in RunningTask. The resulting full 9-module reactor passed: tools 68, domain-api 27, SPI 142, domain-core 256, storage 64, web 95 (1 environment skip), with 0 failures/errors.

@openai0229
openai0229 merged commit 13b76a0 into OtterMind:main Sep 14, 2026
18 of 19 checks passed
@openai0229 openai0229 moved this from In Review to Done in Chat2DB Community Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants