Add PLAN.md and initialize pebbles with 8 issues

P0: sandbox networking, workspace reuse, log dir creation
P1: PR intake CLI, Marie Clawndo integration, workspace cleanup
P2: Telegram notifications, suppress rollout errors
This commit is contained in:
Josh Lehman 2026-03-05 00:24:23 -08:00
parent b0e0ff0082
commit 101f2d0447
No known key found for this signature in database
GPG Key ID: D141B425AC7F876B
4 changed files with 133 additions and 0 deletions

1
.pebbles/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
pebbles.db

3
.pebbles/config.json Normal file
View File

@ -0,0 +1,3 @@
{
"prefix": "caclawphony"
}

10
.pebbles/events.jsonl Normal file
View File

@ -0,0 +1,10 @@
{"type":"create","timestamp":"2026-03-05T08:24:14.538267Z","issue_id":"caclawphony-5fb","payload":{"description":"Codex workspace-write sandbox blocks network. pnpm install, gh pr, npm test all fail. Review worked via local git fallback but prepare-pr and merge-pr need network access. Options: (1) switch to danger-full-access, (2) pre-install deps in after_create hook, (3) hybrid — use hooks for setup, sandbox for agent. Start by testing danger-full-access in WORKFLOW.md thread_sandbox config, then evaluate hook-based approach for better security.","priority":"0","title":"Fix Codex sandbox networking for prepare/merge phases","type":"task"}}
{"type":"create","timestamp":"2026-03-05T08:24:14.606909Z","issue_id":"caclawphony-fa2","payload":{"description":"Currently each dispatch creates a fresh workspace via after_create hook. When an issue transitions Review→Prepare, the prepare agent needs access to .local/review.md from the review phase. Fix: in workspace.ex create_workspace, check if workspace dir already exists and skip after_create hook if so. The before_run hook should still run (to ensure correct branch checkout). Key file: elixir/lib/symphony_elixir/workspace.ex","priority":"0","title":"Implement workspace reuse across pipeline stages","type":"task"}}
{"type":"create","timestamp":"2026-03-05T08:24:14.670702Z","issue_id":"caclawphony-18b","payload":{"description":"LogFile module fails silently because log directory doesn't exist on first run. Add File.mkdir_p to LogFile.open or workspace creation. Key file: elixir/lib/symphony_elixir/log_file.ex","priority":"0","title":"Fix log directory creation for LogFile module","type":"task"}}
{"type":"create","timestamp":"2026-03-05T08:24:14.697017Z","issue_id":"caclawphony-432","payload":{"description":"Need a way to feed PRs into Linear from the command line. Create a mix task or script: caclawphony review 34511 → creates Linear issue titled 'PR #34511: \u003ctitle\u003e' in Review state, assigned to Caclawphony project. Should fetch PR title/description from GitHub via gh CLI. Also support batch: caclawphony review 34511 34554 29533. Key integration: Linear GraphQL API for issue creation.","priority":"1","title":"Build PR intake CLI (caclawphony review \u003cPR#\u003e)","type":"feature"}}
{"type":"create","timestamp":"2026-03-05T08:24:14.77437Z","issue_id":"caclawphony-87b","payload":{"description":"Marie Clawndo currently spawns maniple/Codex workers for review/prepare/merge. Replace with Linear issue creation so Symphony handles the agent lifecycle. When Josh says 'review PR #X', Marie creates a Linear issue in Review state. Marie monitors Linear for gate states (Review Complete, Prepare Complete) and notifies Josh. This replaces the maniple-based worker spawning for the PR pipeline.","priority":"1","title":"Wire Marie Clawndo to create Linear issues instead of maniple workers","type":"feature"}}
{"type":"create","timestamp":"2026-03-05T08:24:14.823043Z","issue_id":"caclawphony-f2f","payload":{"description":"After an issue reaches Done/Canceled/Duplicate, delete the workspace directory. Can be done in orchestrator.ex when detecting terminal state during poll, or via an after_run hook that checks issue state. Workspaces live in ~/Projects/caclawphony/workspaces/\u003cissue-identifier\u003e.","priority":"1","title":"Implement workspace cleanup on terminal state","type":"task"}}
{"type":"create","timestamp":"2026-03-05T08:24:14.87961Z","issue_id":"caclawphony-5c2","payload":{"description":"When an issue transitions to a gate state (Review Complete, Prepare Complete), send a Telegram notification via Marie Clawndo bot. Include: issue identifier, PR number, summary of review findings or prepare results. Can be implemented as a webhook from Linear or polling-based detection in the orchestrator.","priority":"2","title":"Add Telegram notifications on gate state transitions","type":"feature"}}
{"type":"create","timestamp":"2026-03-05T08:24:14.956359Z","issue_id":"caclawphony-9ed","payload":{"description":"Codex spews ~50 'state db missing rollout path' ERROR lines on startup from old sessions. These are harmless but noisy in symphony.log. Options: (1) clean up ~/.codex/ state DB, (2) filter these lines in the Codex stream output handler in codex_app_server.ex, (3) set Codex log level.","priority":"2","title":"Suppress stale rollout path errors on Codex startup","type":"task"}}
{"type":"dep_add","timestamp":"2026-03-05T08:24:18.975269Z","issue_id":"caclawphony-87b","payload":{"dep_type":"blocks","depends_on":"caclawphony-432"}}
{"type":"dep_add","timestamp":"2026-03-05T08:24:19.032248Z","issue_id":"caclawphony-5c2","payload":{"dep_type":"blocks","depends_on":"caclawphony-87b"}}

119
PLAN.md Normal file
View File

@ -0,0 +1,119 @@
# Caclawphony — Production Readiness Plan
## What Is Caclawphony?
A fork of [Symphony](https://github.com/openai/symphony) (Elixir) wired to Linear and Codex for automated PR review/prepare/merge on `openclaw/openclaw`.
**Current state:** Proof of concept working end-to-end. MAR-45 (test issue) completed the full Review cycle — Codex picked up the issue, cloned the repo, ran review-pr, produced `.local/review.md` + `.local/review.json`, transitioned the issue to "Review Complete", and Symphony detected the state change and stopped the agent.
## Architecture
```
Linear (issue tracker)
↕ polling (30s)
Symphony/Caclawphony (Elixir orchestrator)
↕ JSON-RPC over stdio
Codex app-server (agent runtime)
↕ shell + file I/O
openclaw/openclaw repo (PR workspace)
```
### Linear Workflow States
| State | Type | Description |
|-------|------|-------------|
| Triage | manual | New PRs land here |
| **Review** | active | Codex runs review-pr |
| Review Complete | gate | Human evaluates review |
| **Prepare** | active | Codex runs prepare-pr |
| Prepare Complete | gate | Human evaluates preparation |
| **Merge** | active | Codex runs merge-pr |
| Done | terminal | Merged successfully |
| Canceled | terminal | Abandoned |
| Duplicate | terminal | Superseded by another PR |
Active states trigger agent dispatch. Gate states require human intervention.
### Key Files
| File | Purpose |
|------|---------|
| `WORKFLOW.md` | Symphony config: tracker, hooks, codex settings, prompt template |
| `elixir/lib/symphony_elixir/` | Elixir source (orchestrator, agent_runner, tracker, workspace) |
| `elixir/lib/symphony_elixir/workspace.ex` | Modified: passes issue env vars to hooks |
| `SPEC.md` | Original Symphony spec (reference) |
## What Works
- [x] Linear polling picks up issues in active states
- [x] Workspace creation with git clone + PR checkout hooks
- [x] Codex app-server handshake (initialize → thread/start → turn/start)
- [x] State-aware prompt template (Review/Prepare/Merge conditional sections)
- [x] Agent executes review-pr skill, produces artifacts
- [x] Agent transitions issue state via Linear GraphQL
- [x] Symphony detects state change and stops agent (continuation check)
- [x] Issue env vars passed to hooks (SYMPHONY_ISSUE_ID, _IDENTIFIER, _TITLE, _STATE)
## What Needs Work
### P0 — Must Have for Production
1. **Codex sandbox networking** — Codex `workspace-write` sandbox blocks network access. `pnpm install`, `gh pr`, `npm test` all fail. Review worked because it fell back to local git analysis, but prepare-pr and merge-pr need network. Options:
- Switch to `danger-full-access` sandbox (works but no safety net)
- Use Symphony hooks for network-dependent setup (pre-install deps, fetch PR data)
- Contribute upstream Codex sandbox network allowlist
2. **Workspace reuse across pipeline stages** — Currently each dispatch creates a fresh workspace. Review → Prepare should reuse the same workspace so prepare-pr can read `.local/review.md`. Options:
- Key workspaces by issue ID, skip `after_create` if dir exists
- Workspace.ex `create_workspace` already does `File.mkdir_p` — just need to skip hooks on re-entry
3. **Log file creation**`LogFile` module fails silently because log dir doesn't exist. Need to ensure `log/` directory is created.
4. **Stale rollout path errors** — Codex spews ~50 "state db missing rollout path" errors on startup from old sessions. Harmless but noisy. Clean up `~/.codex/` state DB or suppress in log config.
### P1 — Important for Usability
5. **PR intake pipeline** — Need a way to feed PRs into Linear. Options:
- CLI command: `caclawphony review 34511` → creates Linear issue in Review state
- Batch import: read from `pb list` or `gh pr list` and create issues
- GitHub webhook → Linear issue creation (future)
6. **Marie Clawndo integration** — Marie should be able to create Linear issues when Josh says "review PR #X", monitor Symphony status, and report completions. Replace maniple worker spawning with Linear issue creation for the review→prepare→merge pipeline.
7. **Workspace cleanup** — After merge (terminal state), workspaces should be deleted. `after_run` hook or orchestrator cleanup on terminal state detection.
8. **Dashboard improvements** — Symphony's TUI dashboard works but could show more: current turn number, last activity timestamp, Codex token usage.
### P2 — Nice to Have
9. **PR-to-issue metadata** — Store PR number, author, URL in Linear issue description so agents have full context without parsing titles.
10. **Notification on completion** — When an issue reaches a gate state, notify via Telegram (Marie Clawndo bot).
11. **Multi-turn prepare-pr** — Prepare phase may need multiple Codex turns (fix code → run tests → iterate). Symphony supports `max_turns: 20` but we haven't tested multi-turn with state persistence.
12. **Metrics & reporting** — Track review quality, time-to-merge, agent success rate. Symphony has `StatusDashboard` with session totals — extend to persist.
## Configuration Reference
### WORKFLOW.md Codex Section
```yaml
codex:
command: codex app-server
approval_policy: on-failure # valid: untrusted, on-failure, on-request, never
read_timeout_ms: 30000 # handshake timeout (default 5000 too tight)
turn_timeout_ms: 1800000 # 30 min per turn
stall_timeout_ms: 300000 # 5 min stall detection
# thread_sandbox: workspace-write # default, valid: read-only, workspace-write, danger-full-access
```
### Linear State IDs (MAR team)
| State | ID |
|-------|----|
| Review | 2b76930f-a193-4b8f-ade5-97afed5414aa |
| Review Complete | 4f363475-bf45-48a0-9466-c38eef79aded |
| Prepare | 42036e0f-ab10-480b-9fe3-28d7cf2a6ef2 |
| Prepare Complete | 0671e7cc-46b5-424e-aed3-d9408c9d3eb9 |
| Merge | a976450a-2b6f-4fd1-90b4-f9f2eac30c92 |