Conversation
Review Summary by QodoHarden skills sync login and stash recovery with error handling
WalkthroughsDescription• Improve Device Login error handling for private repo creation failures - Detect GitHub 403 permission errors and provide actionable recovery instructions - Replace generic API error with user-friendly guidance to create repo manually • Guard skills sync reset behind stash checkpoint validation - Abort before hard reset if local changes cannot be stashed - Prevent data loss when stash operation fails • Restore untracked skill files after stash-pop conflicts - Extract untracked files from stash reference when pop conflicts occur - Ensure local skill files remain available for commit after sync resolution • Add comprehensive test documentation for all three scenarios Diagramflowchart LR
A["Device Login<br/>Repo Creation"] -->|403 Permission Error| B["Detect GitHub<br/>Integration Limit"]
B -->|Actionable Message| C["User Creates Repo<br/>or Uses Regular Login"]
D["Skills Sync<br/>Pull"] -->|Local Changes| E["Stash Checkpoint"]
E -->|Stash Fails| F["Abort Before<br/>Hard Reset"]
E -->|Stash Success| G["Hard Reset &<br/>Stash Pop"]
G -->|Pop Conflicts| H["Resolve by<br/>File Time"]
H -->|Restore Untracked| I["Recover Files<br/>from Stash"]
File Changes1. src/server/skillsRoutes.ts
|
Code Review by Qodo
1. Locale-dependent stash detection
|
| const stashOutput = await runCommandWithOutput('git', ['stash', 'push', '--include-untracked', '-m', 'codex-skills-autostash'], { cwd: localDir }) | ||
| createdAutostash = !stashOutput.includes('No local changes to save') | ||
| } catch {} | ||
| if (createdAutostash) { | ||
| autostashRef = (await runCommandWithOutput('git', ['rev-parse', 'stash@{0}'], { cwd: localDir })).trim() | ||
| } |
There was a problem hiding this comment.
1. Locale-dependent stash detection 🐞 Bug ☼ Reliability
ensureSkillsWorkingTreeRepo decides whether an autostash was created by substring-matching the human-readable output "No local changes to save", which is not a stable signal and can misclassify stash creation. Misclassification can incorrectly drive the later "stash pop"/conflict-recovery path, obscuring the true repo state and failure mode.
Agent Prompt
### Issue description
Autostash creation is detected by string-matching `git stash push` output (`"No local changes to save"`), which is not a reliable, machine-stable signal.
### Issue Context
`createdAutostash` gates whether the code later runs `git stash pop` and the associated recovery steps; if the detection is wrong, the recovery flow becomes misleading and may hide the real failure mode.
### Fix Focus Areas
- src/server/skillsRoutes.ts[915-943]
### Suggested change
Replace output parsing with a ref-based check:
- Capture the current top stash hash (or empty) before stashing: `git rev-parse -q --verify stash@{0}` (catch -> empty).
- Run `git stash push ...`.
- Re-read `git rev-parse -q --verify stash@{0}`; if it changed (or became non-empty when previously empty), then a new stash was created.
- Set `createdAutostash` and `autostashRef` based on this hash, not on human-readable output.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Summary
Tests