Skip to content

add branch name w/ sync function for git info #2142

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

pap-openai
Copy link
Contributor

image

@@ -212,14 +212,27 @@ impl HistoryCell {
None => config.cwd.display().to_string(),
};

// Determine the current Git branch (if any) for display using
// the shared Git info collector in a way that is safe in sync contexts.
let branch_suffix = codex_core::git_info::collect_git_info_blocking(&config.cwd)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make this part of the SessionConfiguredEvent so we can do all this work async?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! should be better now

Copy link
Collaborator

@bolinfest bolinfest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realize what I'm asking is a bit complicated, but curious to get your thoughts.

// Gather history metadata for SessionConfiguredEvent.
let (history_log_id, history_entry_count) =
crate::message_history::history_metadata(&config).await;
// Gather history metadata for SessionConfiguredEvent and await git info.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like we should be specifying the timeout somehow at this callsite (either updating collect_git_info() to take a timeout, or wrapping these calls with tokio::time::timeout) to ensure that this runs in a bounded amount of time.

One challenge is that here, we are latency-sensitive and I agre with the short timeout.

Though the other callsite in rollout.rs is less latency-sensitive, and arguably should be able to specify a more generous timeout.

That said, from the callsite, one would expect to specify the timeout of the overall operation, whereas internally inside collect_git_info(), run_git_command_with_timeout() is run twice in series, so if collect_git_info() took its own timeout argument, arguably we should divide it by two and use the halved version for each internal call to run_git_command_with_timeout()?

I admit there's already the existing issue here that crate::message_history::history_metadata() should also be bound by a timeout, though I don't know what value to use (0?) if the timeout expires before it completes.

@@ -883,6 +896,8 @@ impl HistoryCell {
}
}

//
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants