8000 Show 25 recent worktrees and blocked work with bounded cold-load fairness by rore · Pull Request #57 · rore/minimap · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
332 changes: 332 additions & 0 deletions .agent-workflow/tasks/recent-worktrees-and-blocked.md

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ This repo dogfoods the packaged minimap app. Minimap exposes two capabilities, e

All server interaction goes through scripts in `<skill>/scripts/`:

- `start-server.mjs` — start (or detect + reuse a running instance)
- `start-server.cjs` — start (or detect + reuse a running instance)
- `status.mjs` — print status; exit 0 running, 1 stale, 3 not running
- `stop-server.mjs` — graceful shutdown via `POST /api/shutdown`; cleans stale registry
- `restart-server.mjs` — compose stop + start

The canonical `start-server.cjs` bootstrap defaults `UV_THREADPOOL_SIZE` to 8 only when absent, before importing the existing launcher in the same process. Restart applies the same default to its new child. Explicit overrides are retained; reused servers are unchanged. The legacy `start-server.mjs` entrypoint remains supported without this bootstrap default.

**Do not** curl the server directly, send signals to it (`process.kill`, `taskkill`), poke `$MINIMAP_HOME/server.json` by hand, or invoke `node package/minimap/server.js` directly. The scripts handle every state (running, stale registry, port busy, race with another launcher) and stay correct on Windows where signal-based stop is unreliable.

A single running server transparently serves both modes for any number of repos. The launchers detect an already-running instance via `$MINIMAP_HOME/server.json` + `/health` and reuse it.
Expand Down
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Ask your agent:
The agent starts or reuses the local server and gives you a browser URL. You can also start it yourself using either installed skill:

```bash
node <path-to-skill>/scripts/start-server.mjs
node <path-to-skill>/scripts/start-server.cjs
```

Use the port printed by the launcher; the default is 4312. Roadmap URLs identify the repository explicitly:
Expand All @@ -69,7 +69,7 @@ Use forward slashes for Windows paths and URL-encode the path when necessary. Sp

The board reads markdown files in your repository. **List** and **Columns** show the same items; grouping can follow the board or metadata such as milestone or lane. Editing an item or dragging it in an editable checkout writes back to those files. Agents edit the same files directly.

**Unfinished** narrows the board to unfinished statuses. **In play** includes items with status `active` or `in-progress`, or confirmed attached, nonclosed agent sessions—including dormant sessions. It combines with the other filters, so those can still hide matching items. When participant information is unavailable, known active and in-progress items remain visible with an incomplete-results notice.
**Unfinished** narrows the board to unfinished statuses. **In play** includes items with status `active`, `in-progress`, or `blocked`, or confirmed attached, nonclosed agent sessions—including dormant sessions. It combines with the other filters, so those can still hide matching items. When participant information is unavailable, known active, in-progress, and blocked items remain visible with an incomplete-results notice.

Columns can be collapsed to give other groups more room:

Expand All @@ -89,7 +89,11 @@ Across combines local checkout versions into one read-only board. It uses Git an

The opened checkout appears first while other worktrees load. Feature totals and **In play** results remain provisional until full feature identity is resolved. In both board modes, session badges refresh independently of roadmap loading. Automatic reads reuse a validated snapshot for up to 30 seconds; while the board is visible, an expired snapshot is validated again. **Refresh** always requests fresh validation and keeps the board and drafts usable. Hidden or superseded refreshes are cancelled. Returning to the board reuses a current snapshot; returning after an interrupted read or tracked Spec change validates it again. Failed refreshes retain the last usable view and badges with a stale or unavailable notice and a Refresh retry.

Only local linked Git worktrees are included, not separate clones or remote branches. The combined view currently loads at most **16 checkouts**. **Partial coverage** means some sources were excluded—for example, because of that limit or an unreadable roadmap. Expand the board summary for the reasons. Counts describe loaded sources, and a feature can appear in multiple groups when its versions differ.
Only local linked Git worktrees are included, not separate clones or remote branches.

