Skip to content

Re-land cc_daemon spike for #80 (un-revert 3183fc6) Revert "Revert "Merge pull request #77 from SafeRL-Lab/feature/daemon…#81

Merged
chauncygu merged 1 commit intomainfrom
restore/daemon-spike
May 2, 2026
Merged

Re-land cc_daemon spike for #80 (un-revert 3183fc6) Revert "Revert "Merge pull request #77 from SafeRL-Lab/feature/daemon…#81
chauncygu merged 1 commit intomainfrom
restore/daemon-spike

Conversation

@chauncygu
Copy link
Copy Markdown
Contributor

Restores the spike originally merged via #77 and reverted in 3183fc6.

The original revert was about not pre-empting @mxh1999's foundation PR design choices. That concern is moot now that #80 ("F-1 foundation glue on top of cc_daemon spike") is explicitly built on top of the spike — feature/daemon-spike is its base, and #80 keeps the spike's contract modules (server.py, auth.py, originator.py, rpc.py, events.py, permission.py, methods.py) as-is per the spike's intent.

This PR is a verbatim un-revert. README.md and pyproject.toml auto-merged cleanly against the Docker fix (#73 follow-up) and feature/tab-accept-ghost-suggestion changes that landed since the original revert.

Once this lands, GitHub will recompute mergeability for #80 and the delete-vs-modify conflicts on cc_daemon/cli.py, cc_daemon/server.py, cheetahclaws.py will resolve themselves — no rebase needed on @mxh1999's side.

Refs #68, #74, #77, #80

@chauncygu chauncygu merged commit 63aff35 into main May 2, 2026
6 checks passed
@chauncygu chauncygu deleted the restore/daemon-spike branch May 2, 2026 20:21
dsqueri-temeriteecorp pushed a commit to dsqueri-temeriteecorp/cheetahclaws that referenced this pull request May 4, 2026
…ut flush, test floor

Four nits surfaced while smoke-testing F-1 (PR SafeRL-Lab#80) on real subprocesses.
None are blockers, but they each break a docs-promised path so they
deserve a dedicated polish PR rather than getting buried in F-2's diff.

1. `cheetahclaws daemon {status, stop, rotate-token}` now read the token
   path from the discovery file when `serve` was started with
   `--token-path`. `discovery.make_info()` accepts a new optional
   `token_path` keyword (schema stays at 1 — additive); `cli.cmd_serve()`
   records it only when the path overrides the default; new
   `commands.daemon_cmd._resolve_token_path()` prefers discovery and falls
   back to the default location for old discovery files / unset case.
   Previously these verbs always read `~/.cheetahclaws/daemon_token`,
   which silently created a *different* random token, then failed 401
   against the running daemon.

2. `python -m cc_daemon.cli --help` (and the `cheetahclaws spike-daemon
   --help` backward-compat alias) now print a usage banner and exit 0
   instead of `unknown subcommand: --help` / exit 2. The unknown-
   subcommand branch also includes the banner so users see how to
   recover. The PR description for SafeRL-Lab#80 said the spike-daemon alias was
   "preserved" — this closes the gap.

3. The three serve-mode startup prints (`token: …`, `cheetahclaws daemon
   listening on …`, `audit log: …`) now `flush=True` so they appear
   immediately when stdout is redirected to a file under `&`. Previously
   they sat in Python's 4 KB block buffer until the daemon exited,
   silently breaking the spike-notes' `--print-token > out.log &`
   workflow because the token line never reached disk.

4. `tests/e2e_daemon_skeleton.py::test_daemon_writes_discovery_and_token`
   token-length floor raised from `>= 32` to `>= 40`. `secrets.token_urlsafe(32)`
   yields ~43 chars, so the previous floor was loose enough that an
   accidental shrink to 16 raw bytes (~22 chars) would still ship green.

Tests: 10 new unit tests (4 covering `cli.main` dispatch, 4 covering
`_resolve_token_path`, 2 covering `discovery.make_info`'s new field).
Full suite 669/669 passing on `main`. End-to-end smoke verified all
three runtime fixes against `cheetahclaws serve --listen tcp://...`.

Docs:
* `README.md` docs index — adds row for RFC 0002 (foundation roadmap);
  refreshes the spike row to reflect the actual landing path
  (SafeRL-Lab#77 → reverted → re-landed via SafeRL-Lab#81); marks F-1 as merged via SafeRL-Lab#80.
* `docs/RFC/0002-daemon-foundation-roadmap.md` — F-1 status `OPEN`
  → `MERGED SafeRL-Lab#80`.
* `docs/architecture.md` — daemon section now mentions the optional
  `token_path` discovery field and notes that the daemon-control verbs
  use it.
* `docs/news.md` — May 2, 2026 entry covering the spike re-land and
  F-1 merge sequence, the polish nits, and the intentional "not in F-1"
  list (agent.run, bridges, SQLite, cost guardrails, agent-runner
  subprocess, macOS peer-cred).

Refs SafeRL-Lab#68, SafeRL-Lab#74, SafeRL-Lab#80, SafeRL-Lab#81

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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