fix(tui): only run project check when at root menu - #2470
Conversation
|
Claude Security Review: no high-confidence findings. (run) |
There was a problem hiding this comment.
AgentCore Harness Review
Verdict: Looks good
Small, focused fix. The isRootMenuPath check correctly avoids running projectManager.resolve when the TUI is deep-linked into a nested screen (e.g. agentcore runtime), and the new useProjectDetected gate + LoadingFrame (with optional onBack) resolves the project on-demand only once the user navigates to the root menu. Hook order is stable, the seed via ProjectDetectedKey still short-circuits the fetch when the launch already resolved it, and both the router-level and TUI-level tests cover the new behavior.
One minor thing worth being aware of (not blocking): with the old code, renderScreen("/agentcore") in tests saw inProject = false immediately (since ProjectDetectedKey isn't seeded in renderScreen); with the new code it now goes through a useProjectDetected fetch that calls FsProjectManager.resolve from the test process cwd on every root-menu test that doesn't use inProjectContext. That works today because the repo isn't itself an agentcore project, but it does couple those tests to the filesystem — worth watching if flakes appear.
Nothing here requires changes before merging.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## refactor #2470 +/- ##
=========================================
Coverage 97.29% 97.29%
=========================================
Files 625 625
Lines 44799 44829 +30
=========================================
+ Hits 43587 43617 +30
Misses 1212 1212 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Claude Security Review: no high-confidence findings. (run) |
|
Claude Security Review: no high-confidence findings. (run) |
Description
Limit project detection to only run when TUI is at root menu.
src/tui/index.tsxto check if the route is/agentcore. Any nested routes will skip project resolutioninProjectboolean to ``src/handlers/screen.tsx`. If value is undefined, screen will detect project before rendering. Boolean value passed in allows screen to render immediatelysrc/handlers/project/ProjectGate.tsxwith react query to tell us if project exists (distinct from useProject, since we just need to know if it exists -- we don't need to load complete project)src/components/Root.tsxto distinguish between “not in a project” and “not verified yet”. Uses existing project context when available and otherwise lets the root screen perform the check lazilyAdded test coverage confirming unrelated TUI commands don't resolve the project, and that project detection runs when navigating back to root menu from any nested screen
Type of Change
Testing
How have you tested the change?
bun testbun run test:e2e, or explained why they are not applicablebun run typecheckbun run lint:checkbun run format:checkbun run buildsrc/assets/, I updated affected snapshots withbun test <test-file> --update-snapshotsand committed themChecklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.
Stack created with GitHub Stacks CLI • Give Feedback 💬