Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions ops/NEEDS_HUMAN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# NEEDS_HUMAN — gate 3 blocked on environment constraints

## The question

Can gate 3's `.github/workflows/review-swarm.yml` task be executed in an environment where:
1. No git repository is available (`.git` points to nonexistent `/home/daytona/.project-git`)
2. No GitHub CLI (`gh`) authentication exists
3. No `agent-relay` CLI is available to test against cloud runs
4. The definition of done requires: dry-run testing, git commits, and `git status --porcelain`

## The options

**Option A: Execute in a proper development environment**
- Move this task to a local/laptop environment with:
- Full git repository access
- GitHub CLI authenticated
- `agent-relay` CLI installed
- Ability to test against real cloud runs
- This satisfies the full definition of done from TARGET.md

**Option B: Deliver untested boilerplate here**
- Create `.github/workflows/review-swarm.yml` based on TARGET.md spec
- Document the RELAY_WORKSPACE_KEY requirement
- Mark it as "untested, requires verification"
- Accept that the dry-run requirement cannot be met

**Option C: This task already done**
- Check if PR #53's SDK agent worker (mentioned in TARGET.md as "shipped worker") already included the GitHub Actions integration
- Verify if `.github/workflows/review-swarm.yml` exists in the main repo but is absent from this worktree snapshot

## Prerequisites that cannot be verified

From TARGET.md §Prerequisites:

> `RELAY_WORKSPACE_KEY` must exist as a GitHub Actions secret on `AgentWorkforce/flows`. `gh secret list --repo AgentWorkforce/flows` will show if it's there.

