Skip to content

chore(agent-harness): register workspaces and enforce CI boundaries - #5632

Open
iscekic wants to merge 1 commit into
mainfrom
shared-agent-harness-3bb0
Open

chore(agent-harness): register workspaces and enforce CI boundaries#5632
iscekic wants to merge 1 commit into
mainfrom
shared-agent-harness-3bb0

Conversation

@iscekic

@iscekic iscekic commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

No new behavior — This foundation adds development checks and prepares later agent work without changing how people use the product.


Summary

@kilocode/agent-harness exposes only AGENT_HARNESS_PROTOCOL_VERSION = 1; this change does not implement the harness runtime or client hosts. Its export map reserves @kilocode/agent-harness/react and TypeScript subpaths, and blocks test imports. React 19 stays optional so non-React consumers can use the portable core without a React dependency.

Files
  • packages/agent-harness/package.json — registers the private package, exports, gateway/Zod dependencies, and test, typecheck, lint, and format commands (source; added; 38 changed lines).
  • packages/agent-harness/src/version.ts — defines protocol version 1 (source; added; 1 changed line).

The portable-core rule permits only the shared core, @kilocode/mcp-gateway, and Zod; TypeScript rejects ambient browser and Node globals. The no-client-executors-or-credentials rule blocks transitive server, credential, database, and model-execution imports from browser, native, Quick Chat, and React entrypoints. The checks use dependency-cruiser to resolve aliases and symlinks, scan present entrypoints, and exercise forbidden dependencies through temporary fixtures.

Files
  • packages/agent-harness/tsconfig.json — limits strict checks to ES2022 without ambient platform types; excludes tests and emits no files (source; added; 15 changed lines).
  • packages/agent-harness/vitest.config.ts — runs the shared tests in Node (source; added; 3 changed lines).
  • packages/agent-harness/src/boundaries.test.ts — adds live-source and transitive-import checks, including browser globals and aliased credential imports (test; added; 184 changed lines).

@kilocode/agent-harness-worker adds a private Worker workspace with model clients, Model Context Protocol (MCP), validation, authentication, routing, and storage dependencies. The cloudflareTest setup uses remoteBindings: false and nodejs_compat, with optional Wrangler settings to keep checks local. passWithNoTests: true permits setup checks before any Worker entrypoint or runtime test exists; this change adds no deployment.

Files
  • services/agent-harness/package.json — adds source exports, excludes tests, and registers the shared contract, runtime dependencies, and Worker tools (source; added; 39 changed lines).
  • services/agent-harness/tsconfig.json — enables strict ES2022 checks with Worker/Node types, JSON imports, and generated-binding support (source; added; 15 changed lines).
  • services/agent-harness/vitest.config.ts — sets local compatibility to 2026-06-05, loads optional Wrangler settings, and permits an empty test suite (source; added; 17 changed lines).

web and kilo-app now depend on @kilocode/agent-harness, with dependenciesMeta setting injected: true for mobile React isolation. The web dependency set adds idb, Testing Library, fake-indexeddb, and jest-environment-jsdom for browser storage and component tests. These dependencies prepare host work without adding a client host or changing Quick Chat behavior.

Files
  • apps/mobile/package.json — adds the harness dependency and pnpm injection for the mobile React peer (source; modified; 4 changed lines).
  • apps/web/package.json — adds the harness, idb, @testing-library/dom, @testing-library/jest-dom, @testing-library/react, @testing-library/user-event, fake-indexeddb, and jest-environment-jsdom (source; modified; 8 changed lines).

Continuous integration (CI) now accepts every target branch for pull_request events, while mobile checks retain their path filters. @kilocode/agent-harness changes select web and mobile checks; test:agent-harness-ci runs the setup and import checks before typechecking. push remains limited to main, so stacked pull requests receive checks without expanding push triggers.

Files
  • .github/workflows/ci.yml — removes the target-branch filter, selects web checks for harness changes, and runs the contract command before typechecking (source; modified; 5 changed lines).
  • .github/workflows/kilo-app-ci.yml — removes the pull-request target filter and adds harness paths for push and pull-request checks (source; modified; 3 changed lines).
  • package.json — adds the combined Node contract and Vitest boundary command (source; modified; 1 changed line).
  • scripts/agent-harness-ci.test.mjs — covers workflow contracts, workspace imports, stacked/push/local selection, and Jest component/server fixtures (test; added; 220 changed lines).

pull_request workspace selection now reads pull_request.head.sha and pull_request.base.sha, rather than comparing the checkout with origin/main. Dependency, package, and workspace checks use the target merge base and actual head, excluding unrelated base changes and synthetic merge changes. Invalid pull-request revisions fail explicitly; push and local fallback behavior stays unchanged.

