Cockpit — wire live runtime to Autoflow state - #81
Conversation
Implements the frozen Live Runtime Wiring DDR (Decision 059): a minimal AutoflowRuntime owns the single authoritative WorkflowState; a narrowed read-only AutoflowStateReader and a synchronous RepositoryObserver feed a whole-observation builder through produceCockpitSnapshot (JSON firewall), a live CockpitSource, D1, and D2/D4 into a per-GET render. Autoflow remains the sole workflow source of truth; the Cockpit gains no transition, Policy, provider, or Git/GitHub authority. Fixture mode and all six strong-boundary files are unchanged. observedAt is the whole-observation collection time. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AAgxiS7ZxExQN1to1RuA2R
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (8)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe change adds an Autoflow runtime owner, a validated repository observer, and a live Cockpit server. The server captures fresh state per ChangesLive Cockpit Runtime
Estimated code review effort: 4 (Complex) | ~45 minutes Merge Risk: ⚪ Minimal · up to Live Cockpit now renders current Autoflow state on each root request while remaining loopback-only and read-only. Invalid or unavailable live data fails closed rather than serving fixture or stale content, leaving no identified merge-blocking risk. Sequence Diagram(s)sequenceDiagram
participant Client
participant CockpitServer
participant LiveObservation
participant RepositoryObserver
participant AutoflowRuntime
Client->>CockpitServer: GET /
CockpitServer->>LiveObservation: Create snapshot
LiveObservation->>RepositoryObserver: observe()
LiveObservation->>AutoflowRuntime: current()
LiveObservation-->>CockpitServer: Serialized Cockpit snapshot
CockpitServer-->>Client: Rendered page
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 68.75% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 16 functions across 7 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review Please perform one substantive review of this PR at exact head Review scope:
Two known non-blocking P3 observations are intentionally deferred and are NOT repair requests unless independently shown to violate a real current invariant:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c3a15fd889
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Addresses Codex P2 on PR #81. startLiveCockpit accepted a caller-supplied host and bound `options.host ?? HOST`, letting a public caller bind the live dashboard to 0.0.0.0/::/a routable interface and expose observations to remote clients. Remove the `host` option from StartLiveCockpitOptions and always bind the pinned HOST (127.0.0.1); only `port` remains configurable (ephemeral 0 for tests) and never affects the interface. The removal is type-level, so a host override is now a compile error. Both production listen paths remain loopback-only. No strong-boundary or other candidate file changed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AAgxiS7ZxExQN1to1RuA2R
|
@codex review Re-review at exact current head This head adds commit
Please confirm the loopback-pin P2 is resolved and check for any new current finding in the two changed files ( |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@coderabbitai review Final substantive review at exact current head Scope: the Live Runtime Wiring feature (AutoflowRuntime as sole owner of the current immutable WorkflowState; reader-only AutoflowStateReader into the Cockpit path; synchronous RepositoryObserver over runtime-supplied immutable inputs; whole-observation per-GET capture; loopback-pinned host; fail-closed; no live→fixture fallback; six strong boundaries unchanged; schema v2 unchanged). Already adjudicated (please provide materially new evidence to reopen):
|
🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
head_commit="537953f21ebe79700dd35710645c5a727b89b265"
base_commit="7af903053bfba65edf42abf11cb52e0a75b8db7c"
echo "== Commit identity =="
git rev-parse HEAD
git rev-parse "${head_commit}^{parent}"
git merge-base --is-ancestor "$base_commit" "$head_commit" && echo "base-is-ancestor=true"
git diff --check "$base_commit" "$head_commit"
git diff --stat "$base_commit" "$head_commit"
git diff --name-status "$base_commit" "$head_commit"
echo "== Protected boundary identity =="
for path in \
src/cockpit-snapshot/producer.ts \
src/cockpit/read-model.ts \
src/cockpit/evidence-freshness-projection.ts \
src/cockpit/autoflow-projection.ts \
src/domain/workflow.ts \
src/domain/workflow-transitions.ts
do
printf '%s ' "$path"
git rev-parse "$base_commit:$path"
git rev-parse "$head_commit:$path"
done
echo "== Changed source/test structure =="
git diff --name-only "$base_commit" "$head_commit" | while IFS= read -r path; do
case "$path" in
*.ts|*.tsx|*.mts|*.cts)
echo "-- $path"
ast-grep outline "$path" --items all || true
;;
esac
done
echo "== Complete patch =="
git diff --find-renames --find-copies --no-ext-diff "$base_commit" "$head_commit"
echo "== Runtime and Cockpit candidate files =="
fd -t f . src tests | rg '/(runtime|cockpit)(/|.*\.(ts|tsx)$)|AutoflowRuntime|RepositoryObserver|live-cockpit' || true
echo "== Prohibited-capability indicators in changed source =="
git diff --name-only "$base_commit" "$head_commit" -- 'src/**' | while IFS= read -r path; do
[ -n "$path" ] || continue
echo "-- $path"
rg -n -i -C 2 '(child_process|node:child_process|execFile|spawn|fork|node:net|node:tls|node:http|node:https|fetch\s*\(|axios|octokit|simple-git|isomorphic-git|node:fs|readFile|writeFile|WorkflowState|\.open\s*\(|\.apply\s*\(|\.advance\s*\(|server\.listen|createServer)' "$path" || true
done
echo "== Live route and runtime references =="
rg -n -C 3 '(startLiveCockpit|AutoflowRuntime|AutoflowStateReader|RepositoryObserver|readCockpitSnapshot|produceCockpitSnapshot|server\.listen|req\.method|request\.method|GET)' src tests || trueLength of output: 2785 🏁 Script executed: #!/bin/bash
set -u -o pipefail
head_commit="HEAD"
base_commit="HEAD^"
stated_base="7af903053bfba65edf42abf11cb52e0a75b8db7c"
echo "== Available commit topology =="
git rev-parse HEAD
git rev-parse HEAD^ || true
git cat-file -e "${stated_base}^{commit}" 2>/dev/null && echo "stated-base-available=true" || echo "stated-base-available=false"
echo "== Patch integrity and file list =="
git diff --check "$base_commit" "$head_commit" || true
git diff --stat "$base_commit" "$head_commit" || true
git diff --name-status "$base_commit" "$head_commit" || true
echo "== Protected boundary identity against local parent =="
for path in \
src/cockpit-snapshot/producer.ts \
src/cockpit/read-model.ts \
src/cockpit/evidence-freshness-projection.ts \
src/cockpit/autoflow-projection.ts \
src/domain/workflow.ts \
src/domain/workflow-transitions.ts
do
printf '%s\n parent=' "$path"
git rev-parse "$base_commit:$path" 2>&1 || true
printf ' head='
git rev-parse "$head_commit:$path" 2>&1 || true
done
echo "== Patch from local parent =="
git diff --find-renames --find-copies --no-ext-diff "$base_commit" "$head_commit" || true
echo "== Candidate file names =="
fd -t f . src tests 2>/dev/null | rg '(runtime|cockpit|autoflow|repository-observer|live-cockpit)' || true
echo "== Candidate TypeScript outlines =="
fd -t f -e ts . src tests 2>/dev/null | rg '(runtime|cockpit|autoflow|repository-observer|live-cockpit)' | while IFS= read -r path; do
echo "-- $path"
ast-grep outline "$path" --items all 2>&1 || true
done
echo "== Capability and route evidence =="
rg -n -i -C 3 '(AutoflowRuntime|AutoflowStateReader|RepositoryObserver|startLiveCockpit|produceCockpitSnapshot|readCockpitSnapshot|server\.listen|createServer|req\.method|request\.method|child_process|node:child_process|execFile|spawn|fork|node:net|node:tls|node:http|node:https|fetch\s*\(|axios|octokit|simple-git|isomorphic-git|node:fs|readFile|writeFile|\.open\s*\(|\.apply\s*\(|\.advance\s*\()' src tests 2>/dev/null || trueLength of output: 176469 🏁 Script executed: #!/bin/bash
set -euo pipefail
base="7af903053bfba65edf42abf11cb52e0a75b8db7c"
head="HEAD"
echo "== Full PR file range and integrity =="
git diff --check "$base" "$head"
git diff --name-status "$base" "$head"
git diff --stat "$base" "$head"
echo "== Specified protected boundaries against stated base =="
for path in \
src/cockpit-snapshot/producer.ts \
src/cockpit/read-model.ts \
src/cockpit/evidence-freshness-projection.ts \
src/cockpit/autoflow-projection.ts \
src/domain/workflow.ts \
src/domain/workflow-transitions.ts
do
parent_blob="$(git rev-parse "$base:$path")"
head_blob="$(git rev-parse "$head:$path")"
printf '%s base=%s head=%s equal=%s\n' "$path" "$parent_blob" "$head_blob" \
"$([ "$parent_blob" = "$head_blob" ] && echo true || echo false)"
done
echo "== Autoflow runtime =="
sed -n '1,220p' src/autoflow/runtime.ts
echo "== Repository observer =="
sed -n '1,180p' src/runtime/repository-observer.ts
echo "== Live Cockpit composition and entrypoint =="
sed -n '1,260p' src/runtime/live-cockpit.ts
echo "== Cockpit route provider behavior =="
sed -n '90,225p' src/cockpit-host/server.ts
echo "== Relevant live runtime tests =="
sed -n '110,455p' tests/runtime/live-cockpit.test.ts
echo "== Runtime module static imports and forbidden API indicators =="
for path in src/autoflow/runtime.ts src/runtime/repository-observer.ts src/runtime/live-cockpit.ts; do
echo "-- $path imports"
rg -n '^\s*import\b|^\s*export\b' "$path"
echo "-- $path prohibited indicators"
rg -n -i '(node:fs|child_process|node:child_process|exec(File|Sync)?|spawn|fork|simple-git|isomorphic-git|octokit|github|fetch\s*\(|axios|node:https|node:tls|node:net|readFile|writeFile|readdir|\.open\s*\(|\.apply\s*\()' "$path" || true
done
echo "== Public scripts and live entrypoint references =="
fd -t f 'package*.json' . -d 3 -0 | xargs -0 -r -n1 sh -c 'echo "-- $0"; sed -n "1,220p" "$0"' || true
rg -n -C 2 '(cockpit:live|live-cockpit|AGENTBRIDGE_REPOSITORY_ID|AGENTBRIDGE_OBSERVED_HEAD_SHA)' README.md package.json src tests 2>/dev/null || trueLength of output: 43374
I found no new findings. The loopback-pin repair is resolved. The reviewed implementation maintains the requested boundaries:
✅ Action performedReview finished.
|
Live Runtime Wiring implements adopted Decision 059.
Architecture
Scope
Authority remains unchanged
Strong unchanged boundaries
Validation
Exact candidate
Known non-blocking P3 observations
These are intentionally deferred and are not part of this PR repair scope.
Runtime cutover
The real 127.0.0.1:4317 runtime remains STOPPED.
Starting/cutting over the live runtime is a separate downstream authority gate after the code lands.
🤖 Generated with Claude Code
https://claude.ai/code/session_01AAgxiS7ZxExQN1to1RuA2R
Summary by CodeRabbit
New Features
cockpit:livecommand for launching the live Cockpit server.Tests