Repository navigation
refactor(sdk): remove panic-prone call sites in auth and ssh - #69
Conversation
Replace 13 unwrap/expect occurrences in the SDK auth and ssh modules with typed error propagation. The panic-prone ratchet treats this as an improvement, tightening the budget from 140 to 127 with no baseline change. tx-agent: jcode tx-task: panic-budget-ratchet tx-validated: cargo-check tx-scope: crates/jcode-sdk/src/auth.rs, crates/jcode-sdk/src/ssh.rs tx-intent: drive panic-prone count in the SDK auth/ssh modules from 13 to 0
🤖 CodeAnt AI — Review Status
|
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 59 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
CodeAnt Nitpicks1 code suggestion1. If the state mutex is poisoned,
|
CodeAnt PR Risk: Low Risk
Assessed commit: |
| self.0.cancelled.store(true, Ordering::Release); | ||
| self.0.kill_child(); | ||
| let _state = self.0.state.lock().unwrap(); | ||
| let _state = locked(self.0.state.lock())?; |
There was a problem hiding this comment.
WARNING: Early return on poisoned state mutex may skip cleanup of persisted pending login state
Explanation: If the state mutex is poisoned, the ? operator returns an error early, skipping the CLI cancel operation and setting of the finished flag. This may leave persisted pending login state uncleaned, as noted by CodeAnt AI.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| self.kill_child(); | ||
| } | ||
| self.child.lock().unwrap().take(); | ||
| let _ = self.child.lock().map(|mut c| c.take()); |
There was a problem hiding this comment.
SUGGESTION: Consider handling poisoned mutex in child lock cleanup
Explanation: The current code uses map on the lock result, which skips taking the child if the mutex is poisoned. This may leave the child in the mutex, potentially causing unnecessary kill/wait operations in Drop. Consider using unwrap_or_else to recover the guard and take the child, similar to the kill_child method.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
Code Review SummaryStatus: 1 Issue Found | Recommendation: Merge (1 non-blocking suggestion remains) Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (1 file)
Fix these issues in Kilo Cloud Previous Review Summary (commit 4705118)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 4705118)Status: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (2 files)
Reviewed by free · Input: 299.8K · Output: 32.5K · Cached: 153.6K |
… to '0 in tracked subset' tx-agent: jcode tx-task: B.8.79 tx-parent: 5a54bc0 tx-validated: rg-ratchet-rebaseline (3 categories A/B/C, whole-tree vs tracked-subset), rg-verify (PR #69 effect = -5 .expect() + -8 .unwrap() in sdk/auth.rs), cargo-test (3 restore_session tests pass on new HEAD via prebuilt binary) tx-scope: docs/sessions/2026-10-12-cleanup-and-release/01_AUDIT.md tx-intent: Record B.8.79 — Master moved to 5a54bc0 (PR #69 sdk auth/ssh panic-budget). B.8.78's 'Ratchet A = 0 in production' was misleading: it was 0 in the 46-file peer-agent tracked subset, but the whole-tree non-test production count is 492. CORRECTED framing: tracked-subset panic-budget work is COMPLETE (140→0); whole-tree ratchet is at 492 sites. PR #69 actual effect: -5 .expect() + -8 .unwrap() in sdk/auth.rs (Ratchet B), no change to panic! macros (Ratchet A). 3 restore_session tests still PASS on new HEAD. 4 untracked operator dirs noted (not committed by orchestrator).
User description
Summary
Removes all 13 panic-prone call sites (
unwrap()/expect()) from the SDK auth and ssh modules. The panic ratchet reports this as an improvement with no baseline change.Files
crates/jcode-sdk/src/auth.rs— 10 -> 0crates/jcode-sdk/src/ssh.rs— 3 -> 0Validation
cargo check -p jcode-sdk --all-targets-> 0 errorspython3 scripts/check_panic_budget.py-> reportsproduction panic-prone usage removed: crates/jcode-sdk/src/auth.rs (10 -> 0)and the ssh equivalentLedger
Part of a multi-worker panic-budget sweep. Sibling PRs: #66 (TUI SSH auth), plus branches for the grok-runtime/telemetry cluster and the small core modules.
🤖 Generated with Claude Code
CodeAnt-AI Description
Return errors instead of crashing during SDK login and SSH setup
What Changed
Impact
✅ Fewer app crashes during login and SSH setup✅ Pending logins can still be cleaned up after a lock failure💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.