Files
boshu2__agentops/cli/cmd/ao/exit_codes.go
Bo 010ade393c feat(rip)!: carve the daemon — delete internal/daemon + agentopsd, GC is the substrate (soc-2rtm0 #daemon-carve wave5) (#515)
Wave 5 of 5 (the finale) of the orchestration-substrate retirement
(soc-2rtm0). AgentOps stops being the orchestration substrate; GC is the
substrate. The always-on out-of-session supervisor (the daemon) is
deleted; GC's controller replaces it. Features that ran AS daemon jobs
(wiki build, llmwiki loop) keep their BUILDER CORE (in-process /
GC-callable) but lose the daemon-job-executor wrapper.

## Deleted
- `cli/internal/daemon/` — the whole package (71 .go files + testdata +
AGENTS.md).
- `cli/cmd/ao/`: `agentopsd.go`, `daemon_jobs.go`, `daemon_soak.go`,
`daemon_fake_policy.go`, `rpi_phased_daemon.go` (+ their tests).
- Daemon-only tests: `rpi_status_daemon_test.go`,
`rpi_integration_test.go`, `doctor_product_runtime_test.go`.
- `internal/doctor/fix_daemon.go` (+test) + the daemon
runtime/ledger-health/telemetry/openclaw-consumer checks and the
`--product-runtime` flag in `doctor.go` (the `ao doctor` command itself
is KEPT).
- The `ao daemon`/`agentopsd` command registration (went with
`agentopsd.go`).
- Daemon test scripts: `scripts/validate-daemon-product-e2e.sh`,
`tests/scripts/test-daemon-product-e2e.sh`.

No daemon CI gates existed in `validate.yml` / `ci-jobs.yaml` to remove
(prior waves had already cleared them).

## Severed (KEEP features — builders stay, daemon-job-executor wrappers
removed)
- **wiki** (`internal/wiki/pipeline.go`): removed the
`daemon.JobExecutor` impl
(`JobTypes`/`RunJob`/`PipelineJobSpec`/`parsePipelineJobSpec`/`jobResultFromOutcome`)
+ the daemon import. The builder core — `WikiPipeline`, `RunStage`,
`SelectStage`, the ingest/query/lint runners — is untouched; `ao wiki
lint/query/promote` run in-process.
- **llmwiki** (`internal/llmwiki/executor.go`): removed
`LLMWikiLoopExecutor` + `LoopJobSpec` + the daemon import. KEPT the leaf
builder core in the same file (`Stage`, stage constants, `StageHandler`,
`StageResult`, `DefaultLintIntervalHours`, `SelectStage`,
`rawHasNewerFiles`, `lintIsStale`) — `stages.go` (the real handlers) and
`internal/scope` depend on these. No new package needed; the shared
types already lived in this leaf file.
- **rpi status** (`cmd/ao/rpi_status.go`): severed the
`--daemon`/`--daemon-url`/`--daemon-fallback` read path. `ao rpi status`
now reads only the local run registry (`.agents/rpi/runs/`) — a KEEP
feature. Relocated the tiny `cobraContext` helper here (it lived in the
deleted `agentopsd.go`, only consumer is this file).
- **rpi phased** (`cmd/ao/rpi_phased.go`, `rpi_phased_context.go`):
removed the `--daemon-submit` short-circuit + flags + the
`DaemonSubmit/URL/Token/Fallback` opts fields (only consumer was the
deleted submit path).

## Lost capabilities (intentional, daemon-only)
- `ao rpi status --daemon` (read RPI job state from agentopsd) and `ao
rpi phased --daemon-submit` (queue an RPI run to agentopsd).
- llmwiki `LoopJobSpec.AllowPlaceholderOutputs` opt-in gating (the
placeholder-output-disabled skip) — that gate lived in the removed
daemon-job wrapper, not the stage handlers.
- `ao doctor` daemon runtime/ledger-health/telemetry/openclaw-consumer
checks + `--product-runtime`.

