Skip to content

fix: preserve queued skill invocation outcomes - #4054

Open
Sun-GLiang wants to merge 1 commit into
apache:mainfrom
Sun-GLiang:fix/4026-preserve-queued-skill-outcomes
Open

fix: preserve queued skill invocation outcomes#4054
Sun-GLiang wants to merge 1 commit into
apache:mainfrom
Sun-GLiang:fix/4026-preserve-queued-skill-outcomes

Conversation

@Sun-GLiang

Copy link
Copy Markdown
Contributor

Summary

Preserve the Host-produced SkillInvocationResult for every admitted message disposition instead of dropping it when a Skill message is steered or queued behind a running Turn.

  • require and validate skillInvocation on steering, followup, turn_started, and blocked submit results
  • keep partial Skill preparation outcomes through queue admission while blocking messages whose Skill requests all fail
  • persist each admission and root source outcome through SQLite recovery, retries, and durable proofs
  • forward the Host outcome through the existing Desktop and CLI Skill feedback paths
  • include Skill outcomes in durable admission capacity checks, including queued-message updates

Fixes #4026

Verification

  • npm test -w @maka/storage — 981 passed, 0 failed, 16 platform skips
  • npm test -w @maka/runtime-host — 1315 passed, 0 failed, 9 platform skips
  • npm test -w @maka/desktop — 1624 passed, 0 failed
  • npm test --prefix packages/cli — 545 passed, 0 failed
  • npm run lint — passed
  • npm run typecheck — passed
  • git diff --check — passed
  • npm test — all workspaces passed except the pre-existing packages/runtime macOS Bash executable-root assertion, which expects /usr/local even when that root is already represented by the current /usr/local/bin/node; the same failure was reproduced before this change

Migration and compatibility

  • bumps the Runtime Host protocol compatibility epoch from 56 to 57 because TurnMessageSubmitResult.skillInvocation is now required for every disposition
  • bumps SQLite session metadata schema from 33 to 34 and migrates historical pending admissions to an empty Skill outcome
  • Runtime Host, Desktop, and CLI are upgraded together; no legacy protocol compatibility branch is added

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope:

OpenAI Codex implemented the protocol, Runtime Host, storage migration, Desktop/CLI forwarding, tests, documentation, and verification described above.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

@github-actions github-actions Bot added the effort/XL Over 1000 readable lines label Aug 28, 2026
@Astro-Han

Copy link
Copy Markdown
Contributor

This is a synthesis of the independent blind review by @Sol-404ARE at exact head 32097d1543789453dde678e321d1005d7710cd25 (base b6b647cf6369d94ca1a38691e8d1a332b4926662, 24 files +1037/-125). I verified the diff and the exact-head CI myself; the file:line findings below are from Sol's sealed review.

What I checked myself:

  • Read gh pr diff 4054 (fix: retain queued skill-invocation results, 24 files) and confirmed the versioned contract propagation touching PendingMessageAdmission, SQLite migration 33→34, Host prepare/queue/recovery, and Desktop/CLI projections.
  • Checked exact-head CI: test run 33139071828 SUCCESS, windows_recovery run 33139071842 SUCCESS, label run 33139071761 SUCCESS, OPEN/MERGEABLE/BLOCKED/REVIEW_REQUIRED.

Findings from Sol's review (file:line anchored):

Standards — GO (0 P0–P3)

  • Protocol migration is explicit/fail-closed: every submit disposition now requires skillInvocation, exact codecs enforce it, and compatibility epoch 56→57 records the break.
  • Durable boundary is complete: required decode/equality in PendingMessageAdmission, SQLite 33→34 NOT NULL empty-outcome migration plus convergence guard, and all insert/read/update paths carry the column.
  • Host preserves the exact result across prepare, queue retry/recovery/update, and root-source handoff/proof; full-record capacity preflight uses storage's actual normalize/serialized-size authority.
  • Desktop/CLI forward Host authority, docs update the existing queue contract, and title/branch/template/AI trailer hygiene pass.
  • The 24-file breadth is required propagation of one versioned contract, not Shotgun Surgery — repeated empty outcomes are boundary fixtures, not duplicated logic. Entropy is neutral-to-reduced.
  • Validation: merge-base 2b5dd8a87, git diff --check PASS, Biome across 23 TS/Markdown files PASS, ASF header audit PASS, worktree clean.

Spec — GO (0 P0–P3)

  • Busy-turn partial resolution returns the same failed entries on steering/followup; total resolution failure returns structured blocked before queue mutation, and Desktop/CLI reach existing Skill-specific feedback.
  • The exact outcome is persisted, decoded, equality-checked, restored into live entries, reused for same queued identity and idle takeover, copied into root-source receipts, and counted in complete root-admission capacity checks. Ordering is durable admission commit before in-memory visibility.
  • Focused tests cover partial/total busy paths, persistence/retry, active and idle recovery, large-result capacity, protocol codecs, migration, Desktop, and CLI — storage 981, Runtime Host 1315, Desktop 1624, CLI 545 passing (as reported).

Explicit exclusions noted: blocked outcomes intentionally admit nothing and can succeed later; legacy rows migrate to empty because historical failures were never recorded; a consumed queued receipt may still answer outcome_unknown because its original queueRevision was never durable (pre-existing limit), while this PR durably retains the Skill outcome itself.

What I did not judge: a full live Host recovery with a queued Skill failure across a real restart was not executed beyond unit/integration coverage — verification was by code inspection and the suites noted above.

Gate: Standards 0 and Spec 0 — no P0–P2, test/windows_recovery/label green, head 32097d15 is ready to be approved and merged once a write holder approves. Seal: notes/pr-4054-provisional.md.


Automated review notice: This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/XL Over 1000 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Skill outcomes are dropped when a Message is queued into a running Turn

2 participants