The combined view selects up to **25 checkouts**: the opened checkout, then the 24 most recent eligible siblings. Recency uses the latest recorded local HEAD Git event (such as checkout, commit, reset, or rebase); plain uncommitted edits do not affect it. Missing activity timestamps sort last, with path order breaking ties. Stale or missing checkouts do not consume slots. Selection updates on fresh validation; cached reads retain their existing selection.

**Partial coverage** means some sources were excluded—for example, because of that limit or an unreadable roadmap. Expand the board summary for the reasons. Counts describe loaded sources, and a feature can appear in multiple groups when its versions differ.

### File layout and configuration

Expand Down Expand Up @@ -176,11 +180,13 @@ Both skills expose these scripts under `scripts/`. Use them for lifecycle operat

| Script | Purpose |
|---|---|
| `start-server.mjs` | Start or reuse a compatible running server. |
| `start-server.cjs` | Start or reuse a compatible running server. |
| `status.mjs` | Report live identity, participant settings, and lifecycle diagnostics; exits 0 running, 1 stale, 3 not running. |
| `stop-server.mjs` | Gracefully stop the server or clean a stale registry. |
| `restart-server.mjs [--replace-runtime]` | Restart; replacing a different or unknown runtime requires explicit opt-in. |

Packaged start and restart default the new server's filesystem worker pool to 8 (`UV_THREADPOOL_SIZE`) only when unset. Explicit overrides remain authoritative. The legacy `start-server.mjs` and direct development entrypoints retain Node's caller-configured/default pool; a reused server is unchanged. See the lifecycle reference for preloads and startup details.

The server is shared across repositories and both modes. Coordinate before replacing it: replacement interrupts all clients and can downgrade the running version. Updating an installed skill's files does not restart the server. See [server lifecycle](package/minimap/skills/minimap-roadmap/references/server.md) for compatibility, configuration, and diagnostics.

### Local access boundary
Expand Down
8 changes: 5 additions & 3 deletions package/minimap/CONTRACT.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,15 @@ Example config:

## Linked worktree view

The board can show **This checkout** or a read-only **Across worktrees** projection. Discovery considers at most 16 registered linked Git worktrees in the opened repository's common Git directory. A separate clone is not a sibling. A source with an incompatible roadmap location, unreadable workspace, or uncertain identity is excluded or marked as partial coverage; it is never silently represented as empty. A checkout whose branch or HEAD changes during the read invalidates the combined snapshot and requires Refresh. Same item ID, path, or content alone do not prove one logical feature. Identity requires either that the shared ancestor contains the same ID/path, or that a branch's complete repository change from that ancestor to a historical commit exactly matches a single-parent integration commit in the other checkout's history, including every changed path, file mode, and old/new Git blob. The latter recognizes newly introduced items after squash integration, including later edits; the matched added item must have the same parsed ID/path. A delete/re-add breaks both forms of continuity. Git cannot distinguish independently reproduced identical complete changes from squash integration, so these are treated as equivalent; independent item-content matches with different complete changes remain separate. Conflicting values stay source-specific. Different board-group memberships are disclosed on the cards; missing-file board references remain visible in coverage details even under metadata lenses. Line-ending-only differences do not produce a visual conflict, although raw file revisions remain exact for stale-write checks. Search, filters, In play, and metadata grouping evaluate each checkout version, not a fabricated merged item.
The board can show **This checkout** or a read-only **Across worktrees** projection. Discovery admits up to 25 registered linked Git worktrees in the opened repository's common Git directory: always the opened checkout, then up to 24 eligible siblings ranked by their last complete local HEAD reflog entry timestamp. Plain uncommitted edits do not affect ranking. Missing or malformed activity evidence sorts last; canonical path breaks ties. Ranking reads are bounded and confined to the known Git administration directory; identity admission remains authoritative. Stale or missing entries do not consume slots, and failed identity admissions are backfilled. Selection is recomputed on fresh validation; cached reads retain their selection.

