Skip to content

design: SLA propagation — case budget should bound child WorkItem and Commitment deadlines #6

@mdproctor

Description

@mdproctor

Problem

SLA deadlines exist independently at three levels with no relationship between them:

  • casehub-engine: PropagationContext.deadline (case-level budget, propagates to sub-cases only)
  • quarkus-work: WorkItem.expiresAt (set independently by the spawning caller)
  • quarkus-qhorus: Commitment.expiresAt (set independently at COMMAND creation time)

A case with a 1-hour budget can legitimately spawn a WorkItem with expiresAt = +48h. The case will FAULT after 1 hour; the WorkItem will remain ASSIGNED for another 47 hours with no knowledge that its case has ended.

Similarly, a Qhorus COMMAND created during a 1-hour case can have expiresAt = +24h — the commitment will show as OPEN long after the case has faulted.

Proposed resolution

When the casehub-work-adapter (casehub-work-adapter module in casehub-engine) spawns a WorkItem, it should:

Instant effectiveDeadline = earliestOf(
    requestedDeadline,          // from CaseDefinition
    ctx.propagationContext().deadline()  // remaining case budget
);
workItemRequest.expiresAt(effectiveDeadline);

When ClaudonyCaseChannelProvider.postMessage() creates a Qhorus COMMAND (per engine issue #185), it should apply the same min(requested, case.budget.remaining) bound to Commitment.expiresAt.

The PropagationContext.createChild() already exists for sub-case budget propagation — the same concept needs to flow to WorkItems and Commitments at the integration layer.

Affected modules

  • casehub-work-adapter (casehub-engine) — WorkItem spawn deadline bounding
  • claudony-casehub — Qhorus COMMAND Commitment deadline bounding
  • No changes needed in quarkus-work or quarkus-qhorus core

Part of

#4 (platform coherence audit — finding #18)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions