Skip to content

feat(progress): relay concise cycle updates - #134

Merged
datacas merged 2 commits into
mainfrom
issue-131-progress-relay
Sep 30, 2026
Merged

datacas merged 2 commits into
mainfrom
issue-131-progress-relay

Conversation

@datacas

@datacas datacas commented Sep 30, 2026

Copy link
Copy Markdown
Owner

Closes #131

Diagnosis

Work units

Unit Behaviour Files Tests Verification Rollback
WU-1 Emit one-line progress snapshots after a timezone-aware cursor; print the first monitoring command for detached runs; document and enforce a shared progress relay rule. scripts/cycle_status.py, scripts/run_cycle.py, skills/cc-orchestrator/SKILL.md, skills/cc-orca-orchestrator/SKILL.md, scripts/validate-package.py, docs/workflows.md, docs/instrumentation.md tests/test_cycle_status.py, tests/test_installed_cycle.py, tests/test_validate_package.py Package validator; focused status and validator tests; full unit suite; status CLI subprocess boundary case. All passed (agent-reported). independent

Verification (agent-reported)

  • rtk proxy python3 scripts/validate-package.py — exit 0; 15 skills valid and shared sections aligned.
  • rtk proxy python3 -m unittest discover -s tests -p 'test_cycle_status.py' -v — exit 0; 7 tests passed. The cursor test invokes the real cycle_status.py --line --since CLI with isolated status files.
  • rtk proxy python3 -m unittest discover -s tests -p 'test_validate_package.py' -v — exit 0; 52 tests passed.
  • rtk proxy bash -o pipefail -c 'python3 -m unittest discover -s tests -v 2>&1 | tail -n 35' — exit 0; 938 tests passed.
  • rtk proxy git diff --check — exit 0; clean.

The local run shares the repository's Python test harness, temporary fixtures, and fake-agent checks with CI. It does not run a live Claude Code Monitor or Orca check --wait session; CI covers the supported host installation layouts and operating systems.

Residual risk

Progress delivery depends on the host's monitoring facility running the scheduled checks; timed-only hosts may report status-file updates up to one interval later. The coordinator still emits stage start and end lines when those transitions occur.

@datacas

datacas commented Sep 30, 2026

Copy link
Copy Markdown
Owner Author

[CCR-20260930-001] · manual · anthropic/claude-opus-5-5→? · high · schema:1

Initial review — PR #134 (069b4d6)

Verdict: CHANGES_REQUESTED

Reviewed the full accumulated diff facc828...069b4d6 (10 files, +264/−13) against issue #131: the new cycle_status.py --line --since mode, the detached launch's progress: command, the shared ## User-visible progress section in both orchestrators, the validator rule, and the docs. The runtime change is small and well tested, and the shared section is enforced. One gap blocks the issue's goal: a coordinator following a detached cycle cannot tell from the relayed lines that the cycle has ended, or how it ended.

Findings

[REV-001] · medium · open · - · blocks:yes — Cycle completion is invisible in --line output and the monitoring loop has no end condition

scripts/cycle_status.py:119 (format_progress_line), skills/cc-orchestrator/SKILL.md:376, skills/cc-orca-orchestrator/SKILL.md:225

When a stage dict is present, format_progress_line ignores the cycle-level finished and status fields. The final snapshot that CycleStatus.finish() writes therefore renders exactly like a mid-cycle "stage done" line. Observed with a snapshot of {"finished": true, "status": "CHANGES_REQUESTED", "stage": {..., "finished": true}}:

[14:59] initial-review done · claude anthropic/sonnet high · 10m00s · CHANGES_REQUESTED: publishing

Nothing in that line says the cycle ended, or with which cycle status (for example STOPPED or interrupted compared with a stage status). For a detached run_cycle.py, the status file is the coordinator's only source of truth, so "keep stage start and end lines immediate in the coordinator" can only come from these lines. The progress section also never says when to stop the scheduled wake-ups. A coordinator following the rule as written either keeps polling a finished cycle or has to guess from a stage-done line. The issue's expected end line (implement done · … → initial-review · …), which shows either the next stage or the end of the cycle, cannot be produced.

Suggested fix: emit a distinct cycle-end line whenever status["finished"] is true (for example [HH:MM] cycle done · <status> · <reason>), and add a sentence to the shared section: stop the monitoring loop and report the final result when that line appears or the snapshot is finished.

[REV-002] · medium · open · - · blocks:no — A write in the same second as the cursor is permanently skipped

scripts/cycle_status.py:178 (_updated_after), shared progress section

updated_at has one-second precision (_now() uses timespec="seconds"), and _updated_after compares with a strict >. Meanwhile, the skill tells the coordinator to "advance the cursor to the check time". If the runtime writes after the check reads the file but within the same second as the new cursor, that snapshot is never printed. A later heartbeat usually supersedes a mid-stage snapshot, but the final finish() write has no successor, so the last line of the cycle can be lost. Reproduced: a snapshot with updated_at 2026-09-30T12:00:05+00:00 prints nothing for --since 2026-09-30T12:00:05Z and prints for …:04Z.

