Repository navigation
fix(copilot): a second descriptor on the same log is that log, not an ambiguity - #3110
Conversation
… ambiguity Copilot CLI 1.0 opens its process log a second time while it copies it to rotate. A lookup in that moment saw two descriptors and stored copilot_log_ambiguous, which kept Copilot Chat unavailable until the next registration. Two descriptors on the same path are now one log; two logs of one process stay ambiguous. Co-authored-by: Yu Xie <24205323+YuuuXie@users.noreply.github.com>
|
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 7 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. |
…es the file read Equal readlink strings do not prove the same file: a path renamed and reused between the two looks would let the earlier file's session through. The second descriptor is skipped only when it reaches the device and inode of the file the reader opened. Co-authored-by: Yu Xie <24205323+YuuuXie@users.noreply.github.com>
|
Review notes for 624d801 (omo CLEAR; Codex Terra xhigh run twice):
Real-logger harness on the final head: 8 more runs, no wrong session, bound to A after the rotations and B after its registration. |
|
Local merge gate (owner-approved): |
Summary
Copilot CLI 1.0 opens its own process log a second time while it copies it to rotate (about every 10 MiB). A Copilot Chat lookup that landed in that moment saw two descriptors on
process-<start>-<pid>.logand storedcopilot_log_ambiguous, which kept Chat unavailable (Terminal fallback) until Copilot registered a session again. Now a second descriptor counts as that one log when it resolves to the same path and reaches the same file (device and inode) the reader opened; a path renamed and reused in between, or two different logs of the same process, are still ambiguous.This is the one part of #3086 that cannot pick a session: the reader still reads exactly one file, the same one it read before. Nothing in the rotation-recovery path changes. Credit to @YuuuXie, whose #3086 started this work; the rest of #3086 stays there.
How Copilot 1.0.105 rotates
Measured by driving its own native logger (
runnerCreateFileLoggerinruntime.node) in a scratch folder:.1.logto.2.logand so on, keeping four)..1.log.rotation-stagingand renames it to.1.log, then empties the open log in place./proc/<pid>/fdshows the open log twice.Validation
reads a log Copilot opens a second time to copy it as the one logfails on main (copilot_log_ambiguous) and passes here. It also checks that a later registration still binds, that a different file reported under the same path is still ambiguous (this part fails on the first commit, 68eb323, which compared paths only; Codex reproduced that path-reuse race), and that a second log is still ambiguous.bun test server/copilot.test.ts: 96 pass.bun run check fast: green.copilot_log_ambiguousuntil the next registration): 2/20 on main, 0/20 here.