Files
  • scripts/changed-workspaces.sh — passes the target/head revision pair through every change detector and preserves push/local fallbacks (source; modified; 23 changed lines).

testMatch now discovers Quick Chat tests written in TSX without adding unrelated component tests. The TSX transform uses the automatic React runtime and keeps decorator metadata; other TypeScript and JavaScript transforms remain separate. testEnvironment remains node; component tests opt into jsdom instead of changing server-test behavior.

Files
  • apps/web/jest.config.ts — adds scoped TSX discovery and a separate @swc/jest transform while retaining the Node default (source; modified; 21 changed lines).

Tests: 2 added files, 404 added lines — packages/agent-harness/src/boundaries.test.ts (184) and scripts/agent-harness-ci.test.mjs (220).
Generated: 1 modified lockfile — pnpm-lock.yaml (418 changed lines).


Visual Changes

Visual Changes: N/A

Verification

No manual end-to-end (E2E) tests ran. This level changes no user-facing runtime behavior.

Reviewer Notes

Automated checks

  • Recorded verification passed 8 implementation checks and 9 read-only checks.
  • The checks cover CI contracts, import boundaries, both workspace typechecks, and local Worker configuration startup.
  • Scoped lint, formatting, shell syntax, and whitespace checks also passed.
  • Worker verification covers configuration only; this level contains no Worker runtime tests.
  • The read-only verification did not include frozen-lockfile installation or repository-wide checks.

Human steps

No human step is required before or after merge for this foundation level.

  • After merge, before later runtime activation: Provision the scoped Worker/server resources.

Scope

  • Repository: Kilo-Org/cloud.
  • Worktree: /Users/igor/Projects/.worktrees/shared-agent-harness-3bb0.
  • Branch: shared-agent-harness-3bb0; base: origin/main; commit: 4c4cd031b8dca9e119eaa4d15165de3a23b24f1d.
  • Level 1, a1: 17 changed files, 987 insertions, and 28 deletions.
  • File sizes count added and removed lines from the supplied statistics.

Notes

E2E: This level changes no user-facing runtime behavior. Full backend, browser, iOS, and Android 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.

  1. shared-agent-harness-3bb0chore(agent-harness): register workspaces and enforce CI boundaries #5632 ← this PR
  2. shared-agent-harness-3bb0-s2feat(agent-harness): define portable domain and snapshots #5637
  3. shared-agent-harness-3bb0-s3feat(agent-harness): define commands tools and permission policy #5639
  4. shared-agent-harness-3bb0-s4feat(agent-harness): share client state and cursor recovery #5643
  5. shared-agent-harness-3bb0-s5feat(agent-harness): persist command intents and execution receipts #5647
  6. shared-agent-harness-3bb0-s6feat(db): add harness ingress grants and retirement fences #5655
  7. shared-agent-harness-3bb0-s7feat(agent-harness): deliver legacy history and project durable text #5659
  8. shared-agent-harness-3bb0-s8feat(agent-harness): authorize durable grants and registered clients #5662
  9. shared-agent-harness-3bb0-s9feat(agent-harness): fence retirement and retry payload cleanup #5667 (tip)

@iscekic iscekic self-assigned this Aug 28, 2026
@kilo-code-bot

kilo-code-bot Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Executive Summary

Unused @kilocode/agent-harness on mobile will fail the knip check:unused job this PR now triggers.

Overview

Severity Count
CRITICAL 1
WARNING 0
SUGGESTION 0

Fix these issues in Kilo Cloud

Issue Details (click to expand)

CRITICAL

File Line Issue
apps/mobile/package.json 37 Unused @kilocode/agent-harness will fail mobile knip check:unused
Files Reviewed (17 files)
  • .github/workflows/ci.yml
  • .github/workflows/kilo-app-ci.yml
  • apps/mobile/package.json - 1 issue
  • apps/web/jest.config.ts
  • apps/web/package.json
  • package.json
  • packages/agent-harness/package.json
  • packages/agent-harness/src/boundaries.test.ts
  • packages/agent-harness/src/version.ts
  • packages/agent-harness/tsconfig.json
  • packages/agent-harness/vitest.config.ts
  • pnpm-lock.yaml
  • scripts/agent-harness-ci.test.mjs
  • scripts/changed-workspaces.sh
  • services/agent-harness/package.json
  • services/agent-harness/tsconfig.json
  • services/agent-harness/vitest.config.ts

Reviewed by grok-4.6 · Input: 239.5K · Output: 33.9K · Cached: 1.5M

Review guidance: REVIEW.md from base branch main

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.

1 participant