Fix bin/publish: use correct .env path for rspade_system Fix bin/publish script: prevent grep exit code 1 from terminating script 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2.7 KiB
Executable File
2.7 KiB
Executable File
IDE Services Session Recovery Mechanism
Overview
The VS Code extension now includes automatic session recovery for IDE services. Session files are treated as ephemeral and automatically recreated when needed.
How It Works
Server Side (handler.php)
- Sessions are stored in
/storage/rsx-ide-bridge/auth-{session}.jsonfiles - These files are transient and can be deleted anytime (e.g., during cache clear)
- When a session is not found, the server returns:
{ "error": "Session not found", "code": 401, "recoverable": true, "recovery": "Create new session via POST /_ide/service/auth/create" }
Client Side (VS Code Extension)
The extension automatically recovers from session loss:
- Initial Request: Attempts to use existing session if available
- Session Not Found: If server returns 401 with "Session not found"
- Automatic Recovery:
- Creates new session via
/auth/create - Retries the original request with new session
- Creates new session via
- Transparent to User: No user intervention required
Implementation
TypeScript/JavaScript (formatting_provider.ts)
async make_authenticated_request(endpoint: string, data: any, retry_count: number = 0) {
// Try the request
try {
const response = await this.make_request(endpoint, data, 'POST', true, headers);
return response;
} catch (error: any) {
// Check if recoverable
if (retry_count === 0 && error.message.includes('Session not found')) {
// Clear old session
this.auth_data = null;
// Retry with new session
return this.make_authenticated_request(endpoint, data, retry_count + 1);
}
throw error;
}
}
Benefits
- Zero Configuration: Works automatically, no setup needed
- Resilient: Survives cache clears, server restarts, file deletions
- Transparent: Users never see authentication errors
- Stateless: Session files are temporary and disposable
Testing
- Normal Operation: Extension should work normally
- Session Deletion: Delete
/storage/rsx-ide-bridge/auth-*.jsonfiles - Cache Clear: Run
php artisan rsx:clean - Expected Result: Extension automatically recovers and continues working
Troubleshooting
If recovery fails:
- Check server logs:
/storage/logs/laravel.log - Check VS Code Output panel: "RSpade Formatter" channel
- Verify
/_ide/service/auth/createendpoint is accessible - Ensure workspace has write permissions for
/storage/rsx-ide-bridge/
Security Notes
- Sessions are workspace-specific (stored locally)
- Each session has unique client/server keys
- Signatures prevent replay attacks
- Sessions can be manually revoked by deleting files