Repository navigation
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds shared Grok CWD directory-name encoding with Rust-aligned URL encoding, slugification, validation, 255-byte handling, and Blake3-based fallback names. Re-exports the helpers through session path utilities and updates history path construction and synchronous resolution to support long CWD slug groups. Adds dependency and golden-vector tests covering encoding, validation, truncation, and path discovery. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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 |
a6dfd99 to
526ad24
Compare
Port Grok Build's sessions group encoding so Orca can resolve
chat_history.jsonl without scanning the sessions root when cwd is known:
- Short cwds: URL-encode with the urlencoding unreserved set
- Long cwds (>255 encoded bytes): `{slug40}-{blake3_hex16}` matching
xai-org/grok-build `encode_cwd_dirname`
- Pure-JS blake3 via @noble/hashes; golden vectors from OSS algorithm
- Bounded async scan remains the fallback when cwd is unknown
|
Rebased onto current Conflict was only Focused tests: grok-cwd-dirname + grok-session-paths 22/22 green. ahead=1 behind=0. |
526ad24 to
ef047c9
Compare
Summary
Grok chat-history lookup can miss the session file entirely for working directories containing
!,',(,)or*.origin/mainbuilds the sessions group directory name withencodeURIComponent(src/shared/grok-session-paths.ts:63), which leaves those five characters unescaped. Grok Build's Rusturlencoding::encodepercent-encodes every byte outside the unreserved set (ALPHA / DIGIT /-._~), so the two disagree on the real on-disk name:The new
encodeGrokUrlComponentcloses that gap. The same module also ports Grok's long-path branch, whichmaindeclined to encode at all — it returnednullonce the encoded name exceeded 255 bytes and fell back to a bounded scan of up toGROK_SESSION_GROUP_SCAN_MAX_ENTRIES(2048) group dirs. Both branches now resolve in O(1) whencwdis known.Aligned with open-source
xai-org/grok-buildxai_grok_config::paths::encode_cwd_dirname:urlencodingunreserved set){slug40}-{blake3_hex16}(+ on-disk.cwdwritten by Grok)src/shared/grok-cwd-dirname.tsbuildGrokChatHistoryPathCandidates/ sync resolve use the full encoder (short and long)Dependency note
@noble/hashesis pure JavaScript: no native addon, nogypfile, no install scripts. It therefore cannot affect the Ubuntu 20.04 / glibc 2.31 floor described indocs/reference/linux-glibc-compatibility.md, which constrains bundled.nodebinaries only. It has zero runtime dependencies —pnpm-lock.yamlrecords the snapshot as'@noble/hashes@1.8.0': {}. The library is independently audited (Cure53, 2022), with the caveat that upstream states plainly thatblake3fell outside that audit's scope.blake3is used on exactly one branch: the{slug40}-{blake3_hex16}form for cwds whose URL-encoded name exceeds 255 bytes.Claude Opus review
Verdict: APPROVED (pre-push). The reviewer independently re-verified the golden blake3 vectors against the open-source algorithm.
Addressed before push:
isGrokSlugHashCwdDirName(dead export)/+\leaf split for SSH/guest path hostsTesting
vitestgrok-cwd-dirname+grok-session-paths— 22 passed (includes open-source golden long-path vectors)Notes
Contributor PR; enables native-chat, Stop enrichment, and AI Vault path hits for deep worktree paths without scanning.
ELI5
Orca encoded the Grok chat-history directory name slightly differently from Grok itself, so some working directories were never found, and very long ones were not looked up at all. Orca now uses Grok's exact encoding, so the session file is located directly whenever the working directory is known.