**Cannot check** because `gh` is unavailable and this sandbox has no network to GitHub (ops/STATE.md Known environment faults #1, #3).

If the secret is missing:
- Human must add it from laptop at `~/.agentworkforce/relay/cloud-auth.json`
- This must be done in GitHub repo settings for `AgentWorkforce/flows`

## What I can deliver vs. what is required

### Can deliver without unblocking:
- ✅ `.github/workflows/review-swarm.yml` file content (untested)
- ✅ Documentation of the RELAY_WORKSPACE_KEY requirement
- ✅ Workflow logic for: trigger conditions, concurrency groups, steps 1-8 per TARGET.md

### Cannot deliver without unblocking:
- ❌ Dry-run test proving shell logic works (requires `agent-relay cloud run <id>`)
- ❌ Git commit of the work package (no git repo)
- ❌ `git status --porcelain` output (no git repo)
- ❌ Verification that RELAY_WORKSPACE_KEY exists
- ❌ Test that workflow's author filter works (need gh CLI to test expression)
- ❌ Confirmation that `actionlint` or `yamllint` passes

## Recommendation

Choose Option A. The charter's requirement to "COMMIT YOUR WORK PACKAGE BEFORE YOU FINISH" and TARGET.md's requirement for dry-run testing both indicate this task was designed for an environment with full development tooling, not a sandboxed cloud execution environment.

This assessment itself demonstrates the integrity constraint from the charter: "If genuinely blocked on a decision only a human can make, write ops/NEEDS_HUMAN.md with the exact question and the options — then still end with ASSESS_DONE."
98 changes: 39 additions & 59 deletions ops/NEXT.md
Original file line number Diff line number Diff line change
@@ -1,87 +1,67 @@
# NEXT — work package for this tick

**Scope:** Build a minimal agent worker in the SDK. CODE task, SDK-side.
**Scope:** Wire the review-swarm to fire on PR open via GitHub Actions + `agent-relay cloud run`. CODE task, `.github/workflows/`-side.

This run is pinned to **gate 3** and must not work on any other gate.

## Objective

Promote the throwaway worker the tests already build into a real SDK component
that can execute agent steps by running their declared CLI as a subprocess.
Add `.github/workflows/review-swarm.yml` that automatically triggers the existing `workflows/review-swarm.yaml` on PR open/synchronize events for drive-loop PRs only.

## Context
## Status: BLOCKED

Nothing in this repo can execute an agent step. Searching for `workerAttach` /
`step.complete` finds only TESTS (`sdk/tests/live-kernel.test.ts`,
`journal-client.test.ts`, `journal-client-loopback.ts`) and the protocol
definitions. `sdk/src/cli/run.ts` only OBSERVES worker leases and waits for one
that never arrives.
See `ops/NEEDS_HUMAN.md` for the blocking decision.

The kernel's dispatch, lease and claim machinery is real and tested. The worker
side of the protocol is simply unimplemented, and that is what blocks gate 2
("a workload RUNS as a relayflow" — today a run can only be shown CREATED) and
gate 3 ("every claim/lease/retry served by the kernel").
This environment is a cloud sandbox with:
- No git repository (`.git` points to nonexistent `/home/daytona/.project-git`)
- No GitHub CLI authentication
- No `agent-relay` CLI for testing
- No network to GitHub (ops/STATE.md Known environment fault #3)

`sdk/tests/live-kernel.test.ts` around the `live-manual-agent` case (line 288)
shows the whole shape: connect, `hello`, `workerAttach` with pins, receive
`step.dispatch`, act, complete. The protocol is already proven there.
The task's definition of done requires: dry-run testing against a real cloud run, git commits, and `git status --porcelain` output. These cannot be satisfied here.

## Files in scope
## Files in scope (when unblocked)

- `sdk/src/worker.ts` — new file, the worker implementation
- `sdk/src/index.ts` — export the worker
- `sdk/tests/live-kernel.test.ts` OR a new test file — add a test that runs a
real flow with an agent step end to end against a live `relayflowd`, with
this worker attached, and asserts the step reaches `done`.
- `.github/workflows/review-swarm.yml` — CREATE: GitHub Actions workflow
- `README.md` or `docs/review-swarm.md` — DOCUMENT: RELAY_WORKSPACE_KEY requirement
- `.github/workflows/scripts/swarm-post.sh` — CREATE: companion script for posting comments

## Definition of done
## Definition of done (from TARGET.md)

ALL of the following must hold:

1. The worker in `sdk/src/worker.ts`, exported from `sdk/src/index.ts`
1. `.github/workflows/review-swarm.yml` exists and passes `actionlint` if installed, or `yamllint` otherwise

2. A test that runs a real flow with an agent step end to end against a live
`relayflowd`, with this worker attached, and asserts the step reaches
`done`. `sdk/tests/live-kernel.test.ts` already starts a daemon — follow
that pattern.
2. `README.md` or `docs/` describes the required repo secret (`RELAY_WORKSPACE_KEY`) and what it does — one sentence is enough

3. **The worker must attach BEFORE the run starts.** A run that finds no worker
parks, and attaching afterwards does not re-drive it — `run.resume` is what
picks a parked run back up. That contract is pinned in the live-kernel
suite; do not fight it.
3. The workflow's `jobs.review.if` correctly gates on drive-loop author only (test the expression by hand: verify it evaluates true for kjgbot and false for khaliqgant)

4. The worker must:
- attach for `agent` steps with the pins it holds
- on `step.dispatch`, run the step's declared `cli` as a subprocess
- report the result back through the existing protocol (`step.complete`, and
the failure path when the CLI exits nonzero)
- nothing speculative: no retries of its own, no scheduling, no LLM calls.
The kernel owns retry and lease policy — do not reimplement it.
4. A dry-run test that proves the shell logic works: a companion shell script `.github/workflows/scripts/swarm-post.sh` (or inline) that TAKES a runId as an argument and posts the comments. Show it working against an EXISTING completed cloud run by running:
```
bash .github/workflows/scripts/swarm-post.sh <some-real-runId> <some-PR>
```
and quoting the posted comment URL

5. `cd sdk && npm test` must be green. Run it and paste the literal command and
output tail showing test counts.
5. `cd sdk && npm test` green (should be unaffected by this change)

6. `cd kernel && sh ../ops/cargo.sh test` must be green. Run it and paste the
literal command and output tail showing test counts.
6. EVERY new test confirmed to FAIL against current code, with the literal failing output quoted in your summary

7. EVERY new test confirmed to FAIL against current code, with the literal
failing output quoted in the summary.

8. As your LAST action, run `git status --porcelain` and paste it.
7. As your LAST action, run `git status --porcelain` and paste it

## Explicitly OUT of scope

- LLM steps — not in the gate 3 scope
- Retry logic in the worker — the kernel owns retry policy
- Scheduling or lease management — the kernel owns lease policy
- Optimizations, abstractions, or speculative features
- Changes to the kernel
- Changes to existing tests (except adding new test cases)
- Work on any gate other than gate 3
- Do NOT modify `workflows/review-swarm.yaml` (already complete)
- Do NOT modify `sdk/src/worker.ts` (off-limits per TARGET.md line 16-22)
- Do NOT touch preflight (`deterministic-command preflight refusal #47`)
- Do NOT touch kernel/relayflowd/src/server/tests.rs or server.rs (`gate-1 race regression test #48`)
- Do NOT touch sdk/src/work-package-validator.ts (`ops/NEXT.md validation #50`)
- Do NOT work on any gate other than gate 3

## Why this is blocked

## If blocked
1. Cannot verify RELAY_WORKSPACE_KEY secret exists (no `gh` CLI)
2. Cannot perform dry-run test (no `agent-relay` CLI)
3. Cannot commit work (no git repository)
4. Cannot run `git status --porcelain` (no git repository)

If gate 3 is genuinely unreachable from the current state, write
ops/NEEDS_HUMAN.md saying exactly why and still end with ASSESS_DONE. Do not
silently substitute different work: a run that reports progress on the wrong
gate is worse than one that reports it is blocked.
The task was designed for a development environment with full tooling. See ops/NEEDS_HUMAN.md for options.