Inspected read-only. Key findings:
High: stale chain_state.json across cloud chain runs
Evidence: cloud chain always uploads the spec to /workspace/reigh-app/chain.yaml, and core chain stores state as spec.with_name("chain_state.json"), so every re-run in the same workspace reuses /workspace/reigh-app/chain_state.json regardless of local chain identity. See cli.py and chain.py.
Fix: namespace remote specs and state by chain id/run id, or embed a spec hash in chain_state.json and refuse/resume only on match. Add cloud chain --reset-state and --resume-state.
High: dirty cloud worktree across chained sprints
Evidence: cloud entrypoint skips clone when /workspace/reigh-app/.git already exists, preserving volume state; chain then runs milestones in that same checkout. See entrypoint.sh.tmpl. Local current app state already shows unrelated dirt: deleted public/hero-background-loop.mp4 plus untracked .megaplan/*.yaml.
Fix: before each sprint, capture git status --porcelain, fail unless explicitly allowed, and either stash/archive or create an isolated worktree. Persist artifacts outside the repo checkout.
High: no worktree/merge isolation for chains
Evidence: chain milestone branch is parsed but “currently informational”; execution runs in the same root and _refresh_main does best-effort checkout main && pull, never raising. See chain.py and chain.py. Bakeoff already has the better pattern: detached worktrees plus clean-main merge checks in worktree.py.
Fix: promote chain branch into real isolation: create per-milestone worktrees, run Megaplan there, then merge via patch/PR only after validation.
Medium: coarse execution progress
Evidence: progress only reads task statuses from finalize.json; summary explicitly says it is “between-batch granularity”. See cli.py. Long execute steps in local runs show 23-37 minute opaque spans.
Fix: write live task heartbeat/checkpoint events to execution_trace.jsonl and expose current batch, active task, last worker output timestamp, retry count, and elapsed/no-output timers in status.
Medium: Railway/API/SSH operations have no timeout envelope
Evidence: Railway and SSH providers call subprocess.run(...) without timeout= for deploy, ssh, upload, read, logs, docker commands. See railway.py and ssh.py.
Fix: add provider-level configurable timeouts, classify timeout vs nonzero exit vs missing CLI, and surface retryable diagnostics. For reads/status, keep short defaults; for deploy/upload, longer but bounded.
Medium: timeout/retry semantics are inconsistent
Evidence: auto phase timeout returns code 124, logs it, then relies on stall detection; context retry is execute-only and only for a specific fragment. See auto.py and auto.py. Chain only gets terminal DriverOutcome, losing timeout class/detail.
Fix: make timeout a first-class outcome with phase, command, elapsed, retry policy, and whether the worker process was killed. Add bounded retry/backoff for transient provider/status failures separately from agent context retries.
Medium: generated .megaplan/schemas artifacts are tracked in app repos
Evidence: app repo tracks .megaplan/schemas/*.json, while runtime layout writes schemas into every project root. See io.py. .gitignore ignores only .megaplan/plans/, not schemas.
Fix: move runtime schemas to a cache dir outside project source, or default-ignore .megaplan/schemas/. If schema snapshots are needed, put them under Megaplan’s own repo tests, not app diffs.
Low/Medium: cloud chain start is ambiguous when tmux already exists
Evidence: cloud chain uploads new files, writes a fresh marker, but if megaplan-chain tmux exists it only prints “already running” and does not confirm which spec/state that session is using. See cli.py.
Fix: store active chain metadata in the remote workspace, show it in cloud status --chain, and require --replace to kill/restart an existing chain session.