feat(agent-harness): hand coding work to authorized Cloud Agent sessions - #5733
feat(agent-harness): hand coding work to authorized Cloud Agent sessions#5733iscekic wants to merge 3 commits into
Conversation
| const prepared = basePrepareSessionNextSchema.parse({ | ||
| prompt: request.arguments.prompt, | ||
| model: request.arguments.modelId, | ||
| githubRepo: request.arguments.repository, |
There was a problem hiding this comment.
WARNING: Start with no repository throws an unsanitized ZodError
kilo.sessions.start treats repository as optional, and in-repo harness fixtures omit it. This always assigns that value to githubRepo and parses basePrepareSessionNextSchema, which requires exactly one repository source. A valid start call without repository (or with a non-owner/repo value) throws a raw ZodError before dispatched is set, so it is neither a sanitized BAD_REQUEST admission nor outcome_unknown.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
Code Review SummaryStatus: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (2 files)
Fix these issues in Kilo Cloud Reviewed by grok-4.6 · Input: 472.4K · Output: 28.7K · Cached: 1.5M Review guidance: REVIEW.md from base branch |
|
Closing: the owner stopped this workflow section. The branch is retained. |
No new behavior — this change does not make new session actions available to users.
Summary
executeHarnessCloudAgentadds authorizedkilo.sessions.start,kilo.sessions.continue, andkilo.sessions.stopmutations for personal and organization scopes using ordered dispatch identity.Starts initiate automatically in code mode; continuation preserves the session's model, mode, and variant, and continuation or stop refreshes authorization before dispatch.
Authoritative admission rejections remain terminal and sanitized; uncertain
ToolOutcomeresults retainoutcome_unknownand the operation identifier instead of exposing provider details.Files
apps/web/src/lib/agent-harness/cloud-agent.ts— Source, A (added), 171 insertions, no deletions; reuses the existing scoped routers and request schemas. Starts pass the requested prompt, model, and repository with stable operation and message identifiers. Validates continuation response identifiers and requires successful interruption replies; exposes only the linked Kilo session reference, never stream tickets. Preserves pre-dispatchCONFLICTerrors and delegateskilo.sessions.search,kilo.sessions.attach, andkilo.sessions.progressduring execution and reconciliation.reconcileHarnessCloudAgentvalidates storedReferencerecords, ownership, scope, and session linkage; creation succeeds only with a completed ledger or nonterminal evidence plus an exact user turn.Continuation recovery requires the exact message identifier, user role, and joined text; missing evidence, failed terminal records, and lost stop replies remain unknown.
The scheduler must execute once and reconcile without redispatch, even after ledger expiry; session allocation, idle status, or disappearance cannot prove completion.
Files
apps/web/src/lib/agent-harness/cloud-agent.test.ts— Test, A (added), 265 insertions, no deletions; covers both scopes, private output, admission errors, revoked membership and grants, scope mismatches, and model eligibility. Exercises preparation, admission, and response loss, ledger states, exact user turns, mismatched replies, and empty read delegation without repeated effects.Tests: 1 test file added,
cloud-agent.test.ts, with 265 insertions and no deletions.Generated: 0 files changed.
Visual Changes
Visual Changes: N/A
Verification
This level has no reported manual tests because the adapter does not activate the harness.
Live provider verification belongs to A32 and bot-e2e.
Reviewer Notes
Kilo-Org/cloud:/Users/igor/Projects/.worktrees/shared-agent-harness-3bb0.shared-agent-harness-3bb0-s22...shared-agent-harness-3bb0-s23.oxlint,oxfmt --check, and Jest. The mutation and consumed context suites report 122 passing tests.Human steps: None required before merge or after merge.
Runtime verification remains pending at the stack tip. This level adds mutation adapters without activating the harness.
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 #5678shared-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 #5704shared-agent-harness-3bb0-s17— feat(integrations): bound repository transport for harness reads #5710shared-agent-harness-3bb0-s18— feat(integrations): expose bounded authorized repository reads #5714shared-agent-harness-3bb0-s19— feat(agent-harness): expose named authorized resource reads #5718shared-agent-harness-3bb0-s20— feat(sessions): bound history transport for harness reads #5724shared-agent-harness-3bb0-s21— feat(agent-harness): read scoped Cloud Agent context and progress #5726shared-agent-harness-3bb0-s22— fix(agent-harness): preserve ordered Cloud Agent dispatch identity #5731shared-agent-harness-3bb0-s23— feat(agent-harness): hand coding work to authorized Cloud Agent sessions #5733 ← this PRshared-agent-harness-3bb0-s24— feat(agent-harness): authorize scoped MCP gateway connections #5737shared-agent-harness-3bb0-s25— feat(agent-harness): bound MCP gateway transport in the Worker #5740shared-agent-harness-3bb0-s26— feat(agent-harness): execute validated remote MCP tools #5743shared-agent-harness-3bb0-s27— refactor(exa): share provider dispatch and usage recording #5746shared-agent-harness-3bb0-s28— feat(agent-harness): authorize bounded web provider requests #5747shared-agent-harness-3bb0-s29— feat(agent-harness): normalize web sources and preserve citations #5749shared-agent-harness-3bb0-s30— feat(agent-harness): define closed internal operation contracts #5753shared-agent-harness-3bb0-s31— feat(agent-harness): authorize internal maintenance operations #5754shared-agent-harness-3bb0-s32— feat(agent-harness): authorize named Kilo operation dispatch #5755shared-agent-harness-3bb0-s33— feat(agent-harness): authorize internal provider operations #5757shared-agent-harness-3bb0-s34— feat(agent-harness): secure the internal operations endpoint #5758shared-agent-harness-3bb0-s35— feat(agent-harness): bound and sanitize model streams #5767shared-agent-harness-3bb0-s36— feat(agent-harness): secure billed model inference #5776shared-agent-harness-3bb0-s37— test(agent-harness): cover model gateway security boundaries #5777 (tip)