Skip to content

Refresh live model catalog when a harness session becomes active - #238

Merged
hardbeat920 merged 2 commits into
hardbeat920:mainfrom
stillNovice:fix/model-catalog-on-session-activate
Sep 15, 2026
Merged

hardbeat920 merged 2 commits into
hardbeat920:mainfrom
stillNovice:fix/model-catalog-on-session-activate

Conversation

@stillNovice

@stillNovice stillNovice commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Problem

Opening the model picker for a fresh session showed only the built-in fallback model (e.g. just Default for Pi) instead of the live catalog from the CLI (pi --mode rpc reports ~70 models for a gateway-configured setup).

Root cause

Live model catalogs are loaded lazily — probing a CLI spawns a real process, so MonoCode deliberately avoids probing every harness at boot (see the comment in refreshHarnessCatalogs). But the boot-time refresh runs in a useEffect with [] deps that fires before restored sessions land in sessionsRef, so it sees an empty harness list and never probes anything.

The only remaining trigger was opening the model picker itself (ModelPicker.tsx). If the probe fails or hasn't run, a newly created session sits on the fallback list indefinitely.

Fix

Refresh the live catalog for the active session's harness whenever the active harness changes (App.tsx). This covers:

  • creating a new session
  • switching between sessions on different harnesses
  • restoring sessions at boot (harness becomes active after restore)

No repeat spawns: refreshHarnessCatalogs is already idempotent — hasLiveCatalog skips harnesses whose catalog is loaded, and inflight dedupes concurrent probes.

Testing

  • vitest run: 2121 passed, 0 failed
  • Manual: fresh Pi session now loads the full live catalog without opening the picker

Summary by CodeRabbit

  • Improvements
    • The live model catalog now refreshes automatically when the active harness changes, keeping available models current.
    • Catalog refreshes are skipped when no harness is selected or when the selected harness is not live.
    • Refresh requests are coordinated to avoid unnecessary duplicate updates.

Model catalogs load lazily via CLI probes, but opening the model picker
was the only trigger after boot (the boot refresh runs before restored
sessions land, so it saw an empty harness list). A fresh Pi session
therefore showed only the built-in 'Default' fallback model.

Probe the active session's harness whenever it changes so the live
catalog arrives with the session. refreshHarnessCatalogs is idempotent
(deduped by hasLiveCatalog + inflight map), so this adds no repeat
spawns.
@coderabbitai

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 5fc03a34-0848-4a20-a69e-4c3aaa709fa0

📥 Commits

Reviewing files that changed from the base of the PR and between 4ff1fa5 and cf733a4.

📒 Files selected for processing (1)
  • src/App.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/App.tsx

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

Changes

Live harness catalog

Layer / File(s) Summary
Refresh catalog on harness changes
src/App.tsx
Comments clarify lazy probing, restored-session timing, live-harness checks, and refresh deduplication. Executable behavior is unchanged.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~2 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to cf733

The documented catalog-refresh behavior has no identified merge-blocking risk in the supplied evidence.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly explains the problem, root cause, fix, scope, and testing results. It does not use the template headings and omits the checklist, but it provides the required technical informa…
Title check ✅ Passed The title is concise, specific, and accurately summarizes the main change: refreshing the live model catalog when a harness session becomes active.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@hardbeat920
hardbeat920 merged commit a83b9c5 into hardbeat920:main Sep 15, 2026
4 checks passed
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