Skip to content

feat(collab): add manual batch resume - #175

Open
shizhenwei1984-cell wants to merge 2 commits into
AIDotNet:mainfrom
shizhenwei1984-cell:feat/collab-manual-batch-resume
Open

shizhenwei1984-cell wants to merge 2 commits into
AIDotNet:mainfrom
shizhenwei1984-cell:feat/collab-manual-batch-resume

Conversation

@shizhenwei1984-cell

Copy link
Copy Markdown
Contributor

Changes

  • Add the manual batch join policy and batch_resume. A sealed manual batch collects reports without an automatic wake. An eligible resume saves one settlement and sends its aggregate wake, with the same receipt on retry.
  • Allow currently paused batches to resume. Batches that settle automatically refuse resume after settlement and send no additional notification.
  • Keep a newly settled long-lived batch within the bounded finished history. Save the settlement and associated keyed report state together. If a snapshot cannot include the settlement, keep the last saved sealed batch and report state.

Local verification

  • Release App build passed on this branch after replay onto main with feat(collab): add batch settlement thresholds #169 merged.
  • All 112 App batch tests and 5 Remote Collab envelope tests passed.
  • The independent review reproduced the three cap-related failures on the prior revision and verified the fixes.

Compose the corrected third manual/resume slice by replaying
c2915e2fd59c1787ef467f09ef5e18452d8f0886..5871c8e78d84db1968f3b8cec5a12078d2056e7f
(a9d627f59ca1b2e26c70f2a6115af730ff2634d9 plus manual HOLD fixes
5871c8e78d84db1968f3b8cec5a12078d2056e7f) onto accepted threshold base
8e4c75fce8fedf80b8a43efb08423b98813a85df.

Includes:
- join_policy "manual" and MCP tool batch_resume (with optional note)
- Truthful overlapped resume receipts and in-flight wake ownership tracking
- Consumed deferred-wake outcome preservation and ambiguous wake classification
- Durable batch wake delivery state/error ledger persistence and validation
- Automatic all/any/milestone refusal of batch_resume even after settlement
  (unless currently paused), with aligned BatchResumeTool contract wording
- Finished-batch retention ordered by UpdatedSeq then SettledAt/CreatedAt
  within the 200-batch cap, plus truthful FlushBatch verification on settlement
- Manual/resume, wake, ledger, and tool-registry regression coverage

Preserves the threshold retained-report fix (8e4c75fc), ordinary batch
same-key/receipt fixes (9bb6059d), AIDotNet#153 cursor and structured replies,
and AIDotNet#156 GUI peer status. Excludes later exception policies, immediate/none
wake policies, deadline, lease, quota, dependency, and launch permission work.
…ttlement atomically

Fix the cap-miss persistence HOLD on d8bdb47a5d8524bf200b3ccd1f032d0a9bfb1b2c:

1. Check requiredBatchId inclusion in CollabLedger.FlushCore before
   serializing or calling _store.Save so a cap-miss candidate snapshot
   never overwrites the previously persisted sealed batch or advances
   _persistedVersion/_persistedBatchIds.

2. Add CollabLedger.TryCommitBatchTransition and use it in
   CollabCoordinator.TrySettleBatchAsync to hold _persistGate across
   staging (under Gate), pre-save snapshot inclusion check, off-Gate
   JSON serialization/store save, and commit or rollback (under Gate).
   No concurrent or background flush can observe or persist a staged
   settlement or coupled keyed-report dispatching marker before commit
   or rollback completes.

3. Add deterministic 200-finished cap-collision regressions with actual
   persisted snapshot reloads for direct FlushBatch, manual batch_resume
   (with healthy retry and restart replay), keyed automatic report
   settlement (preserving sealed batch and recorded event state before
   batch_seal retry), and atomic TryCommitBatchTransition rollback.
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.

1 participant