Skip to content

fix(scripts): resolve siblings from $SCRIPT_DIR + drop hardcoded recodee fallbacks#3

Merged
NagyVikt merged 1 commit into
mainfrom
fix/script-dir-resolution
May 14, 2026
Merged

fix(scripts): resolve siblings from $SCRIPT_DIR + drop hardcoded recodee fallbacks#3
NagyVikt merged 1 commit into
mainfrom
fix/script-dir-resolution

Conversation

@NagyVikt
Copy link
Copy Markdown
Contributor

Standalone-clone correctness pass — needed before the migration of operators off the in-tree recodee copy is meaningful.

What changed (14 files)

Issue Where Fix
Hardcoded /home/deadpool/Documents/recodee fallback default full-bringup, force-claim, fleet-tick, fleet-tick-daemon, cap-swap-daemon, claim-release-supervisor, claim-trigger, plan-anim, plan-tree-anim, plan-tree-pin, codex-fleet-2, waves-anim Replace with three-step lookup: explicit env → \$CODEX_FLEET_REPO_ROOT → walk-up from \$SCRIPT_DIR
Cross-script refs via \$REPO/scripts/codex-fleet/X full-bringup (17 refs), codex-fleet-2 (4), force-claim (1), proactive-probe (1), fleet-tick-daemon (1), cap-swap-daemon (1) Replace with \$SCRIPT_DIR/X so sibling scripts resolve from the clone, not from the user's project root
Scripts use \$SCRIPT_DIR but never define it full-bringup, force-claim, fleet-tick-daemon, cap-swap-daemon Add SCRIPT_DIR=\$(cd \"\$(dirname \"\${BASH_SOURCE[0]}\")\" && pwd) near the top
tmux-bindings.conf hardcoded \$HOME/Documents/recodee tmux-bindings.conf Drop fallback (tmux conf can't derive paths from its own location); require CODEX_FLEET_REPO_ROOT in caller's env

Why now

The subtree-split history that seeded this repo predates the in-repo
recodee PR #1928 that did equivalent parameterization. So the new
repo arrived with the old hardcoded defaults intact. This PR restores
parity + extends to the cross-script-reference issue that didn't exist
inside recodee (because there, \$REPO/scripts/codex-fleet/ happened to
also be the script location).

Test plan

  • bash -n clean on all 13 modified shell scripts
  • grep -rln "/home/deadpool/Documents/recodee" scripts/ returns 0
  • grep '\$REPO/scripts/codex-fleet/' scripts/ returns 0
  • Fresh clone → bash install.sh → smoke test against recodee plans
  • After merge: `tmux attach -t codex-fleet` shows the canonical UI
    (watcher / fleet / plan / waves / review / overview tabs)

🤖 Generated with Claude Code

…dee fallbacks

After the extraction to a standalone repo, the original cross-script
references via $REPO/scripts/codex-fleet/X break for two reasons:

  1. $REPO is the user's project root (set via CODEX_FLEET_REPO_ROOT) —
     no longer the same location as the clone. The clone is wherever
     the user `git clone`d codex-fleet, e.g. ~/codex-fleet/. Sibling
     scripts must resolve from the clone, not from the project root.

  2. The hardcoded /home/deadpool/Documents/recodee fallback default
     in REPO=, FORCE_CLAIM_REPO=, FLEET_TICK_REPO=, etc. only resolves
     correctly on the original maintainer's machine.

This commit:

  - Adds SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
    to every script that uses it (full-bringup, force-claim,
    cap-swap-daemon, fleet-tick-daemon).
  - Replaces 25 occurrences of $REPO/scripts/codex-fleet/X with
    $SCRIPT_DIR/X across 6 files (full-bringup, codex-fleet-2,
    force-claim, proactive-probe, fleet-tick-daemon, cap-swap-daemon).
  - Reroutes every REPO/REPO_ROOT default that was hardcoded to
    /home/deadpool/Documents/recodee onto a three-step lookup:
    explicit env override → $CODEX_FLEET_REPO_ROOT → walk-up from
    $SCRIPT_DIR. 12 scripts updated.
  - tmux-bindings.conf now requires CODEX_FLEET_REPO_ROOT in the env
    of the `tmux source-file` caller (no fallback, since tmux conf
    cannot derive paths from its own location).

After this, the standalone clone works from any path on any machine,
and points at any project's openspec/plans/ via CODEX_FLEET_REPO_ROOT.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@NagyVikt NagyVikt merged commit 1622c75 into main May 14, 2026
@NagyVikt NagyVikt deleted the fix/script-dir-resolution branch May 14, 2026 13:35
NagyVikt added a commit that referenced this pull request May 14, 2026
…gation (#30)

The four dashboard binaries (fleet-state, fleet-watcher, fleet-waves,
fleet-plan-tree) each drew their own in-pane tab strip via
`render_tab_strip` + a hardcoded 5-entry `TABS` const, listening for
crossterm MouseEventKind::Down(Left) and shelling out
`tmux select-window` on click.

Inside the codex-fleet tmux session, this strip is duplicate chrome:
`scripts/codex-fleet/style-tabs.sh` already renders the canonical tab
strip in tmux's status bar with all six windows (0 overview, 1 fleet,
2 plan, 3 waves, 4 watcher, 5 design). The in-binary version had only
five entries — `design` was never added — so the two strips disagreed
about both presence and ordering of tabs. Screenshots showed both
strips stacked, one inert and one wrong.

Even with the SGR mouse-pass-through that POC risk #3 in
fleet-tui-poc flagged, the duplication itself is the bug: two strips
encoding the same navigation in two languages will always drift. The
right fix is to let tmux's status bar be the single source.

This PR:
- Removes `render_tab_strip`, `TABS`, `ACTIVE_TAB`, `tab_rects`,
  `handle_click`, and the per-binary `select_window` helper from all
  four dashboards.
- Drops the `Constraint::Length(1)` slot at row 0 of each layout
  (downstream `rows[N]` indices shift down by 1).
- Removes `EnableMouseCapture` / `DisableMouseCapture` from the
  execute! pair and the `Event::Mouse` branch from the event loop —
  content panes don't need mouse capture once they're not routing
  clicks themselves. `q` / `Esc` to quit is unchanged.
- Removes the now-unused `process::Command`, `MouseButton`,
  `MouseEventKind`, `Modifier`, and `tmux` imports.

Net: 4 files changed, 81 insertions, 277 deletions. The dashboards
shrink by ~50–60% each, and the screenshot now shows exactly one tab
strip — tmux's — covering all six windows.

Verification: `cargo build --workspace` clean; `cargo test -p
fleet-data -p fleet-ui` all pass (34/34 in fleet-data, 0 in fleet-ui).

Co-authored-by: NagyVikt <nagy.viktordp@gmail.com>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
NagyVikt added a commit that referenced this pull request May 14, 2026
)

Adds the post-merge quality rail (improvement #1) and the checkpoint
runner (improvement #3's data half), built around a single shared
scorer primitive. The two surfaces invoke the same Python script with
different inputs and different sinks — same prompt, same I/O shape,
just different trigger and reader.

## The scorer (scripts/codex-fleet/lib/score-diff.py)

Reads {diff, criteria, mode, pr_title} JSON on stdin, asks Claude
whether the diff demonstrably satisfies each acceptance criterion in
plan.md, writes {score, criteria_met, criteria_missed, reasoning}
JSON on stdout. Stdlib only (urllib + json) — no pip dependency.

The prompt is deliberately narrow: "did the diff satisfy these listed
criteria" rather than "is this code good." That makes the call
reading-comprehension rather than aesthetic judgment, which is
tractable for an LLM and reasonably deterministic across runs. The
exact same call shape works for "merged diff" (improvement #1) and
"diff so far" (improvement #3), which is what lets one primitive
serve both.

## Improvement #1: post-merge quality rail

`scripts/codex-fleet/score-merged-pr.sh <PR>`:
1. gh pr view → branch, title, agent-id (parsed from agent/<owner>/...)
2. gh pr diff → full unified diff
3. find openspec/plans/<slug>/plan.md whose slug appears in the branch
   or title; extract its `## Acceptance Criteria` section
4. invoke lib/score-diff.py
5. merge the verdict into /tmp/claude-viz/fleet-quality-scores.json
   keyed by agent-id

`rust/fleet-data/src/scores.rs` reads that JSON with a 5s TTL cache.
`fleet::join` now takes `&ScoresFile` as a third argument and folds
each agent's score into `WorkerRow.quality: Option<u8>`. `fleet-state`
renders it as a third rail (Done axis: high → green, low → red)
between the WEEKLY/5H rails and the STATUS chip. Un-scored agents get
a same-width blank so column alignment is preserved.

The score is **advisory**. It does not feed routing, claim, or
autopilot decisions; the dashboard displays it for the operator to
eyeball. The Python prompt scores criteria, not vibe — but it is still
an LLM call, non-deterministic, and gameable, so treat low numbers as
"look at this," not a fail.

## Improvement #3: checkpoint scorer (data half)

`scripts/codex-fleet/score-checkpoint.sh`:
- Scans `.omc/agent-worktrees/*` for active agent worktrees.
- For each, computes the diff `origin/main..HEAD`, finds the matching
  plan.md, calls lib/score-diff.py in `mode: "checkpoint"`.
- Writes /tmp/claude-viz/fleet-checkpoint-warnings.json keyed by
  agent-id.

Intended cron cadence is ~15min. The colony task_post integration that
turns a low checkpoint score into an actual blocker lives in a
follow-up PR (separate repo: recodee/colony) — this lands the data
half so the trigger half has something to read.

## Why one PR for #1 and #3

The user's sharpening of the plan was explicit: "Build the
diff-scorer once, use it post-merge for #1, then reuse it at
checkpoints for #3." Shipping them in one lane keeps the prompt + JSON
schema + reader path single-sourced. A prompt tweak for one improves
both; a schema break breaks both visibly at once.

## Verification

cargo build --workspace: clean.
cargo test -p fleet-data: 42/42 pass (was 34, +6 scores, +2 quality
                          join wiring tests).
bash -n on both wrapper scripts: clean.
python3 -c "ast.parse(...)" on the scorer: clean.

The actual API call cannot be exercised inside this session without
an outbound network + ANTHROPIC_API_KEY — the operator runs
`./scripts/codex-fleet/score-merged-pr.sh <recent-PR>` once to
populate `/tmp/claude-viz/fleet-quality-scores.json` and confirm the
rail lights up in fleet-state. Mock data shape verified by parses_fixture.

Co-authored-by: NagyVikt <nagy.viktordp@gmail.com>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
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.

2 participants