Repository navigation
feat(collab): add batch settlement thresholds - #169
Merged
239573049 merged 4 commits intoDec 1, 2026
Merged
Conversation
Replay the exact threshold-only delta (6b8134c310824eeb15821afe4d75181bc3f568d3..94c16e5253296ed09b2b1e19acdb127a3f79db9c, matching reviewed net delta 48791d883220ba59a17f96584aee628f9216645c..2765fe4cfa63836c1e92ab1c0e55dc6d4cea1fd7) onto the updated ordinary batch base 9bb6059d6f7fcb2f1a40fc87dc4c576e737e01e8. Includes: - join_policy "any" (first explicit report) and "milestone" (milestone_count, milestone_ratio, milestone_tasks, milestone_stage) - Reachable milestone seal validation and exact ratio member comparison - Optional delegate_task stage label and durable member report_text - Strict milestone numeric/string argument validation while preserving AIDotNet#153 nonnegative long cursor parsing, structured cross-host reply, AIDotNet#156 GUI peer status, and 9bb6059d ordinary batch same-key/receipt fixes - Threshold, acceptance, ledger, and wake regression coverage Excludes manual/resume, exception and other wake policies, deadline, lease, quota, dependency, and launch permission work.
…uateBatch CollabLedger.EvaluateBatch previously skipped incrementing Reached when a sealed batch member's task had been pruned by task retention, even though member.Reported remained durably true and MilestoneCriterionReachable as well as named/stage milestones already honored it. Count member.Reported toward Reached once independently of Tasks lookup, preserve the compatible !member.Reported && task.Status == Completed fallback when the task is still retained, and leave failed, tentative, ordinary all/any, and Expected denominator counts unchanged. Add live and restored retention regressions in CollabBatchLedgerTests covering count=2, ratio=1.0, exact 0.28 of 25 boundary, no false counts on pruned tentative members, no double count on reported+completed members, and ordinary all/any retention semantics.
239573049
requested changes
Dec 1, 2026
239573049
left a comment
Member
There was a problem hiding this comment.
Thanks for this PR — the threshold semantics, exact ratio ceiling handling, and thorough test coverage are well structured. Before merging, please address the following issues:
Blocking
-
isImplicitFallbackoverwrites explicitReportTextandReportStatus(src/Octopus.App/Collab/CollabCoordinator.cs, around line 5261)member.ReportText = TruncateBody(message, _policy.MaxReplyChars);(andmember.ReportStatus = status;) runs unconditionally for both explicit reports andisImplicitFallback.- If a worker sends an explicit
reply_thread(e.g.status: "continue") and its turn subsequently ends viaNotifyTurnCompleted, the implicit fallback text will overwrite the explicitReportText(andReportStatus). - Also consider storing
recordSummaryrather than rawmessageso it stays consistent withtask.ResultSummary, and guard implicit fallback updates withif (!member.Reported).
-
Retained explicit reports with pruned tasks are still counted as
failedand rendered ascancelled(src/Octopus.App/Collab/Ledger/CollabLedger.csEvaluateBatch&src/Octopus.App/Collab/CollabCoordinator.csDeliverBatchSettlementAsync)- In
EvaluateBatch, when!Tasks.TryGetValue(member.TaskId, out var task), a member withmember.Reported == trueincrementsreached, but then falls intofailed++; continue;. - Likewise,
DeliverBatchSettlementAsynccomputes(task?.Status ?? CollabTaskStatus.Cancelled).ToString().ToLowerInvariant(), so a member that explicitly reportedagreedbefore task retention pruning is presented to the parent ascancelledand counted underfailed or stopped. - Please derive both the status label and settled/failed counts from
member.ReportStatuswhentaskis missing andmember.Reportedistrue.
- In
-
join_policy: "any"lacks reachability validation atbatch_seal(src/Octopus.App/Collab/CollabCoordinator.csBatchSealAsync)Milestonerejects sealing when no criterion can still be reached, butAnydoes not perform an equivalent check. If all members are alreadyFailed/Cancelledwithout an explicit report prior to sealing,batch_sealtransitions the batch toSealedwhere it can never trigger.- Please reject sealing an
anybatch when no member has reported and none remain in a non-terminal state (matching themilestoneguard).
Minor
- Non-finite
MilestoneRatiocheck (src/Octopus.App/Collab/CollabCoordinator.csBatchOpenAsync)request.MilestoneRatio is <= 0 or > 1evaluates tofalsefordouble.NaN. Please checkrequest.MilestoneRatio is { } ratio && (!double.IsFinite(ratio) || ratio <= 0 || ratio > 1)so programmatic callers cannot persistNaNinto the ledger.
- keep an explicit member report when a turn-end fallback arrives later - count and label a pruned member by its retained explicit report - reject sealing an any batch that can no longer receive a report - reject non-finite milestone_ratio Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
anyandmilestonejoin policies to the public batches from feat(collab): add public batch delegation #164. The first explicit report satisfiesany. A milestone can use a count, a ratio of sealed members, a named task or session, or a delegated stage.Verification