feat(agent-harness): admit durable runs and revisioned commands - #5678
Open
iscekic wants to merge 1 commit into
Open
feat(agent-harness): admit durable runs and revisioned commands#5678iscekic wants to merge 1 commit into
iscekic wants to merge 1 commit into
Conversation
This was referenced Aug 28, 2026
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Reviewed by grok-4.6 · Input: 137.7K · Output: 21.9K · Cached: 663.2K Review guidance: REVIEW.md from base branch |
This was referenced Aug 29, 2026
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.
No new behavior — this change does not make a new feature available to users.
Summary
admitCommandadds atomicAdmissionCommandhandling forgetOrCreateConversation,sendMessage,setPermissionMode, andcancelRun; each accepted send commits one message, queued run, and reply.CommandAdapter,AuthoritySchema, andModelAdmissionSchemavalidate current access and model bounds;RunLimitsSchemaandSendResultSchemafreeze each admitted context, prices, and limits.Authorized retries return original results, while serialized revision checks, queue bounds, named cancellation, and durable alarms protect admission; production integration remains external.
Files
services/agent-harness/src/commands.ts— Source, A (added), 339 lines (+339/−0). Validates command envelopes and returns explicit rejections for invalid input, unsupported protocols, and commands that require another handler. Requires current owner, client, and context authority, including reauthorization after awaited model validation. Resolves an existing conversation without scheduling work and preserves legacy Ask/revision-zero defaults. Uses the command identifier as the run identifier and freezes the model, variant, originating client, context, prices, and limits. Enforces message and queue bounds during admission; defaults allow 32 KiB messages and 32 pending runs, excluding the active run. Stores ceilings for calls, model steps, tokens, tool/network payloads, attempt/run duration, web requests/results, snippets, pages, and model cost. Positive overrides can only lower these ceilings; input tokens also respect model capacity. Fingerprints bind inputs to the actor and conversation; authorized replay skips model and limit validation. Changed inputs returncommand_conflict; durablestale_revisionrejections require reviewed inputs under a new command identifier. Mode changes serialize revision increments and require an acknowledged direct user action to enableyolo. Enablingyoloresumes approval waits only; switching to Ask preserves existing calls, approvals, effects, and other wait gates. Named cancellation moves queued runs tocancelledand running or waiting runs tostopping; stopping and terminal runs remain unchanged. Cancellation preserves unrelated queued work and actual effects; missing-run rejections remain durable even if a later send creates that run. Requests durable recovery before mutation commits, except terminal cancellations, and retains the earliest wake through the existing store. Restarts, lost acknowledgments, and event compaction preserve committed work and original replies. Event-size failures roll back work and retain a permanent limit rejection; transient failures permit same-command retries without a stored result.Tests: 1 test file added —
services/agent-harness/src/commands.test.ts, A, 1,106 lines (+1,106/−0). Covers concurrent admission, durable replay, policy revisions, authority loss, frozen inputs, queue bounds, cancellation, preserved effects, rollback, and alarm recovery.Generated: 0 files changed.
Visual Changes
Visual Changes: N/A
Verification
Reviewer Notes
Scope
Kilo-Org/cloud./Users/igor/Projects/.worktrees/shared-agent-harness-3bb0, branchshared-agent-harness-3bb0-s11.shared-agent-harness-3bb0-s10...shared-agent-harness-3bb0-s11.Reported automated checks
The handoff reports that the implementer and reviewer passed all 42 scoped SQLite tests, lint, formatting, and whitespace checks.
pnpm --filter @kilocode/agent-harness-worker exec vitest run src/commands.test.ts— 42 tests passed.pnpm exec oxlint --config .oxlintrc.json services/agent-harness/src/commands.ts services/agent-harness/src/commands.test.ts— passed.pnpm exec oxfmt --check services/agent-harness/src/commands.ts services/agent-harness/src/commands.test.ts— passed.git diff --check -- services/agent-harness/src/commands.ts services/agent-harness/src/commands.test.ts— passed.These checks cover scoped SQLite behavior and storage recovery, not repository-wide checks or live runtime verification.
Human steps
This level requires no human steps before merge or after merge.
Later runtime activation needs scoped Worker and server configuration.
Notes
Live E2E verification remains pending at the completed stack tip. This level adds uncomposed backend command handling; it does not activate a user-facing runtime.
Stacked PRs — merge bottom to top. Each level shows only its own diff.
Runtime verification (E2E, user advocacy, simplify) runs on the tip PR over every level.
Every level keeps its own checks, its own bot review, and its own threads; each one is answered on its own PR.
Each level is its own deliverable: it builds and passes its own checks alone.
A finding on a level is repaired on that level, then carried upward with stack.sh forward.
shared-agent-harness-3bb0— chore(agent-harness): register workspaces and enforce CI boundaries #5632shared-agent-harness-3bb0-s2— feat(agent-harness): define portable domain and snapshots #5637shared-agent-harness-3bb0-s3— feat(agent-harness): define commands tools and permission policy #5639shared-agent-harness-3bb0-s4— feat(agent-harness): share client state and cursor recovery #5643shared-agent-harness-3bb0-s5— feat(agent-harness): persist command intents and execution receipts #5647shared-agent-harness-3bb0-s6— feat(db): add harness ingress grants and retirement fences #5655shared-agent-harness-3bb0-s7— feat(agent-harness): deliver legacy history and project durable text #5659shared-agent-harness-3bb0-s8— feat(agent-harness): authorize durable grants and registered clients #5662shared-agent-harness-3bb0-s9— feat(agent-harness): fence retirement and retry payload cleanup #5667shared-agent-harness-3bb0-s10— feat(agent-harness): persist authoritative state in SQLite #5675shared-agent-harness-3bb0-s11— feat(agent-harness): admit durable runs and revisioned commands #5678 ← this PRshared-agent-harness-3bb0-s12— feat(agent-harness): recover queued runs and stream checkpointed steps #5688shared-agent-harness-3bb0-s13— feat(agent-harness): resolve interactions and dispatch tools sequentially #5693shared-agent-harness-3bb0-s14— feat(agent-harness): fence designated client tool execution #5697shared-agent-harness-3bb0-s15— feat(agent-harness): synchronize durable snapshots and legacy history #5701shared-agent-harness-3bb0-s16— feat(agent-harness): reuse authorized invitations with durable replay #5704 (tip)