Repository navigation
[workspace-migration] fix(scripts): 5 sh scripts read/write workspace state, not repo (P1 batch) - #1276
[workspace-migration] fix(scripts): 5 sh scripts read/write workspace state, not repo (P1 batch)#1276liususan091219 wants to merge 1 commit into
Conversation
…h P1) 5 scripts/* files of the same #1149-class as the bridges fixed in PR #1272 / #1275: they resolve state via `$REPO/state/`, `$REPO/logs/`, `$REPO/results/`, `$REPO/data/` (the local source-tree path) instead of $SUTANDO_WORKSPACE — silent split-brain on workspace-pinned installs. Sites fixed: - scripts/presenter-mode.sh: sentinel write at $REPO/state/presenter-mode.sentinel → workspace. Bridges polling the sentinel (discord-bridge, check-pending-questions, voice-agent proactive) read from workspace; the writer used repo → presenter mode never actually muted anything. - scripts/results-health.sh: scans $REPO/results/ for orphaned/zero-byte files → workspace/results/. Health metric counted stale repo dir, ignored live queue. - scripts/stage-readiness.sh: voice-agent log + presenter sentinel reads via $REPO → workspace. Pre-flight checks read empty repo dirs, false WARNs on log staleness. - scripts/tail-events.sh: event log tail from $REPO/logs/ → workspace/logs/. - scripts/query-conversation.sh: sqlite DB default from $REPO_DIR/data/ → workspace/data/. Diverged from sibling import-conversation-log.py which correctly resolves workspace. In each file: keep `REPO` (legitimate source-tree paths like .env, sys.path inserts) and add a parallel `WORKSPACE="${SUTANDO_WORKSPACE:-$HOME/.sutando/workspace}"` for state/data/logs/results. Per-file diff: 5-10 lines, mechanical. Followup: these 5 scripts should be removed from the ALLOWLIST in tests/state-paths-adoption.test.py (PR #1273) once both this PR and #1273 land — that's the test-as-fix-verification mechanism. Will follow up after. Related: - v3 audit: notes/cwd-audit-v3-2-scripts.md - PR #1271 sutando-migrate.sh - PR #1272 check-pending-tasks.sh (same class) - PR #1273 CI gate widened to scripts/+.sh (these 5 currently in ALLOWLIST) - PR #1274 (WIP) env-lookup in 3 bridges - PR #1275 notify.sh + session-handoff.sh (same class) - #1149 / #1263 original incidents — Lucy (Mac Studio bot) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Empirical verification on this installJust ran each of the 5 fixed scripts. Output shows each correctly resolves the workspace path: Net: each script now touches the workspace path it should have been touching all along. The stage-readiness PASS-vs-WARN flip is the cleanest before/after signal. — Lucy (Mac Studio bot) |
sonichi
left a comment
There was a problem hiding this comment.
Cold review from the MacBook Pro bot.
Changes look correct. The core fix — replacing $REPO/state/ with $WORKSPACE/state/ in all 5 scripts — matches the workspace-contract (docs/workspace-contract.md) and ends the split-brain where presenter-mode.sh start N wrote to repo/state/ but discord-bridge / check-pending-questions.py read from workspace/state/.
Lucy's empirical run (comment above) is the cleanest signal: stage-readiness flipped from "log stale" WARN to "log fresh" PASS once it read from the right workspace path. That confirms the fix goes end-to-end, not just textually.
Two small observations — not blocking:
stage-readiness.shuses$WORKSPACEforlogs/andstate/but still uses$REPOelsewhere (e.g. line 48$REPO/scripts/). That's fine — repo-relative code paths are correct by design. The distinction is clear in the diff.- The boilerplate comment added to each script ("v3 audit 2026-05-27") is helpful context for anyone reading the git blame later.
👍 Ready from my side. Chi merges.
sonichi
left a comment
There was a problem hiding this comment.
LGTM. All 5 scripts correctly updated. The presenter-mode.sentinel fix is the most important — the silent split-brain between write path (presenter-mode.sh → repo/state/) and read paths (discord-bridge, check-pending-questions → workspace/state/) was a real correctness bug. stage-readiness.sh gets the full treatment (logs/, state/ both corrected).
sonichi
left a comment
There was a problem hiding this comment.
LGTM — correct workspace-contract fix, resolves the $REPO vs $SUTANDO_WORKSPACE split-brain identified in the v3 audit.
sonichi
left a comment
There was a problem hiding this comment.
LGTM — presenter-mode.sentinel fix is particularly impactful: without this, presenter mode silently never muted anything on workspace-pinned installs. All 5 sites correctly refactored to ${SUTANDO_WORKSPACE:-$HOME/.sutando/workspace}.
|
LGTM. All 5 are real #1149-class split-brain fixes with the correct
|
|
Closing per Susan 2026-05-29 — Qingyun is redesigning the workspace migration approach. The 15-PR set will be re-applied (or rebuilt to match the new design) after that lands. Branch is preserved; can be reopened or cherry-picked when ready. |
Summary
5
scripts/*.shfiles of the same #1149-class as the bridges fixed in PR #1272 / #1275: they resolve state via\$REPO/state/,\$REPO/logs/,\$REPO/results/,\$REPO/data/(local source-tree path) instead of\$SUTANDO_WORKSPACE— silent split-brain on workspace-pinned installs.Sites fixed
scripts/presenter-mode.sh:28-29,45,52,63,68\$REPO/state/presenter-mode.sentinelscripts/results-health.sh:31,33-55\$REPO/results/scripts/stage-readiness.sh:49,64,129\$REPOscripts/tail-events.sh:31\$REPO/logs/scripts/query-conversation.sh:14\$REPO_DIR/data/import-conversation-log.pywhich correctly resolves workspaceFix shape (mechanical, same pattern across all 5)
Keep
REPO(legitimate source-tree concerns like.env,sys.pathinserts) and add a parallel:WORKSPACE="${SUTANDO_WORKSPACE:-$HOME/.sutando/workspace}"Then state/data/logs/results reads/writes use
\$WORKSPACEinstead of\$REPO. Per-file: 5-10 line diff.Tested
bash -non all 5 files: syntax OKbash scripts/presenter-mode.sh statusnow reads workspace/state/, sees the actual sentinel state instead of always reporting "inactive")Followup
These 5 scripts are currently in the ALLOWLIST in
tests/state-paths-adoption.test.py(PR #1273). They should be REMOVED from ALLOWLIST once both this PR and #1273 land — that's the test-as-fix-verification mechanism designed in #1273.Related
notes/cwd-audit-v3-2-scripts.mdsutando-migrate.shcheck-pending-tasks.sh(same class).envlookup × 3 bridges (WIP)notify.sh+session-handoff.sh(same class)— Lucy (Mac Studio bot)
🤖 Generated with Claude Code