Read PR, linked issues, and source files.
UnderstandFixed missing setter modification for settings persistence.
EditConfirmed fix worked and committed changes.
VerifyYou are given one or more GitHub PR URLs: https://github.com/badlogic/pi-mono/pull/972
For each PR URL, do the following in order:
packages/*/CHANGELOG.md files. Report whether an entry exists. If missing, state that a changelog entry is required before merge and that you will add it if the user decides to merge. Follow the changelog format rules in AGENTS.md. Verify:
### Breaking Changes, ### Added, ### Fixed, etc.)Fixed foo ([#123](https://github.com/badlogic/pi-mono/pull/123) by [@user](https://github.com/user))### Breaking Changes, not just ### FixedOutput format per PR: PR: Changelog:
If no issues are found, say so under Bad and Ugly.
The user wants me to review a GitHub PR. Let me start by fetching the PR details.
>gh pr view 972 --repo badlogic/pi-mono --json title,body,comments,commits,files,author,state,labels,headRefName,baseRefName>gh pr diff 972 --repo badlogic/pi-monoLet me fetch the linked issue #916 and check for comments on the PR.
Now let me read the linked issue #916 and check the existing source files:
>gh issue view 916 --repo badlogic/pi-mono --json title,body,comments,labels,stateThe file was truncated. Let me read the rest of the editor.ts file to verify it's the current state on main.
Let me read the rest of the editor.ts file and check for changelog entries:
Now I need to check the settings-manager.ts and interactive-mode.ts files to verify the current state on main and compare with the PR diff. Let me also read the settings.md documentation.
Let me check the current state of the relevant files and look at the PR review comment:
>gh api repos/badlogic/pi-mono/pulls/972/reviewsNow let me check for inline review comments on the PR:
Let me check for inline review comments:
>gh api repos/badlogic/pi-mono/pulls/972/commentsThe review comment says "Needs to be this.editor, not defaultEditor" on line 3055. This is an issue with the callback in interactive-mode.ts.
Let me verify the current code structure on main to understand the editor handling:
Let me check the interactive-mode.ts to understand the editor pattern:
>cd /Users/badlogic/workspaces/pi-mono && grep -n "this.editor\." packages/coding-agent/src/modes/interactive/interactive-mode.ts | head -30I see. The this.editor property is the active editor (which could be either defaultEditor or a custom editor from an extension). The review comment is correct: when updating the autocomplete max visible setting from the settings menu, it should update this.editor (the currently active editor), not just defaultEditor.
However, looking at the editorPaddingX pattern further, I need to verify that pattern:
>cd /Users/badlogic/workspaces/pi-mono && grep -n "onEditorPaddingXChange" packages/coding-agent/src/modes/interactive/interactive-mode.ts>cd /Users/badlogic/workspaces/pi-mono && grep -n "setPaddingX" packages/coding-agent/src/modes/interactive/interactive-mode.tsI see! The existing onEditorPaddingXChange pattern does:
this.defaultEditor.setPaddingX(padding)this.editor.setPaddingX(padding) if it's a different editorSo the review comment is correct - the PR needs to follow the same pattern for autocompleteMaxVisible.
Now let me summarize the PR review:
PR Summary:
autocompleteMaxVisible setting (range 3-20, default 5) to control dropdown heighteditorPaddingXIssues Found:
this.defaultEditor but should follow the editorPaddingX pattern using this.editor (to also update custom editors)Changelog Status:
packages/tui/CHANGELOG.md or packages/coding-agent/CHANGELOG.md for this featureDocumentation:
packages/coding-agent/docs/settings.md is updated in the diff (adds the autocompleteMaxVisible row to the table)Let me verify I've checked everything and provide the review.
Now I have all the information needed to provide a complete review.
PR: https://github.com/badlogic/pi-mono/pull/972
packages/tui/CHANGELOG.md or packages/coding-agent/CHANGELOG.mdpackages/tui/CHANGELOG.md: ### Added - autocompleteMaxVisible option in EditorOptions with getter/setter methodspackages/coding-agent/CHANGELOG.md: ### Added - autocompleteMaxVisible setting for configurable autocomplete dropdown height (attribution to @masonc15)editorPaddingX pattern consistently across both packagesMath.max(3, Math.min(20, Math.floor(maxVisible))) in both settings-manager and EditorNumber.isFinite() for defensive validation in the Editor componentsettings.md with the new settinginteractive-mode.ts, the onAutocompleteMaxVisibleChange callback uses this.defaultEditor.setAutocompleteMaxVisible(maxVisible) but should follow the editorPaddingX pattern which also updates this.editor when a custom editor is active. The pattern is:
this.defaultEditor.setAutocompleteMaxVisible(maxVisible);if (this.editor !== this.defaultEditor && this.editor.setAutocompleteMaxVisible !== undefined) { this.editor.setAutocompleteMaxVisible(maxVisible);}pkg:tui and pkg:coding-agent labels on the PRpackages/tui/src/components/editor.ts: Adds autocompleteMaxVisible field to EditorOptions and Editor class with getter/setter, uses it in SelectList creation (replaces hardcoded 5)packages/coding-agent/src/core/settings-manager.ts: Adds autocompleteMaxVisible to Settings interface with getter/setterpackages/coding-agent/src/modes/interactive/components/settings-selector.ts: Adds UI toggle with preset valuespackages/coding-agent/src/modes/interactive/interactive-mode.ts: Passes setting to editor, wires up callbackpackages/coding-agent/docs/settings.md: Documents the new settingmerge via gh cli, pull from origin, fix the review shit
The user wants me to:
this.editor instead of this.defaultEditor)Let me do this step by step.
>cd /Users/badlogic/workspaces/pi-mono && gh pr merge 972 --squash --delete-branchThere are merge conflicts. Let me checkout the PR branch, fetch main, and resolve the conflicts.
>cd /Users/badlogic/workspaces/pi-mono && gh pr checkout 972Now I need to rebase on main and resolve any conflicts.
>cd /Users/badlogic/workspaces/pi-mono && git fetch origin main && git rebase origin/mainThere's a conflict in editor.ts. Let me read the file to see the conflict markers.
>cd /Users/badlogic/workspaces/pi-mono && grep -n "<<<<<<" packages/tui/src/components/editor.tsThere are two conflicts. Let me look at the specific areas.
I see. The conflicts are because main now uses autocompleteState instead of isAutocompleting. The PR uses the old isAutocompleting pattern, but main now has autocompleteState which can be "regular" or "force".
The solution is to:
this.autocompleteMaxVisible from the PRthis.autocompleteState = "regular" or "force" from mainLet me resolve these conflicts.
Now the second conflict.
Now I need to check if there's still an updateAutocomplete function that needs the autocompleteMaxVisible as well - from the earlier output I can see it's already using this.autocompleteMaxVisible, so that should be fine.
Let me verify there are no more conflict markers and then continue with the rebase.
>cd /Users/badlogic/workspaces/pi-mono && grep -n "<<<<<<\|======\|>>>>>>" packages/tui/src/components/editor.tsGood, no more conflict markers. Now let me continue the rebase.
>cd /Users/badlogic/workspaces/pi-mono && git add packages/tui/src/components/editor.ts && git rebase --continueNow I need to fix the review issue. The onAutocompleteMaxVisibleChange callback should update both this.defaultEditor and this.editor (if they're different), following the same pattern as onEditorPaddingXChange.
Now let me fix the review issue in interactive-mode.ts:
Now I see the current onAutocompleteMaxVisibleChange implementation:
Now I see it. I need to add the same pattern as onEditorPaddingXChange - update both defaultEditor and also this.editor if different.
Now I need to add changelog entries. Let me add them to both packages.
Now add the changelog entries:
I need to add the entries. For the TUI package, I'll add to the existing ### Added section. For coding-agent, I need to check if there's an ### Added section already.
Now for coding-agent. Let me check what's already in the Added section.
There are two ### Added sections (one at line 10 and one at line 7, oops there's a spacing issue). Let me add to the existing ### Added section after the first entry.
Now let me run the check to verify everything is correct.
>cd /Users/badlogic/workspaces/pi-mono && npm run check 2>&1I need to add the setAutocompleteMaxVisible method to the EditorComponent interface. Let me find and update that interface.
>cd /Users/badlogic/workspaces/pi-mono && grep -rn "interface EditorComponent" packages/I need to add setAutocompleteMaxVisible to the EditorComponent interface in packages/tui/src/editor-component.ts.
I need to add the setAutocompleteMaxVisible method to the interface. It should go after setPaddingX in the Appearance section.
Now run check again.
>cd /Users/badlogic/workspaces/pi-mono && npm run check 2>&1All checks pass. Now I need to commit the changes and then push and close the PR.
>cd /Users/badlogic/workspaces/pi-mono && git add packages/tui/src/editor-component.ts packages/tui/src/components/editor.ts packages/coding-agent/src/modes/interactive/interactive-mode.ts packages/tui/CHANGELOG.md packages/coding-agent/CHANGELOG.md && git commit --amend --no-editNow I need to force push this branch and then merge the PR.
>cd /Users/badlogic/workspaces/pi-mono && git push origin feat/autocomplete-max-visible --forceThe PR is already open with the original masonc15's branch. Now let me try merging again.
>cd /Users/badlogic/workspaces/pi-mono && gh pr merge 972 --squash --delete-branchThe problem is that the PR is still pointing to the contributor's fork and their branch hasn't been updated. Let me just merge locally and push directly to main, then close the PR.
>cd /Users/badlogic/workspaces/pi-mono && git checkout main && git pull origin mainNow I need to merge my fixed feature branch into main.
>cd /Users/badlogic/workspaces/pi-mono && git merge feat/autocomplete-max-visible --no-ff -m "feat: add autocompleteMaxVisible setting for configurable dropdown height (#972)
Fixes #916
Adds an autocompleteMaxVisible setting (range 3-20, default 5) to control how many items are visible in the editor's autocomplete dropdown.
Co-authored-by: Colin Mason <[REDACTED]>"Now push main and close the PR with a comment.
>cd /Users/badlogic/workspaces/pi-mono && git push origin mainNow close the PR with a comment and delete the local branch.
>cd /Users/badlogic/workspaces/pi-mono && gh pr close 972 --comment "Merged manually after fixing the review issue (using this.editor instead of defaultEditor for custom editor support) and adding changelog entries. Thanks @masonc15!" --delete-branchDone. Let me clean up any stray branches.
>cd /Users/badlogic/workspaces/pi-mono && git branch -D feat/autocomplete-max-visible 2>/dev/null; echo "Done"The branch was already deleted. Let me also close issue #916 since the PR fixed it.
>cd /Users/badlogic/workspaces/pi-mono && gh issue close 916 --comment "Fixed via #972"The issue was already closed. All done.
Done. Merged PR #972 to main with fixes:
this.defaultEditor.setAutocompleteMaxVisible() to also update this.editor when a custom editor is active (following the editorPaddingX pattern)setAutocompleteMaxVisible to EditorComponent interface for type safetypackages/tui/CHANGELOG.md and packages/coding-agent/CHANGELOG.md with proper attribution to @masonc15autocompleteState pattern on main)when i change the max lines autocomplete shit in /settings, it is applied (e.g. 5 -> 10), but if i then open /settings again it shows 5
The user is saying that when they change the autocompleteMaxVisible setting in /settings, it applies visually, but when they reopen /settings, it shows the old value (5) instead of the new value (10).
This suggests that either:
Let me check the code to understand the flow:
settings-selector.ts - how it gets the current valuesettings-manager.ts - the getter/setterinteractive-mode.ts - how it passes the config to the selectorLet me look at these files.
I see the issue. Let me check the setter for setAutocompleteMaxVisible - it might not be calling markModified() which is needed for proper saving.
>cd /Users/badlogic/workspaces/pi-mono && grep -A5 "setAutocompleteMaxVisible" packages/coding-agent/src/core/settings-manager.tsI see! The setAutocompleteMaxVisible setter is missing the markModified() call. Looking at the code structure, it seems that recent changes introduced a markModified() pattern to track which settings were actually modified by pi (vs external edits). Without calling markModified(), the setting change gets lost when the settings file is reloaded.
Let me check how other setters use markModified():
>cd /Users/badlogic/workspaces/pi-mono && grep -B2 -A4 "setEditorPaddingX" packages/coding-agent/src/core/settings-manager.tsFound it. setEditorPaddingX calls this.markModified("editorPaddingX") but setAutocompleteMaxVisible is missing that call. I need to add it.
Found it. Missing markModified() call:
Now run check and commit.
>cd /Users/badlogic/workspaces/pi-mono && npm run check 2>&1Good. Now commit and push.
>cd /Users/badlogic/workspaces/pi-mono && git add packages/coding-agent/src/core/settings-manager.ts && git commit -m "fix: autocompleteMaxVisible setting not persisting
Missing markModified() call caused the setting to be lost on reload."Now push.
>cd /Users/badlogic/workspaces/pi-mono && git push origin mainFixed. The issue was that setAutocompleteMaxVisible was missing the markModified("autocompleteMaxVisible") call. Without it, the setting wasn't being tracked as modified by pi, so it got lost when the settings file was reloaded (the recent change to preserve external edits requires calling markModified() for each setting that pi changes programmatically).
Fixed. The setter was missing markModified("autocompleteMaxVisible") which is required for settings to persist after the recent external-edit preservation change.
works, commit and push
just the file(s) you modified, no other file that's changed on disk, another agent is working on that
The user wants me to commit and push only the file I modified. But I already committed and pushed in the previous step. Let me check the git status to see if there's anything pending.
>cd /Users/badlogic/workspaces/pi-mono && git statusThe fix was already committed and pushed in my previous response. The uncommitted changes showing now are from another agent working on changelogs. Nothing more for me to do.
Already done - committed and pushed in the previous step. The uncommitted changelog changes are from the other agent.
this.defaultEditor.setAutocompleteMaxVisible(maxVisible);if (this.editor !== this.defaultEditor && this.editor.setAutocompleteMaxVisible !== undefined) { this.editor.setAutocompleteMaxVisible(maxVisible);}