-
Notifications
You must be signed in to change notification settings - Fork 147
fix(daemon): eliminate flakiness in daemon and wrapper-daemon test suites #1064
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
Changes from all commits
37fab8b
b75e783
a61f552
45df33f
330151c
7ff6c9d
a58f0a4
4300e71
19134b5
7bbe1d0
4be2602
d15521c
448a0b6
88461e6
f85b563
10fc55c
1d01b56
43b2765
7884fb0
b2daaf7
73dec01
0b4128a
7731b1b
1b413d8
260d9dd
966fb21
5e43576
38c897b
c2f44bb
a45a96d
8adf0cd
3cd9ef7
5e6d7fe
11d547b
795203d
acf9147
870b50e
ac1b4c8
54e7394
faa43a7
bbe0926
d236fe8
cddb505
5ade0b2
ccab563
d0439c0
b3705e3
80c74ef
fdfa27d
b9a9b93
69de982
0a3e03d
c91b35b
70269d3
36f486d
b6a7c16
bb107e2
318f270
a54a5cb
b5d9a19
a1e8ba5
6dde775
f5a375e
9d8dd78
b51c5d3
f886b0a
bcf31e2
6a111b0
eff0ea1
7722c14
59071cd
18d8783
6ae506b
320f961
1a50748
f7ece98
68d524f
94f80f2
6934d6c
0b3e921
51ddf42
aad9997
1965069
8c051bb
64c0298
529482c
329ac7a
e35eed2
47f7c97
646529f
2c95af8
6635f1b
480e6fa
50be23d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -175,9 +175,49 @@ pub fn handle_git(args: &[String]) { | |||||
|
|
||||||
| let exit_status = proxy_to_git(args, false, None, Some(&invocation_id)); | ||||||
|
|
||||||
| let post_state = worktree | ||||||
| let mut post_state = worktree | ||||||
| .as_deref() | ||||||
| .and_then(crate::git::repo_state::read_head_state_for_worktree); | ||||||
| // Under heavy I/O the ref file may be transiently unresolvable. | ||||||
| // Retry so the daemon overlay receives a valid HEAD OID. | ||||||
| if post_state.as_ref().is_none_or(|s| s.head.is_none()) { | ||||||
| for _ in 0..25 { | ||||||
| std::thread::sleep(std::time::Duration::from_millis(20)); | ||||||
| post_state = worktree | ||||||
| .as_deref() | ||||||
| .and_then(crate::git::repo_state::read_head_state_for_worktree); | ||||||
| if post_state.as_ref().is_some_and(|s| s.head.is_some()) { | ||||||
| break; | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
| // Last resort: use git rev-parse HEAD subprocess. | ||||||
| if post_state.as_ref().is_none_or(|s| s.head.is_none()) { | ||||||
| if let Some(wt) = worktree.as_deref() { | ||||||
| if let Ok(output) = std::process::Command::new("git") | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Fallback The new fallback subprocess at Every other git invocation in this file uses
Suggested change
Was this helpful? React with 👍 or 👎 to provide feedback. |
||||||
| .args(["rev-parse", "HEAD"]) | ||||||
| .current_dir(wt) | ||||||
| .stdout(std::process::Stdio::piped()) | ||||||
| .stderr(std::process::Stdio::null()) | ||||||
| .output() | ||||||
|
Comment on lines
+197
to
+202
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 In the async-mode branch of Was this helpful? React with 👍 or 👎 to provide feedback. |
||||||
| { | ||||||
| let oid = String::from_utf8_lossy(&output.stdout).trim().to_string(); | ||||||
| if output.status.success() | ||||||
| && crate::git::repo_state::is_valid_git_oid(&oid) | ||||||
| { | ||||||
| let (branch, detached) = post_state | ||||||
| .as_ref() | ||||||
| .map(|s| (s.branch.clone(), s.detached)) | ||||||
| .unwrap_or((None, false)); | ||||||
| post_state = Some(crate::git::repo_state::HeadState { | ||||||
| head: Some(oid), | ||||||
| branch, | ||||||
| detached, | ||||||
| }); | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| send_wrapper_post_state_to_daemon(&invocation_id, worktree.as_deref(), &post_state); | ||||||
|
|
||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔴 Amend retry loop adds 500ms latency for commits without existing authorship notes
The retry loop at
src/authorship/rebase_authorship.rs:2812-2824always runs all 21 iterations (20 × 25ms = 500ms of sleep) whenget_reference_as_authorship_log_v3returnsErr— it cannot distinguish "note does not exist" (permanent) from "note is transiently unreadable" (temporary I/O race). For the common case of amending a commit that was never AI-attributed (norefs/notes/aientry), this adds 500ms to everygit commit --amendin a git-ai tracked repository. The old code checked once and moved on.Was this helpful? React with 👍 or 👎 to provide feedback.