Suggested fix: advance the cursor to the latest updated_at observed rather than to wall-clock check time, or compare with >= and rely on per-line dedup, or write sub-second updated_at.

[REV-003] · low · open · - · blocks:no — [HH:MM] shows the relay time, not the event time

scripts/cycle_status.py:121

format_progress_line stamps the current time instead of the snapshot's updated_at. On timed-only hosts, which the section explicitly allows, a stage-end line relayed one interval late carries the wrong time. Using updated_at, converted to local time, would make the stamp describe the event.

Security triage

  • Deterministic rule (scripts/security_gate.py built-in defaults, since .code-cycle.yml declares no security_review.always_when): not fired. No path, file, or label matched, and the PR has no labels.
  • Reviewer judgement: the change reads local status JSON and prints it. It has no new input surface beyond a parsed timestamp argument, no auth, no secrets, no dependencies, and no CI changes.

Not a sensitive change: the security audit was skipped after triage.

Verification (executed in this review)

Command Result
python3 scripts/validate-package.py exit 0
python3 -m unittest discover -s tests -p test_cycle_status.py 7 tests OK
python3 -m unittest discover -s tests -p test_validate_package.py 52 tests OK
python3 -m unittest discover -s tests -p test_installed_cycle.py 16 tests OK (includes the real detached launch and progress: line)
python3 -m unittest discover -s tests 938 tests OK, exit 0
git diff --check origin/main...HEAD clean
cycle_status.py --line --since … against crafted snapshots in a scratch status dir reproduced REV-001 and REV-002 as quoted above

Unverified: end-to-end relay in a live Claude Code monitor or scheduled wake-up loop, and in Orca check --wait. Neither host was run. The progress-section behaviour is judged from the skill text only.

CI

gh pr checks 134: all four check runs pass, covering two runs each of Skills, manifests, and Bash installer and PowerShell installer (Validate package workflow). No expected check is missing, pending, or skipped.

Residual risk

  • Progress delivery depends on the host actually scheduling wake-ups. The skill text is the only enforcement, and no test exercises it.
  • The one-line format drops the tool count shown in the issue's example. The acceptance criteria do not require it, so this is noted only for completeness.

@datacas

datacas commented Sep 30, 2026

Copy link
Copy Markdown
Owner Author

[CCR-20260930-001] · manual · anthropic/claude-opus-5-5→? · high · schema:1

[CCT-20260930-001] · manual · openai/gpt-6→? · unknown · triaged:069b4d60ba417ab84a1362f8cc41eb8899fa7155 · schema:1

Resolution — PR #134 (5b073b5)

REV-001 and REV-002 were reproduced; all three findings were triaged against the pre-edit head 069b4d60ba417ab84a1362f8cc41eb8899fa7155. Each finding was valid and is resolved in commit 5b073b5acc6056ee71f325b51db15f97693e0d50.

[REV-001] · medium · resolved · valid · blocks:yes — Cycle completion is invisible in --line output and the monitoring loop has no end condition

A finished snapshot now emits a distinct [HH:MM] cycle done · <status> line, including when a stage snapshot is present. Both orchestrator guides tell the coordinator to stop polling and report that final status when the line appears.

[REV-002] · medium · resolved · valid · blocks:no — A write in the same second as the cursor is permanently skipped

Status timestamps now retain microsecond precision. The detached command starts with a microsecond UTC cursor; both orchestrator guides capture each next cursor before reading, so a write during or after a check remains eligible for the following check.

[REV-003] · low · resolved · valid · blocks:no — [HH:MM] shows the relay time, not the event time

Progress lines now derive [HH:MM] from the snapshot's updated_at, converted to local time. Older or malformed snapshots without a usable timestamp fall back to the current time.

Review and verification

  • Delegated cc-code-review: no findings.
  • python3 -m unittest discover -s tests -p test_cycle_status.py: 8 tests passed.
  • python3 -m unittest discover -s tests -p test_installed_cycle.py: 16 tests passed, including installed detached-cycle coverage.
  • python3 -m unittest discover -s tests: 939 tests passed.
  • python3 scripts/validate-package.py: passed; shared skill sections and manifests are aligned.
  • git diff --check: clean.
  • CLI boundary check with a scratch status directory and a same-second cursor: exit 0; emitted [14:00] cycle done · STOPPED and omitted the older snapshot.
  • gh pr checks 134: all four checks passed on 5b073b5 (two Skills, manifests, and Bash installer runs; two PowerShell installer runs).

Security triage: this change formats locally generated cycle status snapshots and parses their timestamps. It adds no authentication, authorization, secret handling, dependency, or external input boundary; a separate security audit was not indicated.

@datacas

datacas commented Sep 30, 2026

Copy link
Copy Markdown
Owner Author

