Repository navigation
fix(bin): treat OpenCode's right-aligned cwd rail as composer furniture, including absolute paths - #7307
Conversation
…niture OpenCode 1.18.31 draws the worker pane's working directory and branch right-aligned inside the left-bar composer rows above the Build footer, wrapped over up to three rail-width fragments whose final fragment continues onto the footer row's right end. The fragments are RGB 128 grey with luminance exactly on the ghost-luma ceiling, so they survive ghost stripping, and the left-bar classifier read them as unsent typed text: every idle 1.18.31 pane answered pending, which skipped the steering doorbell, the watcher's re-ring ladder, and /exit typing. _fm_composer_leftbar_cwd_start recognises the run structurally and position-gated: contiguous single-token rows immediately above the footer row whose gap after the bar exceeds half the row, whose fragments plus the footer row's gap-separated right-hand tail concatenate to a path, optionally followed by :<branch>. A path-shaped string typed at the composer's left edge is still typed text, so a wrong call can only defer, never inject. Extraction shares the same rule so extracted composer content stays user-scoped.
…st-fragment check
Review round on the independent PR review: the position gate now measures the gap against the region's width (the widest trimmed plain row across first..last), so a short space-prefixed home path typed into an otherwise empty composer no longer reads empty; the right-half lone-token residual is pinned explicitly. The cwd:branch furniture is documented as present since OpenCode 1.18.0 (upstream anomalyco/opencode#36457, merged 2026-07-11), not a 1.18.31 layout change. The 1.18.30 capture comment notes it omits the directory footer, and a cropped-composer extraction assertion scopes user content to the typed row above the rail.
…furniture Refs kunchenguid#4632, builds on kunchenguid#5030.
…k from following prose
|
CI note: the 'Behavior portable serial 2' job was cancelled by the provider (no failure verdict); every other check passed. Rerunning it needs repository admin rights, so a maintainer rerun of that job is requested. |
|
Speaking as Kun's firstmate: thank you @KostadinP, and thank you for keeping @konih's #5030 commits and authorship intact. The live matrix is very thorough. Base vs fix on a real 300-column OpenCode 1.18.31 pane, a real Where it stands (head
Next: this is waiting on CI. Nothing is needed from you. Once the serial 2 re-run is green and |
|
Speaking as Kun's firstmate: this is merged. Thank you @KostadinP — really appreciate you taking the time on this. |
Intent
Fix #4632 ("OpenCode composer classifier misreads status footer as pending text, blocking control-plane recovery") and open a PR through this repository's process (no-mistakes is required for PRs to main): a new PR that builds on the commits of the open PR #5030 (by konih, keeping their authorship), adds the absolute-path widening and the wide-pane fixture, and references both #4632 and #5030.
OpenCode 1.18.x draws the worker's working directory right-aligned inside the left-bar composer rows just above the
Build · <model>row, and_fm_composer_classify_leftbar(bin/fm-composer-lib.sh) counts it as typed text, sofm-sendskips the doorbell andfm-control exit|relaunchrefuse, for idle and busy workers alike. PR 5030 fixes this only when the rail path starts with~/; workers whose worktrees live under an absolute path outside $HOME (e.g. a 308-column pane) still readpending. The planned change accepts an absolute path with at least one non-/, non-whitespace character after the leading slash in_fm_composer_leftbar_cwd_start, keeps a lone/rejected (slash-command guard) and every other structural gate, updates the PR's comment block and doc lines to cover absolute paths, and adds a sanitized wide busy fixture, an idle twin, and negative tests (lone right-aligned/,/exitat the left edge, an absolute-path token typed at the left edge, typed text plus a rail), plus extraction coverage and a live opt-in check.What Changed
bin/fm-composer-lib.sh: a new_fm_composer_leftbar_cwd_starthelper recognizes the right-aligned<cwd>:<branch>rail that OpenCode 1.18.x draws just above theBuild · <model>footer._fm_composer_classify_leftbarandfm_composer_extract_selected_contentnow skip it as composer furniture, so idle and busy OpenCode workers no longer read aspending. Without this,fm-sendskipped the doorbell andfm-control exit|relaunchrefused. Recognition is structural and depends on position. The last row must be the footer, and the run must sit directly above it with no gap. Each row must be a single token with no whitespace that starts past half the region's width. The topmost fragment must start with~/, or be an absolute path with at least one character after the leading slash that is not/or whitespace, which covers worktrees outside$HOMEsuch as/srv/.... A lone right-aligned/and left-edge input such as/exitstill read as typed text.tests/fm-composer-lib.test.sh. The negative cases cover a lone right-aligned/, a left-edge/exit, a left-edge absolute-path token, typed text alongside a rail, and the accepted residual of a single token typed in the right half. A new opt-in live check,tests/fm-opencode-abs-cwd-rail-live-e2e.test.sh, also runs against OpenCode.docs/verification/runtime-backends.md,docs/tmux-backend.mdand the OpenCode harness reference now describe the cwd-rail furniture, including absolute paths, with dated live evidence.Builds on #5030 and keeps konih's commits and authorship. Fixes #4632.
🤖 Generated with Claude Code
Risk Assessment
✅ Low: The change adds one narrow case pattern (
/*[!/]*) to_fm_composer_leftbar_cwd_start. Every existing structural gate still applies: the footer row is required, the fragments must be contiguous single tokens, the gap must exceed half the region width, and the topmost fragment's own bytes are checked. A lone/and slash-only tokens stay rejected and are pinned by negative tests. The fix-round changes I checked are correct: the DONE wait no longer matches the echoed prompt, the idle loop fails if the turn is still running instead of moving on, the rail grep is no longer tied to /tmp, and the doc path now resolves to the real bin/fm-composer-lib.sh.Testing
All scenarios were driven live against real OpenCode 1.18.31 in isolated tmux sockets, with cwds under /tmp outside $HOME, on 300-column panes, and every one passed. With the absolute path rail wrapped into composer rows,
fm_tmux_composer_statereademptybusy and idle with the fix, andpendingon base 24f3a6b, reproducing #4632. Typed text next to the rail, a lone/,/exitand a typed/tmp/...token all stayedpending; captured pane text confirms each input sat next to the rail. In a disposable lab home, basefm-control exitrefused because it read the pane as pending text, while the fix stopped the OpenCode worker. The opt-in live e2e test passed both phases. The fixture-based composer-lib unit tests also passed, as supporting evidence only. This change has no visual UI surface, so the evidence is text captures of the tmux pane rather than screenshots. All temporary labs and sockets were removed.Evidence: Live composer verdict matrix, fix vs base
Source: Live composer verdict matrix, fix vs base
S2 busy mid-turn, abs rail fixed=empty base=pending S1 idle, empty composer, abs rail fixed=empty base=pending S3 typed text + abs rail fixed=pending base=pending S4 lone slash typed fixed=pending base=pending S5 /exit typed at left edge fixed=pending base=pending S6 abs path token typed at left edge fixed=pending base=pending S1b idle again after clearing fixed=empty base=pendingEvidence: Live fm-control exit recovery, base vs fix
Source: Live fm-control exit recovery, base vs fix
busy fix=empty base=pending idle fix=empty base=pending == base fm-control exit: error: task w1's composer visibly holds pending text; refusing to type the /exit exit command ... rc=1 == fix fm-control exit: stopped w1 harness=opencode backend=tmux ... rc=0 opencode alive after fix exit: noEvidence: Opt-in live e2e test output
Source: Opt-in live e2e test output
Evidence: Matrix live driver script
Source: Matrix live driver script
Evidence: Pane capture: typed text next to the absolute rail
Source: Pane capture: typed text next to the absolute rail
Evidence: Pane capture: /tmp/some/path typed at the left edge
Source: Pane capture: /tmp/some/path typed at the left edge
Evidence: Pane capture: idle session view with the wrapped absolute rail
Source: Pane capture: idle session view with the wrapped absolute rail
Evidence: Pane capture after fm-control exit with the fix
Source: Pane capture after fm-control exit with the fix
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 3 issues found → auto-fixed (2) ✅
tests/fm-opencode-abs-cwd-rail-live-e2e.test.sh:90- The live check's idle assertion can actually run while the turn is still going.wait_for '^ *DONE *$|DONE' 240uses a bareDONEalternative, and that also matches the submitted prompt text ("...reply with exactly DONE.") echoed in the transcript, so the wait returns right after submission. The next loop waits at most 30s (60 × 0.5s) for 'esc interrupt' to disappear. The turn runssleep 25plus model latency, which can easily take longer than 30s. In that case the 'idle' verdict is read mid-turn. A busy pane also reads empty, so the test passes, but it never proves the idle case it reports. Fix: drop the|DONEalternative, wait for a DONE line that is not part of the prompt, and fail if 'esc interrupt' is still visible after the bounded wait instead of moving on.tests/fm-opencode-abs-cwd-rail-live-e2e.test.sh:84- The non-vacuousness grep'┃ +/tmp/[^[:space:]]+ *$'hardcodes/tmp/, but LAB is resolved withpwd -P(line 41). On macOS (the platform of the earlier 1.18.31 verification), /tmp resolves to /private/tmp, so OpenCode draws/private/tmp/...and the opt-in check fails with 'the absolute cwd rail did not wrap into a composer row' even though the classifier is correct. Fix: match the first fragment against the resolved "$LAB" prefix, or against a generic┃ +/[^/[:space:]][^[:space:]]* *$absolute-path shape.bin/fm-composer-lib.sh:1376- One sentence in the comment is now outdated. It says a rail whose string is too long for the composer's visible rows 'fails the check by construction'. With the absolute-path widening, a truncated rail whose topmost visible fragment happens to begin with '/<name>' (a mid-path wrap boundary) is now accepted as furniture. That is correct behavior, since the rows are still furniture, but the sentence should be qualified to match.🔧 Fix applied.
1 info still open:
.agents/skills/harness-adapters/references/harness/opencode.md:25- The new line points at the shared classifier as../../../bin/fm-composer-lib.sh. From .agents/skills/harness-adapters/references/harness/ that path resolves to .agents/skills/bin/fm-composer-lib.sh, which does not exist. Sibling harness docs (gemini.md, claude.md) use five levels,../../../../../bin/..., to reach the repo root. Fix: change the reference to../../../../../bin/fm-composer-lib.sh.🔧 Fix applied.
✅ Re-checked - no issues remain.
🔧 **Test** - 1 issue found → auto-fixed ✅
tests/fm-opencode-abs-cwd-rail-live-e2e.test.sh:92- The opt-in live check's idle wait^[^[:alnum:]]*DONE *$never matched on a real 300-column OpenCode 1.18.31 pane. The sidebar text shares the row with the DONE reply, so the test failed with 'the turn never finished' even though the classifier was correct. Fixed: the pattern is now^[^[:alnum:]]*DONE([[:space:]]|$), which still excludes the echoed prompt row (it starts with 'Run'). The live re-run passes both phases.bash tests/fm-composer-lib.test.sh(includes the new wide absolute-cwd busy/idle fixture matrix and the negative cases)FM_OPENCODE_ABS_CWD_LIVE=1 bash tests/fm-opencode-abs-cwd-rail-live-e2e.test.shagainst real opencode 1.18.31. The first run failed on the idle wait (test bug). The re-run after the fix passed both mid-turn and idledrive-abs-cwd-live.sh: real OpenCode on an isolated tmux socket, 300x60, cwd /tmp/fm-lab.*/treehouse/.../project-under-test. Compares base 24f3a6b and fixfm_tmux_composer_statebusy/idle, types adversarial input, and runs base vs fixbin/fm-send.shagainst a marked lab FM_HOMEdrive-abs-cwd-fm-control-live.sh: same setup, runs base vs fixbin/fm-control.sh w1 exitagainst a lab FM_HOME meta (window=abs:fm-w1, harness=opencode)🔧 Fix applied.
✅ Re-checked - no issues remain.
tests/fm-opencode-abs-cwd-rail-live-e2e.test.shwithFM_OPENCODE_ABS_CWD_LIVE=1(real OpenCode 1.18.31, isolated tmux socket, 300x60 pane, cwd under /tmp)Custom live driverdrive-composer-matrix-live.sh: real OpenCode on a 300-column pane; comparesfm_tmux_composer_statefor the fixed bin/ and the base 24f3a6b bin/ while busy, idle, and with typed input (hello world,/,/exit,/tmp/some/path)Live driverdrive-abs-cwd-fm-control-live.shre-run: a disposablefm-lab-home.shhome with an OpenCode worker meta; ranfm-control.sh w1 exitwith base, then with the fixbash tests/fm-composer-lib.test.sh(fixture-based classifier and extraction tests for the wide busy and idle absolute-path fixtures; 0 failures)✅ **Document** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.