Skip to content

feat(fleet): Book CLI-max wiring + BOOK-CLI-20260717 - #20

Closed
frankxai wants to merge 4 commits into
mainfrom
agent/book/cli-max-wiring
Closed

feat(fleet): Book CLI-max wiring + BOOK-CLI-20260717#20
frankxai wants to merge 4 commits into
mainfrom
agent/book/cli-max-wiring

Conversation

@frankxai

@frankxai frankxai commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Mission

Completed BOOK-CLI-20260717 from fleet/YOGA-BOOK-CLI-MAX-WIRING.md on baseline main@455b4e1.

Durable result

CLI wiring

  • Codex Terra high: live-ready; primary implementation lane
  • Claude Max: live-ready; independent final verifier PASS
  • Gemini Ultra: auth missing
  • OpenCode: auth missing
  • Fixed Claude 2.1.207 JSON-list live-probe regression with test

Verified

  • Product contract tests 2/2
  • TypeScript + focused ESLint
  • Next 16.2.6 production build with /challenge
  • Puppeteer 390×844: no overflow, CTA contained, keyboard reachable
  • Checkout fail-closed status announced
  • Hub unit suite green

Safety

Draft only. No main merge, force-push, paid checkout, or production deploy.

Summary by CodeRabbit

  • New Features

    • Added clearer CLI readiness and capacity reporting across supported tools.
    • Added completion receipts with verification outcomes, evidence, and safety checks.
    • Improved activity tracking for claimed and completed work.
  • Bug Fixes

    • Improved interpretation of live CLI checks, including responses with warnings or structured output.
    • Replaced noisy probe details with concise status and reason information.
    • Confirmed successful verification and fail-closed behavior through expanded automated checks.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The change adds structured live-result handling for Claude, Codex, Gemini, and simple CLI probes, tests the new parsing and status details, and records capacity, receipt, queue, heartbeat, identity, calendar, and activity updates for BOOK-CLI-20260717.

Changes

CLI mission completion

