Skip to content

feat(worker): dispatch Qhorus COMMAND on worker channel after scheduling#218

Merged
mdproctor merged 4 commits into
mainfrom
feat/worker-schedule-command-186
May 1, 2026
Merged

feat(worker): dispatch Qhorus COMMAND on worker channel after scheduling#218
mdproctor merged 4 commits into
mainfrom
feat/worker-schedule-command-186

Conversation

@mdproctor
Copy link
Copy Markdown
Collaborator

Closes #186

What

When WorkerScheduleEventHandler successfully submits a worker execution, it now:

  1. Opens a worker-specific channel: caseChannelProvider.openChannel(caseId, "worker:<name>")
  2. Posts a COMMAND: caseChannelProvider.postToChannel(channel, "casehub-engine:orchestrator", json)

The COMMAND payload:

{
  "type": "COMMAND",
  "capability": "<capability-name>",
  "correlationId": "<event-log-id>",
  "input": { ... }
}

Why

Previously the engine provisioned workers and opened a case coordination channel but never sent a COMMAND. The entire Qhorus obligation lifecycle (ACKNOWLEDGED → FULFILLED/FAILED → trust score) was bypassed for all CaseHub-orchestrated work. There was no way to distinguish "agent acknowledged and is working" from "agent never picked up the work."

How cleanup works

Worker channels are tracked by the CaseChannelProvider alongside the case coordination channel. CaseStatusChangedHandler already calls listChannels() + closeChannel() for all open channels when a case reaches a terminal state — worker channels are cleaned up automatically with no additional wiring.

Test

Adds commandDispatchedToChannelWhenWorkerScheduled to SpiWiringIntegrationTest, which records postToChannel calls and asserts a COMMAND containing the capability name is sent.

Also fixes application-memory.properties missing H2 datasource config (ledger JPA entities need it even in in-memory test profile) and adds quarkus-jdbc-h2 to the persistence-memory Maven profile.

🤖 Generated with Claude Code

@treblereel
Copy link
Copy Markdown
Collaborator

/retest

@github-actions
Copy link
Copy Markdown

✅ Tests restarted — check the Actions tab

mdproctor and others added 4 commits May 1, 2026 04:05
…ing (#186)

When WorkerScheduleEventHandler successfully submits a worker execution,
open a worker-specific channel and post a COMMAND message containing the
capability name, input data, and correlation ID (event log ID).

This closes the prescriptive→normative lifecycle gap: previously the
engine provisioned workers and opened case coordination channels but
never sent a COMMAND, so the entire Qhorus obligation lifecycle
(ACKNOWLEDGED, FULFILLED, FAILED, EXPIRED, stall detection) was
bypassed for all CaseHub-orchestrated work.

The worker-specific channel (purpose "worker:<name>") is tracked by
the CaseChannelProvider alongside the case coordination channel. When
the case reaches a terminal state, CaseStatusChangedHandler calls
listChannels() + closeChannel() for all of them, so worker channels
are cleaned up automatically with no additional wiring required.

Adds commandDispatchedToChannelWhenWorkerScheduled test to
SpiWiringIntegrationTest. Also fixes application-memory.properties
missing H2 datasource config (needed when casehub-ledger JPA entities
are on the test classpath) and adds quarkus-jdbc-h2 to the
persistence-memory profile.

Closes #186

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
… cleanup

- Delete leaked build artefacts at project root (io/, META-INF/,
  application.properties) and add to .gitignore to prevent recurrence
- Delete engine-model/ ghost directory (module renamed to
  casehub-engine-common; stale shell only contained target/)
- Remove duplicate stale scheduler-quartz test dep from
  casehub-work-adapter/pom.xml; correct dep is casehub-engine-scheduler-quartz
- Fix casehub-work-adapter pom description: quarkus-work → casehub-work
- Update adr/0003: io.quarkiverse.work:quarkus-work-api →
  io.casehub:casehub-work-api, quarkus-work-core → casehub-work-core
- Fix stale quarkus-work references in CLAUDE.md, CallerRef.java,
  WorkItemLifecycleAdapter.java
- Untrack docs/superpowers/ from git (Claude workflow docs; now gitignored)
- GitHub issues #78 #80 #82 #83 #84 #212: update engine terminology
  (CaseContext not CaseFile, Worker/Binding not TaskDefinition, etc.)

Closes #219

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…N.md

Updates all references to the old artifact name quarkus-ledger throughout
DESIGN.md. Also corrects a stale personal-repo issue reference
(casehubio/ledger#39casehubio/ledger#39).

Refs #219

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@mdproctor mdproctor force-pushed the feat/worker-schedule-command-186 branch from b9eeb06 to a2a52a0 Compare May 1, 2026 03:06
@mdproctor mdproctor merged commit 7c6ea9b into main May 1, 2026
1 check passed
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.

design: WorkerScheduleEvent should send a Qhorus COMMAND — wire casehub-engine into the normative commitment lifecycle

2 participants