[CCR-20260930-001] · manual · anthropic/claude-opus-5-5→? · high · schema:1

[CCT-20260930-001] · manual · openai/gpt-6→? · unknown · triaged:069b4d60ba417ab84a1362f8cc41eb8899fa7155 · schema:1

[CCR-20260930-002] · manual · anthropic/claude-opus-5-5→? · high · schema:1

Re-review — PR #134 (5b073b5)

Verdict: APPROVED

Previous review: 069b4d6. New commit: 5b073b5 (fix(progress): report cycle completion and preserve cursor updates). I re-read the delta (5 files, +56/−26) and the full accumulated diff facc828...5b073b5. All three previous findings are fixed, and each fix was verified by running it. One new non-blocking finding is recorded below.

Previous findings

[REV-001] · medium · resolved · valid · blocks:yes — Cycle completion is invisible in --line output and the monitoring loop has no end condition

Verified by execution. A finished snapshot with a finished stage (status: STOPPED) now prints [14:00] cycle done · STOPPED, which is distinct from any stage line. Both orchestrator sections now say "When a cycle done line appears, stop polling and report its final status." New test: test_progress_line_uses_snapshot_time_and_reports_cycle_end.

[REV-002] · medium · resolved · valid · blocks:no — A write in the same second as the cursor is permanently skipped

Verified by execution. updated_at and the detached cursor now carry microseconds. A snapshot at 12:00:05.400000 prints for --since …05.300000Z and is excluded for …05.500000Z. The skill text now captures the next cursor before reading, which closes the read-then-advance gap.

[REV-003] · low · resolved · valid · blocks:no — [HH:MM] shows the relay time, not the event time

Verified by execution. [HH:MM] now comes from updated_at, converted to local time: 12:00Z is rendered as 14:00 in this host's timezone, and the new test asserts the same. It falls back to the current time when updated_at is missing or malformed.

New findings

[REV-004] · low · open · - · blocks:no — Nanosecond cursors are rejected on Python 3.10

scripts/cycle_status.py:168 (_parse_timestamp), skills/cc-orchestrator/SKILL.md:378, skills/cc-orca-orchestrator/SKILL.md:227

The skills now ask the coordinator to "capture the current UTC time as an RFC 3339 timestamp with subsecond precision". The most common shell way to do that, date -u +%Y-%m-%dT%H:%M:%S.%NZ, produces 9 fractional digits. datetime.fromisoformat accepts those on Python 3.11+ but not on 3.10. Observed on Python 3.10.12, which is this host's python3, and the full suite passes on it:

$ python3 scripts/cycle_status.py --line --since 2026-09-30T13:29:04.686578028Z --status-dir …
cycle_status.py: error: timestamp must be ISO 8601, for example 2026-09-30T12:00:00Z
exit=2

The same cursor works on python3.11. On a 3.10 host, every monitoring check would fail until the agent works out the format. Suggested fix: truncate fractional seconds to 6 digits in _parse_timestamp, or name the exact format in the shared section, for example python3 -c output or date -u +%Y-%m-%dT%H:%M:%S.%6NZ. This does not block approval, because the detached launch prints a valid microsecond cursor and the error message is explicit.

Security triage

  • Deterministic rule (built-in defaults; .code-cycle.yml declares no security_review.always_when): not fired on the current changed paths, and the PR has no labels.
  • Reviewer judgement: the change only formats and filters locally written status snapshots. It adds no auth, secrets, dependencies, CI, or external input boundary.

Not a sensitive change: the security audit was skipped after triage.

Verification (executed in this re-review)

Command Result
python3 scripts/validate-package.py exit 0
python3 -m unittest discover -s tests 939 tests OK, exit 0
git diff --check origin/main...HEAD clean
cycle_status.py --line --since <cursor> against a scratch status dir, with cursors 05.300000Z, 05.500000Z, and 04.999Z REV-001, REV-002, and REV-003 fixes observed as described above
Same command with a 9-digit cursor on python3 3.10.12 and on python3.11 exit 2 on 3.10 and success on 3.11 (REV-004)

Unverified: a live relay loop in Claude Code scheduled wake-ups or in Orca check --wait. Neither host was run.

CI

gh pr checks 134 on 5b073b5: all four check runs pass, covering two runs each of Skills, manifests, and Bash installer and PowerShell installer (Validate package workflow). No expected check is missing, pending, or skipped. CI uses python-version: '3.x', so it would not catch REV-004.

Residual risk

  • Status is sampled, not streamed. When a stage ends and the cycle finishes between two checks, only cycle done is relayed, and the last stage's done line is never shown. The same applies to any intermediate transition between polls.
  • Relay cadence still depends on the host actually running the scheduled checks.

@datacas
datacas merged commit 67bf49c into main Sep 30, 2026
4 checks passed
@datacas
datacas deleted the issue-131-progress-relay branch October 6, 2026 07:53
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.

Show brief periodic progress while a cycle runs: stage, model, elapsed, activity

1 participant