## Verification (all green)
- `gofmt -l` clean (my files), `go build ./...`, `go vet ./...`, `go
test ./...` → 11920 passed, 0 failed, 65 packages.
- `scripts/release-smoke-test.sh` → 108 pass / 0 fail (EXPECTED_COMMANDS
never listed daemon; no scrub needed).
- `tests/windows/test-windows-smoke.ps1` → `Invoke-GoTest` list has no
`./internal/daemon` ref (nothing to scrub).
- `internal/quality/stale_refs.go` → no daemon/agentopsd
deprecated-command entries (`TestDoctorStaleReplacementsExist` passes).
- `tests/smoke-test.sh`, `tests/cli/test-json-flag-consistency.sh`
(15/0), `scripts/test-agentops-contract-canaries.sh` (failures=0 after
fixing the cli-command-surface heading-count fixture/eval 68/179/247 →
67/172/239 and the `ao daemon` refs in `skills/dream` +
`skills-codex/dream`).
- Regenerated `cli/docs/COMMANDS.md` + `registry.json`;
`regen-codex-hashes.sh --check` clean; `validate-ci-policy-parity.sh`
PASS; doc link/learning-ref checks pass; `heal.sh --strict` clean.

Diff stat: 113 files changed, 95 insertions, 34,978 deletions.

Closes-scenario: soc-2rtm0#cascade-rip
Bounded-context: BC5-Runtime
Evidence: .agents/discovery/2026-05-24-rip-caller-map.md
2026-05-24 17:11:20 -04:00

64 lines
2.8 KiB
Go

// Package main: Olympus exit-code protocol constants.
//
// These constants define the quest-supervisor exit-code contract ported from
// the Olympus zeus daemon (source: olympus CLAUDE.md and cmd/ol Exit()
// literals). They are documented in
// .agents/findings/2026-04-29-existing-agentopsd-contract.md, which classifies
// each value as MERGE-compatible with the pre-Olympus agentopsd contract
// (zero conflicts: existing agentopsd emits only 0 on clean shutdown and 1 on
// error via cobra defaults; codes 2 and 42 are unused at the process level).
//
// Bead: agentops-91i (parent epic agentops-tqc, Olympus → agentopsd extraction).
//
// IMPORTANT: these constants are markers for callers and tests. Adding a new
// caller that actually emits 42 from agentopsd's own success path would be a
// BREAKING change vs the existing contract — see the finding doc's
// "Compatibility notes" section before wiring them into the daemon binary.
// practices: [sre, resilience-patterns]
package main
// Olympus quest-supervisor exit codes.
const (
// CodeMoreWork (0) — Olympus zeus protocol. The current step finished
// successfully and the supervisor should continue with the next quest
// item. Per .agents/findings/2026-04-29-existing-agentopsd-contract.md,
// this is COMPATIBLE with existing agentopsd shutdown semantics (which
// also uses 0 for clean shutdown; the Olympus reading is a strict
// superset that callers opt into).
CodeMoreWork = 0
// CodeError (1) — Olympus zeus protocol. The runner is stuck or hit an
// error the supervisor should treat as a halt-and-investigate. Per the
// finding doc, this is COMPATIBLE with cobra's default error-exit
// behavior (any RunE-returned error becomes exit 1).
CodeError = 1
// CodeBeadClaimed (2) — Olympus zeus protocol. A bead was claimed but
// needs a separate worker process to make progress. Per the finding
// doc, this is non-overlapping with the pre-Olympus agentopsd behavior:
// no current code path emits 2 at the process level. (The historical
// daemon's only `return 2` lived in dreamStageOrder, an int-ordering
// helper rather than a process exit; that package was removed in the
// daemon carve, soc-2rtm0 wave 5.)
CodeBeadClaimed = 2
// CodeQuestComplete (42) — Olympus zeus protocol. The full quest is
// finished; the supervisor should not loop again. Per the finding doc,
// this is non-overlapping with existing agentopsd shutdown semantics
// (which uses 0 for clean shutdown; 42 is currently unused).
CodeQuestComplete = 42
)
// IsTerminal reports whether the supervisor should stop looping after
// observing this exit code. CodeQuestComplete and CodeError are terminal;
// CodeMoreWork and CodeBeadClaimed mean keep going (with or without a worker
// hop).
func IsTerminal(code int) bool {
switch code {
case CodeQuestComplete, CodeError:
return true
default:
return false
}
}