A separate clone is not a sibling. A source with an incompatible roadmap location, unreadable workspace, or uncertain identity is excluded or marked as partial coverage; it is never silently represented as empty. A checkout whose branch or HEAD changes during the read invalidates the combined snapshot and requires Refresh. Same item ID, path, or content alone do not prove one logical feature. Identity requires either that the shared ancestor contains the same ID/path, or that a branch's complete repository change from that ancestor to a historical commit exactly matches a single-parent integration commit in the other checkout's history, including every changed path, file mode, and old/new Git blob. The latter recognizes newly introduced items after squash integration, including later edits; the matched added item must have the same parsed ID/path. A delete/re-add breaks both forms of continuity. Git cannot distinguish independently reproduced identical complete changes from squash integration, so these are treated as equivalent; independent item-content matches with different complete changes remain separate. Conflicting values stay source-specific. Different board-group memberships are disclosed on the cards; missing-file board references remain visible in coverage details even under metadata lenses. Line-ending-only differences do not produce a visual conflict, although raw file revisions remain exact for stale-write checks. Search, filters, In play, and metadata grouping evaluate each checkout version, not a fabricated merged item.

Squash evidence uses cached first-parent histories with at most 64 commits per history and 4 MiB per Git response. Merge commits can be traversed by their first-parent changes, but only single-parent commits can establish a matching integration. One aggregate permits at most 32 history loads and 8192 raw change records. Proven pairwise relationships connect versions with the same ID/path through a chain, even when a direct comparison has missing, malformed, or capped evidence; that uncertainty remains visible in partial coverage. An explicit deletion/re-add or different ancestor ID anywhere within such a chain separates every version in that contradictory chain and reports identity uncertainty. Disconnected copies stay separate. Equivalence compares committed blobs, not checkout newline formatting or whitespace-insensitive patch IDs.

Across may first show a provisional opened-checkout-only snapshot while the full scan runs. Feature totals and In play are explicitly incomplete; participant counts and details remain unknown until full identity is resolved. Same-scope Refresh retains the existing board and editor during loading. Reconciliation preserves newer view/selection changes and unsaved editor context; a failed full read retains usable provisional or last-known content with an error and Refresh retry.

In both modes, automatic roadmap reads may reuse a snapshot validated within 30 seconds. A stale snapshot remains usable while fresh validation runs; Manual Refresh always requests fresh validation. The visible board validates expired snapshots, and hidden or superseded requests are cancelled without cancelling another client's shared read. Returning to the board reuses a current snapshot; a tracked Spec mutation or interrupted validation requires fresh validation. Failed validation retains explicitly stale last-known content only within the same opened repository and read mode. External file changes become visible at the next successful validation. Cached reads never replace live source checks or exact write-revision guards.
In both modes, automatic roadmap reads may reuse a snapshot validated within 30 seconds. A stale snapshot remains usable while fresh validation runs; Manual Refresh always requests fresh validation. The visible board validates expired snapshots, and hidden or superseded requests are cancelled without cancelling another client's shared read. Returning to the board reuses a current snapshot; a tracked Spec mutation or interrupted validation requires fresh validation. Failed validation retains explicitly stale last-known content only within the same opened repository and read mode. External file changes become visible at the next successful validation. Cached reads never replace live source checks or exact write-revision guards. Full Across scans have a bounded 60-second request/job budget, including queue waiting; This checkout, source-open and opened-only reads keep their 30-second budgets. The scanner admits at most two regular jobs plus one reserved This/source-open/opened-only job. This reservation lets a new checkout load while two Across scans run; it does not accelerate the full scans. Freshness intervals and every source/revision check remain unchanged.

Across worktree requests may opt into `compact=1`. The `worktreeFormat: "compact-v1"` response reuses the sources table for version source contexts and feature-version indexes for group placements. The browser API expands this representation before rendering; feature identity, missing references, coverage and source guards are unchanged. The shared cache retains this compact representation for all callers. Requests without the flag receive the existing expanded response shape and share the same snapshot identity. Older servers returning expanded responses remain supported.

Expand Down Expand Up @@ -96,7 +98,7 @@ Pallium integration is optional and read-only. Minimap never stores live partici

Legacy `GET /api/board/participant-counts` remains available. Done, shipped, superseded, cancelled, and canceled items are omitted by default; `includeCompleted=1` includes them, absent or `0` preserves the default, and other or repeated values are rejected. Legacy worktree-workspace requests retain combined participant enrichment unless `participants=0` opts out. Both paths use the bounded Pallium `POST /relay/work-refs/participant-counts`, never per-card requests. Badges mean attached, nonclosed sessions only; they do not signal execution, ownership, or item status. Completed-item board badges appear only in In play; session detail remains available on demand in the existing item panel.