Layer / File(s) Summary
Structured CLI live probes
scripts/cli_capacity.py, tests/test_cli_capacity.py
CLI probes gate live checks, capture exit codes, classify results, and emit structured details without raw output; tests cover Claude parsing and live-detail payloads.
Capacity report and completion receipt
fleet/reports/cli-capacity/yoga-book.json, fleet/receipts/BOOK-CLI-20260717.json
Capacity and receipt records capture resource gates, CLI readiness, execution results, product metadata, verification runs, and evidence.
Mission state and activity updates
fleet/bus/queues/to-book.json, fleet/bus/heartbeats/yoga-book.json, fleet/bus/identity/yoga-book.json, fleet/activity/calendar/2026-07-17.md, fleet/activity/ACTIVITY-LOG.md
The queue entry is marked completed, heartbeat and identity timestamps are refreshed, and claim/completion events are appended with mission references.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 15.38% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is specific and matches the main theme of completing Book CLI-max wiring for BOOK-CLI-20260717.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/book/cli-max-wiring

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the activity logs, queues, and heartbeats to claim the BOOK-CLI-20260717 task, introduces a new capacity report for yoga-book, and refactors the Claude live probe verification in scripts/cli_capacity.py into a dedicated claude_live_ok helper function with accompanying tests. The review feedback highlights that duplicate heartbeat and identity files were accidentally added at the root level and should be removed. Additionally, it suggests optimizing the string-splitting logic in claude_live_ok to prevent potential index errors and expanding the unit tests to cover various edge cases and fallback scenarios.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread bus/heartbeats/yoga-book.json Outdated
Comment on lines +1 to +9
{
"machine_id": "yoga-book",
"hostname": "Starlight",
"status": "live",
"role": "frontend-innovation",
"telegram_bot": "@Hermesyogabookbot",
"notes": "BOOK-CLI-20260717 claimed; CLI-max wiring synced",
"at": "2026-07-17T13:57:04+00:00"
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This file appears to have been accidentally added at the root level of the repository. The canonical path for fleet bus files is under fleet/bus/heartbeats/yoga-book.json (which is also modified in this PR). Please remove this duplicate root-level file and ensure that any automated scripts write to the correct directory.

Comment thread bus/identity/yoga-book.json Outdated
Comment on lines +1 to +7
{
"machine_id": "yoga-book",
"hostname": "Starlight",
"node": "Starlight",
"platform": "Windows-11-10.0.26200-SP0",
"at": "2026-07-17T13:57:04+00:00"
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This file appears to have been accidentally added at the root level of the repository. The canonical path for fleet bus files is under fleet/bus/identity/yoga-book.json (which is also modified in this PR). Please remove this duplicate root-level file and ensure that any automated scripts write to the correct directory.

Comment thread scripts/cli_capacity.py Outdated
Comment on lines +123 to +126
try:
payload = json.loads(output.splitlines()[0])
except (json.JSONDecodeError, IndexError):
return "PONG" in output.upper()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using output.splitlines()[0] can be inefficient for very large outputs because it splits the entire string into a list of lines. Additionally, if the output is empty, it raises an IndexError which requires catching. We can optimize this by using output.split('\n', 1)[0], which only splits up to the first newline and always returns at least one element, eliminating the possibility of an IndexError.

Suggested change
try:
payload = json.loads(output.splitlines()[0])
except (json.JSONDecodeError, IndexError):
return "PONG" in output.upper()
try:
payload = json.loads(output.split('\n', 1)[0])
except json.JSONDecodeError:
return "PONG" in output.upper()

Comment on lines +37 to +39
def test_claude_live_probe_accepts_json_result_list(self) -> None:
output = '[{"type":"result","subtype":"success","is_error":false,"result":"PONG"}]'
self.assertTrue(cli_capacity.claude_live_ok(0, output))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To ensure the robustness of the new claude_live_ok helper, we should expand the test coverage to include edge cases such as empty lists, lists without a 'result' type dict (falling back to the last element), invalid JSON falling back to plain text, and non-zero exit codes.

Suggested change
def test_claude_live_probe_accepts_json_result_list(self) -> None:
output = '[{"type":"result","subtype":"success","is_error":false,"result":"PONG"}]'
self.assertTrue(cli_capacity.claude_live_ok(0, output))
def test_claude_live_probe_accepts_json_result_list(self) -> None:
# Valid result list
output = '[{"type":"result","subtype":"success","is_error":false,"result":"PONG"}]'
self.assertTrue(cli_capacity.claude_live_ok(0, output))
# Empty list
self.assertFalse(cli_capacity.claude_live_ok(0, '[]'))
# List with no "result" type dict, falling back to last element
output_fallback = '[{"type":"other"}, {"is_error":false,"result":"PONG"}]'
self.assertTrue(cli_capacity.claude_live_ok(0, output_fallback))
# Invalid JSON fallback to plain text check
self.assertTrue(cli_capacity.claude_live_ok(0, 'some warning\nPONG'))
self.assertFalse(cli_capacity.claude_live_ok(0, 'some warning\nFAIL'))
# Non-zero exit code
self.assertFalse(cli_capacity.claude_live_ok(1, 'PONG'))

@frankxai frankxai left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C940 gate: connection and live capacity are verified, and the Claude JSON-list parser fix is useful. Keep this draft until the product report + machine-readable receipt land. Before ready: (1) remove duplicate top-level bus/heartbeats and bus/identity files—fleet/bus is canonical; (2) sanitize capacity live_detail to structured status/reason only, excluding session IDs, tool inventories, cwd traces, and MCP headers; (3) include the First €100 branch/commit, exact acceptance exits, browser/mobile evidence, and PR/hold integration state. Do not merge/deploy from this wiring PR.

@frankxai

Copy link
Copy Markdown
Owner Author

Yoga Book operations update

Resolved all outstanding review blockers:

  • removed duplicate root bus/heartbeats and bus/identity files; fleet/bus remains canonical;
  • replaced raw live_detail output with structured status/reason only;
  • removed the committed Claude session/tool/cwd trace and Codex MCP/auth header text;
  • hardened Claude mixed-output parsing and rejected unstructured PONG noise;
  • added warning-prefix, nonzero-exit, empty-output, false-positive, and structured-detail regression tests.

Verification:

  • python -m unittest discover -s tests -v — 29/29 pass
  • Python compilation — pass
  • generated + committed JSON schema assertions — pass
  • targeted session/tool/cwd/MCP leak scan — pass
  • git diff --check — pass
  • independent Claude Opus verifier — PASS

The required product PR and machine-readable receipt are already present. No product merge or deployment is part of this control-plane PR.

@frankxai
frankxai marked this pull request as ready for review July 17, 2026 19:55
@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/cli_capacity.py`:
- Around line 117-134: Update _json_payload_from_mixed_output so each
successfully decoded JSON value advances the scan past the entire parsed
structure, preventing nested objects or arrays from being added as separate
candidates. Preserve returning the last complete top-level JSON payload when
surrounding CLI noise exists, while retaining the direct json.loads path for
clean output.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 51444b7e-7667-41b3-8bd9-641b5b47601d

📥 Commits

Reviewing files that changed from the base of the PR and between 455b4e1 and bc80929.

📒 Files selected for processing (9)
  • fleet/activity/ACTIVITY-LOG.md
  • fleet/activity/calendar/2026-07-17.md
  • fleet/bus/heartbeats/yoga-book.json
  • fleet/bus/identity/yoga-book.json
  • fleet/bus/queues/to-book.json
  • fleet/receipts/BOOK-CLI-20260717.json
  • fleet/reports/cli-capacity/yoga-book.json
  • scripts/cli_capacity.py
  • tests/test_cli_capacity.py

Comment thread scripts/cli_capacity.py
Comment on lines +117 to +134
def _json_payload_from_mixed_output(output: str) -> Any | None:
"""Return the last complete JSON value without preserving surrounding CLI noise."""
try:
return json.loads(output)
except json.JSONDecodeError:
pass

decoder = json.JSONDecoder()
candidates: list[Any] = []
for index, character in enumerate(output):
if character not in "[{":
continue
try:
payload, _ = decoder.raw_decode(output[index:])
except json.JSONDecodeError:
continue
candidates.append(payload)
return candidates[-1] if candidates else None

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Bug in parsing mixed output: nested JSON objects can be mistakenly extracted as the final payload.

The loop in _json_payload_from_mixed_output continues scanning every character of output. If the valid JSON payload contains a nested dictionary or array, the loop will also parse that inner structure and append it to candidates. Because the function returns candidates[-1], it will return the last nested object rather than the outermost JSON payload. For example, if the output is [{"type": "result", "result": "PONG", "metadata": {"foo": "bar"}}], the function will return {"foo": "bar"}, causing the PONG verification to fail.

To fix this, you can skip the characters that belong to the already-parsed JSON structure.

🐛 Proposed fix
 def _json_payload_from_mixed_output(output: str) -> Any | None:
     """Return the last complete JSON value without preserving surrounding CLI noise."""
     try:
         return json.loads(output)
     except json.JSONDecodeError:
         pass
 
     decoder = json.JSONDecoder()
     candidates: list[Any] = []
-    for index, character in enumerate(output):
+    index = 0
+    while index < len(output):
+        character = output[index]
         if character not in "[{":
+            index += 1
             continue
         try:
-            payload, _ = decoder.raw_decode(output[index:])
+            payload, length = decoder.raw_decode(output[index:])
         except json.JSONDecodeError:
+            index += 1
             continue
         candidates.append(payload)
+        index += length
     return candidates[-1] if candidates else None
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def _json_payload_from_mixed_output(output: str) -> Any | None:
"""Return the last complete JSON value without preserving surrounding CLI noise."""
try:
return json.loads(output)
except json.JSONDecodeError:
pass
decoder = json.JSONDecoder()
candidates: list[Any] = []
for index, character in enumerate(output):
if character not in "[{":
continue
try:
payload, _ = decoder.raw_decode(output[index:])
except json.JSONDecodeError:
continue
candidates.append(payload)
return candidates[-1] if candidates else None
def _json_payload_from_mixed_output(output: str) -> Any | None:
"""Return the last complete JSON value without preserving surrounding CLI noise."""
try:
return json.loads(output)
except json.JSONDecodeError:
pass
decoder = json.JSONDecoder()
candidates: list[Any] = []
index = 0
while index < len(output):
character = output[index]
if character not in "[{":
index += 1
continue
try:
payload, length = decoder.raw_decode(output[index:])
except json.JSONDecodeError:
index += 1
continue
candidates.append(payload)
index += length
return candidates[-1] if candidates else None
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/cli_capacity.py` around lines 117 - 134, Update
_json_payload_from_mixed_output so each successfully decoded JSON value advances
the scan past the entire parsed structure, preventing nested objects or arrays
from being added as separate candidates. Preserve returning the last complete
top-level JSON payload when surrounding CLI noise exists, while retaining the
direct json.loads path for clean output.

@frankxai

Copy link
Copy Markdown
Owner Author

Starlight Queen independent review — HOLD / REPAIR

Exact head reviewed: bc8092904d4f522ff9fec657873169c06155fd6d
Independent reviewer: Claude Sonnet 5 (claude-sonnet-5) — fresh read-only diff review
Local deterministic checks: git diff --check PASS; python3 -m unittest discover -s tests -p 'test_cli_capacity.py' -v PASS (8/8); python3 scripts/cli_capacity.py --help PASS.

The raw live_detail sanitization and Claude JSON-result parsing are useful, but this control-plane receipt should not merge yet because its readiness evidence is inconsistent across providers:

  1. claude_live_ok() rejects loose PONG noise, while _probe_codex, _probe_gemini, and _probe_simple still accept any output containing PONG. The newly committed Yoga Book capacity report and receipt label Codex ready / verified using that unhardened path. Apply one structured/exact-match success contract to every provider before publishing a verified readiness claim.
  2. The new tests cover helper functions but not probe wiring. Add mocked run() tests for each probe's live_checked, exit-code, structured disposition, and false-positive rejection path.

Required repair receipt: exact-head test output for those provider-level cases; updated JSON evidence generated by the hardened probes; fresh independent review. No product merge, deployment, or machine identity assertion is accepted from this PR until then.

Hermes Starlight Estate Merge Queen

@frankxai

frankxai commented Aug 7, 2026

Copy link
Copy Markdown
Owner Author

PR hospital triage 2026-08-07 — PARK

Disposition: park pending repair / freshness check.

  • Prior independent review was HOLD / REPAIR.
  • Touches YogaBook heartbeat/identity files that were just refreshed via merged chore(fleet): publish YogaBook estate and frontend lane receipt #34 — rebase risk.
  • Product lane it receipts (FrankX challenge work) is stale relative to current frontend queue.
  • Label suggestion: park · needs-rebase · stale-receipt

Not merged. Reopen merge path only after rebase onto post-#34 main and a fresh independent verify.

@frankxai

frankxai commented Aug 7, 2026

Copy link
Copy Markdown
Owner Author

Triage 2026-08-07: closing. BOOK-CLI-20260717 source PR #326 is closed-unmerged; queue item terminalized in #39. Do not revive this queue id.

@frankxai

frankxai commented Aug 7, 2026

Copy link
Copy Markdown
Owner Author

C940 Starlight Queen — HOLD / STALE-QUEUE (2026-08-07)

Exact head (at check): bc809290… class · mergeable=CONFLICTING

Findings

Verdict: HOLD — rebase/rewrite against current main or close as superseded after queue repair PR.

— Queen constrained coordinator

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