-
Notifications
You must be signed in to change notification settings - Fork 0
fix(tui): pass directory parameter to all API calls #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
✅ CODE REVIEW COMPLETE - Excellent Minimal Bug Fix🚦 CI/CD Status
🔍 Analysis Overview
✅ Minimalism VerificationEXCELLENT - This is a textbook example of minimal, targeted bug fix:
🔍 Code Quality AnalysisAll 13 Directory Parameter Additions Verified: main.go (4 locations):
app.go (9 locations):
Pattern Consistency: ✅
🎯 Root Cause AnalysisBug Explanation: Why This Fixes Issue sst#3026:
Completeness Check: 🔍 Investigated but NOT modified (intentional):
QUESTION:
This doesn't block merge, but worth clarifying for upstream review. 📋 PR Metadata ReviewTitle: ✅ Excellent
Description: ✅ Comprehensive
Commit Message: ✅ High Quality Issue Reference: ✅ Links to sst#3026 ✅ OpenCode Guidelines ComplianceMinimal, Targeted Changes: ✅
Bug Fix Qualification: ✅
Ready for Upstream: ✅
🎯 Final VerdictSTATUS: ✅ APPROVED - READY TO RETARGET TO sst/opencode Strengths:
Minor Enhancement Suggestion (Optional): Recommendation: ✅ READY TO MERGE AND RETARGET UPSTREAM This PR is ready to be retargeted to |
1ce567f to
c1ce097
Compare
✅ FINAL COMPREHENSIVE REVIEW - COMPLETE🚦 CI/CD Status
🎯 COMPLETENESS VERIFICATION: ✅ ALL 18 LOCATIONS FIXEDCONFIRMED: PR now includes ALL 18 API call locations (updated from initial 13) main.go (4 locations):
app.go (14 locations - includes ALL session operations): Configuration & Setup:
Session CRUD Operations:
Session Interaction Operations:
Coverage Analysis: ✅ COMPLETE
Gap Analysis: ✅ NO REMAINING GAPS
🔍 CODE QUALITY ANALYSIS: ✅ EXCELLENTPattern Consistency: ✅ PERFECT
Directory Source Correctness: ✅ VERIFIED
Go Code Quality: ✅ PASSES # Build verification
go build -v ./packages/tui/cmd/opencode
✅ PASS
# Static analysis
go vet ./packages/tui/...
✅ PASS (no warnings)🎯 MINIMALISM VERIFICATION: ✅ TEXTBOOK EXAMPLEFile Scope: ✅ PERFECT
Change Metrics:
Surgical Precision: ✅ VERIFIED
🐛 BUG FIX COMPLETENESS: ✅ COMPREHENSIVERoot Cause: TUI not passing Fixes Applied:
🚀 UPSTREAM READINESS: ✅ READYCommit Message: ✅ HIGH QUALITY PR Description: ✅ COMPREHENSIVE
Issue Reference: ✅ Fixes sst#3026 Retargeting Readiness: ✅
📊 FINAL CHECKLIST1. Completeness: ✅
2. Code Quality: ✅
3. Minimalism: ✅
4. Bug Fix Completeness: ✅
5. Upstream Readiness: ✅
🎯 FINAL VERDICT: ✅ REVIEW COMPLETE - READY FOR UPSTREAMThis PR is a textbook example of a minimal, targeted bug fix: Strengths:
Quality Metrics:
Blocking Issues: NONE Recommendations:
Next Steps:
Congratulations on achieving true minimalism with comprehensive coverage! 🎉 |
Fixes sst#3026 TUI was not passing directory parameter in API calls, causing server to fall back to process.cwd() instead of user's project directory. Root cause had three components: 1. TUI API calls didn't pass Directory parameter 2. TypeScript CLI used polluted process.cwd() after wrapper changed directories 3. Go TUI used os.Getwd() which returned changed directory instead of original Changes: - main.go: Read OPENCODE_ORIGINAL_CWD env var, pass to 4 API calls - app.go: Read OPENCODE_ORIGINAL_CWD env var, pass to 14 API calls - tui.ts: Use OPENCODE_ORIGINAL_CWD env var for working directory All 18 API call locations now pass correct directory context. Wrapper script (external) sets OPENCODE_ORIGINAL_CWD to preserve user's directory. Files: - packages/tui/cmd/opencode/main.go (4 API calls + env var handling) - packages/tui/internal/app/app.go (14 API calls + env var handling) - packages/opencode/src/cli/cmd/tui.ts (cwd resolution from env var)
c1ce097 to
c5c897d
Compare
Problem
TUI doesn't pass
directoryparameter in API calls, causing server to useprocess.cwd()instead of user's project directory.Symptom:
/sessionsshows empty in EXISTING projects despite sessions existing in storage.Fixes sst#3026
Root Cause
The issue had three components:
Solution
Use
OPENCODE_ORIGINAL_CWDenvironment variable (set by wrapper script) across all components.Changes
Added
Directoryparameter to all 18 API param locations + 3 env var readers:packages/tui/cmd/opencode/main.go:
packages/tui/internal/app/app.go:
packages/opencode/src/cli/cmd/tui.ts:
Testing
Files Changed
Compliance
✅ Bug fix (accepted by OpenCode guidelines)
✅ Minimal, targeted changes only
✅ No formatting changes included
✅ No SDK regeneration needed
✅ Wrapper script dependency documented (sets OPENCODE_ORIGINAL_CWD)