In play matches normalized status `active` or `in-progress`, OR a confirmed positive total of attached, nonclosed sessions, including dormant sessions. It AND-composes with search, metadata, and Unfinished in every lens and layout, persists as `inPlay=1`, and resets on Clear. Participant refresh rederives visible groups. An `ok` response to `includeCompleted=1` must echo `includeCompleted: true`; an older server that ignores the query leaves results incomplete, not complete zero. Loading, disabled, unsupported, unavailable, or partial observations retain known active and in-progress matches and show an incomplete-results notice rather than claiming complete zero results. Association does not imply current execution.
In play matches normalized status `active`, `in-progress`, or `blocked`, OR a confirmed positive total of attached, nonclosed sessions, including dormant sessions. It AND-composes with search, metadata, and Unfinished in every lens and layout, persists as `inPlay=1`, and resets on Clear. Participant refresh rederives visible groups. An `ok` response to `includeCompleted=1` must echo `includeCompleted: true`; an older server that ignores the query leaves results incomplete, not complete zero. Loading, disabled, unsupported, unavailable, or partial observations retain known active, in-progress, and blocked matches and show an incomplete-results notice rather than claiming complete zero results. Association does not imply current execution.

Recent and quieter Dormant badges classify those attached sessions using Pallium's lifecycle, not work on this feature or staffing. The upstream `relay-work-ref-counts/v1` response retains `participant_count` and adds `recent_participant_count`, `dormant_participant_count`, `as_of` UTC, and `recent_seconds: 86400`. Recent includes last seen at or after `as_of` minus 86400 seconds; total equals Recent plus Dormant, with origins deduplicated and alias/destination health irrelevant. Minimap validates and projects these fields, never a second cutoff. Legacy total-only responses leave classification unsupported, not all-Recent, and never cause per-card fallback requests. Board and detail are separate observations, not a shared snapshot.

Expand Down
4 changes: 3 additions & 1 deletion package/minimap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,13 @@ Each skill exposes the same four scripts under `scripts/`. Agents use these only

| Script | What it does |
|---|---|
| `start-server.mjs` | Start, or detect + reuse a running instance. |
| `start-server.cjs` | Start, or detect + reuse a running instance. |
| `status.mjs` | Print live runtime version/API/source and process status. Exit 0 running, 1 stale, 3 not running. |
| `stop-server.mjs` | Graceful shutdown via `POST /api/shutdown`. Cleans stale registry. |
| `restart-server.mjs [--replace-runtime]` | Restart the same runtime; explicitly opt in to replacing a different or unknown shared runtime. |

`start-server.cjs` sets a process-local `UV_THREADPOOL_SIZE=8` only when absent, then imports the existing launcher in the same process. Restart sets that default in its new child's environment. Explicit overrides and reused servers remain unchanged. Legacy `start-server.mjs` and direct development entrypoints retain Node's caller-configured/default pool. Preloads that initialize libuv before the bootstrap must set the desired pool in the initial environment; the bootstrap cannot retune an initialized pool.

The launcher probes `$MINIMAP_HOME/server.json` and live health. Compatible APIs can reuse different releases; unknown/incompatible runtimes remain untouched. Status prints live version/API/source. Routine restart requires the same version and canonical runtime source path; coordinate shared-client impact before `--replace-runtime`, which can replace or downgrade a different/unknown server. No adjacent-port sweep is performed. Update relevant installed skill copies via the existing copy-in method or checkout links; old launchers cannot be retroactively guarded. File updates alone do not replace a running server.

Optional roadmap Participants lookup is configured separately from agent MCP availability. Validated loopback `MINIMAP_PALLIUM_ENDPOINT` and optional `MINIMAP_PALLIUM_DASHBOARD_ENDPOINT` values supplied to a successful start or restart command are remembered locally; an explicit empty dashboard value disables links while retaining lookup, and an explicit empty lookup value clears both. Reuse verifies the exact effective settings, and `status.mjs` reports lookup and link state without exposing either origin.
Expand Down
Loading
Loading
0