feat(code): suggested task cleanup#2273
Open
adboio wants to merge 5 commits into
Open
Conversation
Contributor
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
4dec6f5 to
0b04c91
Compare
Contributor
Prompt To Fix All With AIFix the following 2 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 2
apps/code/src/renderer/features/task-detail/components/SuggestedTasksPanel.tsx:57-59
`pageStart` is local state that persists across repo changes. When the user switches from repo A (was on page 2) to repo B that also has ≥`visibleCount` tasks, `effectivePageStart` stays at the previous offset and the user lands on an arbitrary page of the new repo's suggestions. A `useEffect` that resets `pageStart` to 0 whenever `selectedDirectory` changes would fix this.
```suggestion
const [detailTask, setDetailTask] = useState<DiscoveredTask | null>(null);
const [pageStart, setPageStart] = useState(0);
const [pageDirection, setPageDirection] = useState<1 | -1>(1);
// Reset pagination whenever the active repo changes so the user always
// lands on page 1 of the new repo's suggestions.
useEffect(() => {
setPageStart(0);
}, [selectedDirectory]);
```
### Issue 2 of 2
apps/code/src/renderer/features/setup/hooks/useSetupDiscovery.ts:19-27
**Effect fires twice on first-ever repo selection**
When a brand-new user selects their first repo, the effect runs with `discoveryEverStarted=false` and calls `startSetup(dir)`. Inside `startSetup`, `injectEnricherSuggestions` + `startDiscovery` are both kicked off. `startDiscovery` eventually calls `useSetupStore.getState().startDiscovery(dir, ...)` (after the async API task creation), which flips `discoveryByRepo[dir].status` to `"running"`. This makes `discoveryEverStarted` become `true`, re-running the effect with the same `selectedDirectory` and now calling `startEnricherForRepo(dir)` — even though `startSetup` already invoked `injectEnricherSuggestions`.
The in-process and store guards (`enricherSuggestionsRunningByRepo.has(dir)` / `enricherStatus === "done"|"running"`) prevent an actual double-run, so there is no visible breakage. But if the enricher finishes with an error in the narrow window between the two effect firings, it would be retried unexpectedly on the same selection. Consider removing `discoveryEverStarted` from the deps and capturing the branch decision in a `useRef` keyed to `selectedDirectory`.
Reviews (1): Last reviewed commit: "feat(code): remove suggested tasks from ..." | Re-trigger Greptile |
0b04c91 to
67260f4
Compare
67260f4 to
f23e554
Compare
charlesvien
approved these changes
May 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem
Changes
suggestions-update.mp4 (uploaded via Graphite)
makes all task suggestions (enricher + discovery) scoped to a repo
runs enricher on any new repo selected
removes suggestions from inbox
clicking a suggestion now opens a modal w/ task details and options to implement or dismiss
"see N more in inbox" is gone, suggestions are paginated inline
How did you test this?
manually
Publish to changelog?
no