Skip to content

feat: render RunContract supervisor status#112

Merged
devkade merged 1 commit into
devfrom
feat/issue-101-runcontract-supervisor
May 15, 2026
Merged

feat: render RunContract supervisor status#112
devkade merged 1 commit into
devfrom
feat/issue-101-runcontract-supervisor

Conversation

@devkade
Copy link
Copy Markdown
Owner

@devkade devkade commented May 14, 2026

Summary

  • add compact RunContract status to Kapi text status surfaces
  • include derived RunContract details in status/update/evidence tool JSON details
  • cover widget/status/tool output with additive RunContract assertions

Verification

  • npm test -- test/presentation-ui.test.ts test/run-contract.test.ts test/tool-behavior.test.ts
  • npm run verify
  • git diff --check origin/dev...HEAD
  • grep boundary check: no GitHub/PR/Discord/Ragna terms in run-contract domain/test

Closes #101

Copy link
Copy Markdown

@kapi-agent kapi-agent Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kapi-agent review

Verdict: APPROVE

Final approval summary

Review journey

The original goal was to render compact RunContract supervisor status across Kapi status surfaces and expose derived RunContract data in relevant tool JSON details. The semantic scope is small and focused: presentation formatting plus status/update/evidence tool detail payloads, with additive tests. There was no prior kapi-agent feedback cycle for this PR, so no unresolved previous comments remain.

What changed

  • src/presentation/messages.ts
    • Adds RunContract projection for text status and expanded widget status.
    • Displays completion status, evidence count, missing expectation count, quality status, and one attention hint in full status output.
  • src/presentation/tools.ts
    • Adds runContract to details for kapi_get_status, kapi_update_workflow, and kapi_record_evidence via shared stateTextResult.
  • test/presentation-ui.test.ts
    • Covers text and expanded widget RunContract output.
  • test/tool-behavior.test.ts
    • Covers tool JSON details.runContract.

Why this is correct

The PR keeps RunContract derivation read-only and presentation-layer scoped. It does not mutate workflow state or change RunContract domain semantics. The displayed status is compact and derived from existing projectRunContract, so the UI/tool contract stays aligned with the domain model instead of duplicating evaluation logic. The new tests assert both human-readable status output and machine-readable tool details.

Evidence

  • Verifier gate: PASS — npm ci && npm run verify exited 0.
  • Size gate: PASS — 52 changed lines, under the 200-line limit.
  • Revision-explanation status: not required; no prior kapi-agent review.
  • Inspected files: src/presentation/messages.ts, src/presentation/tools.ts, src/domain/run-contract.ts, src/domain/workflows.ts, test/presentation-ui.test.ts, test/tool-behavior.test.ts.

Remaining risks and approval rationale

Remaining risks are low. The only notable compatibility change is that no-state status details now use state: null instead of an omitted/undefined value, but this is reasonable for JSON tool details. Approval is justified because the PR is small, tests pass, the implementation is additive, and no blocking correctness, safety, or workflow-contract issue remains.

Blocking issues

None.

Warnings / risks

  • src/presentation/tools.ts: stateTextResult now serializes absent state as null. This is likely better for JSON consumers, but downstream code relying specifically on missing/undefined details.state could need adjustment.

Suggestions

  • Consider reusing a shared helper for workflow definition lookup between messages.ts and tools.ts if more RunContract surfaces are added later.

Looks good

  • RunContract projection is derived from the domain layer and not persisted into workflow state.
  • Expanded widget output remains compact and avoids leaking full contract internals.
  • Tool detail additions are covered by behavior tests.
  • The presentation test verifies that internal field names like artifactRoot and completionCriteria are not accidentally rendered in text status.

Verification notes

  • Verifier gate status: PASS — npm ci && npm run verify exited 0.
  • Size gate status: PASS — 52 changed lines < 200.
  • Revision-explanation status: not required; no prior kapi-agent review.
  • Local/CI evidence provided includes full verify run with tests, checks, unused checks, and quality budgets passing.

Engine: pi

@devkade devkade merged commit 86c0a50 into dev May 15, 2026
1 check passed
@devkade devkade deleted the feat/issue-101-runcontract-supervisor branch May 15, 2026 02:51
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.

feat: render RunContract status through existing supervisor surfaces

1 participant