feat(agent-harness): define commands tools and permission policy - #5639
Open
iscekic wants to merge 1 commit into
Open
feat(agent-harness): define commands tools and permission policy#5639iscekic 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 Executive SummaryReviewed the new agent-harness command, tool, and permission-policy definitions (inert, not wired to runtime) with high confidence; admission, dispatch, fingerprinting, and schema gates match the stated contracts. Files Reviewed (4 files)
Reviewed by grok-4.6 · Input: 144.7K · Output: 20.3K · Cached: 348.9K Review guidance: REVIEW.md from base branch |
This was referenced Aug 28, 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 defines actions but does not make them available in the product.
Summary
commandAdmissionrejects agent permission changes and stale sends or mode changes; callers must supply the origin from command ingress.evaluateDispatchusesDispatchPolicyand stored approval state; identity changes require a new call, and executing or settled calls cannot dispatch again.askrequires approval except for trusted reads;yoloskips only approval, preserving denials, access, revision, availability, question, and client checks.Files
packages/agent-harness/src/policy.ts— Added (A), source: 69 lines (+69/-0). Adds admission and dispatch decisions without executing actions. Compares the call identifier, run, name, definition version, arguments, context, effect, and execution target. Uses stored approval and execution state instead of proposed replacements. Keeps approval across mode or revision updates for an unchanged call when the current checks pass. Callers must derivetrustedReadfrom a local definition, not remote annotations.CommandSchemaandReadInputSchema, with inferredCommandandReadInputtypes, define nine mutations and five reads with strict identity and pagination contracts.canonicalizeValidatedInputandfingerprintCommandnormalize validated commands and authenticated scope with injected hashing;commandReplayDecisionreturnsnew,replay, orcommand_conflict.setPermissionModerequiresacknowledgePendingActionsforyolo, while client registration retains older advertised versions; these definitions do not store or execute commands.Files
packages/agent-harness/src/commands.ts— Added (A), source: 121 lines (+121/-0). DefinesgetOrCreateConversation,sendMessage,setPermissionMode,resolveInteraction,cancelRun,claimClientTool,completeClientTool,registerClient, andrevokeClient. Mutations requireprotocolVersion,clientId, andcommandId; conversation actions also requireconversationId. Messages require nonblank text, a model, and a permission revision, with an optional variant. Mode changes require an expected revision; pending-action acknowledgement defaults to false. Interaction resolutions support approval, denial, question answers, and dismissal. Client completions require a grant, generation, and outcome; registration accepts only client tools with nonblank versions. DefinesgetConversation,getSnapshot,getCommand,getEvents, andgetHistory; page limits run from 1 through 200. Events require an after cursor and default to 200 results; history defaults to 50 results with a nullable before cursor. Fingerprinting sorts nested object keys, preserves array order, and normalizes defaults. The caller supplies authenticated actor and conversation scope plus the platform'ssha256function. Conversation mismatches fail; extra authority fields, including transport credentials and timestamps, do not enter the hash. Reusing a stored command identity with a changed fingerprint returns a conflict rather than a replay.toolDefinitions,ToolNameSchema, andToolRequestSchemadefine 21 version-1 tools with strict input and output schemas, effects, and executor kinds, rejecting unnamed tools.ScreenSchemarestricts navigation;QuestionSchema,QuestionResponseSchema, andvalidQuestionResponseenforce stable identifiers, selection bounds, optional free text, and explicit cancellation.The backend must install an executor before advertising a tool;
ToolNameandToolRequestexpose inferred types without enabling runtime actions.Files
packages/agent-harness/src/tools.ts— Added (A), source: 202 lines (+202/-0). Adds backend definitions for organizations, members, usage, repositories, invitations, session search, attachment, start, continuation, stop, and progress. Adds Model Context Protocol (MCP) discovery and calls, plus web search and retrieval. App tools use the client executor:app.currentScreenis a read, while navigation, preferences, notifications, and settings declare side effects. Questions use the interaction executor. Invitations and session mutations have side effects. MCP calls use theunknowneffect and require a server identifier, tool name, configuration version, and definition version. MCP discovery includes input and output schemas; calls return content with optional structured content. Web search requests allow one through five results and default to five; page addresses permit onlyhttporhttps. Pages and attached session messages requireuntrusted: true. Screens allow quick chat, organization members, preferences, or an identified session; preferences allow onlyshowToolDetailsandreasoningDefaultExpanded. Notification results report granted, denied, undetermined, or unavailable permission; settings results report whether settings opened. Questions require unique choice identifiers, matching response identifiers, and valid selection bounds; free text cannot replace required selections.allowFreeTextdefaults to false; explicitallowCancellationcontrols dismissal, including questions that permit only cancellation. Answers reject duplicate or unknown choices and blank text; cancellation-only questions cannot return an empty answer.Tests: 1 test file added (A):
packages/agent-harness/src/policy.test.ts(622 lines; +622/-0). Covers replay, schema validation, questions, all 21 tools, and 54 effect/executor/mode/revision combinations. The implementer reports 172 targeted tests; the reviewer reports 158 policy tests and passing scoped checks.Generated: 0 files changed.
Visual Changes
Visual Changes: N/A
Verification
Manual verification: not run for this level because it adds inert portable commands, tool definitions, and policy only.
Full runtime verification runs on the completed stack tip.
Reviewer Notes
Human steps
No human steps apply before merge or after merge.
Worktrees
Kilo-Org/cloud./Users/igor/Projects/.worktrees/shared-agent-harness-3bb0.shared-agent-harness-3bb0-s3; base:origin/shared-agent-harness-3bb0-s2.Notes
E2E: This level adds inert portable commands, tool definitions, and policy only. Full runtime verification runs on the completed stack tip.
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 #5639 ← this PRshared-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 #5675 (tip)