mirror of
https://github.com/openai/codex.git
synced 2026-11-15 21:50:46 +00:00
Scope TUI skill refreshes and workspace commands to explicit directories (#54050)
## Why A queued skill refresh can outlive the workspace it was requested for when the working directory changes. ## What changed - Refresh skills for the current working directory when the skills management popup closes. - Ignore queued `ListSkills` commands whose directories do not include the current working directory. - Require an explicit working directory when constructing `WorkspaceCommand` and always pass it to app-server command execution. Update Git and GitHub metadata probes to use the constructor. ## Testing Extend regression tests to verify that closing skill management refreshes the configured working directory and that stale skill refreshes after a directory change do not issue a `skills/list` request. GitOrigin-RevId: 47ad1d95930840b3f6f0e20d7d8fe8d025e789e6
This commit is contained in:
@@ -37,8 +37,8 @@ pub(crate) type WorkspaceCommandRunner = Arc<dyn WorkspaceCommandExecutor>;
|
||||
pub(crate) struct WorkspaceCommand {
|
||||
/// Program and arguments to execute without shell interpolation.
|
||||
pub(crate) argv: Vec<String>,
|
||||
/// Working directory for the command, if different from app-server's session cwd.
|
||||
pub(crate) cwd: Option<PathBuf>,
|
||||
/// Explicit working directory on the host that executes the command.
|
||||
pub(crate) cwd: PathBuf,
|
||||
/// Environment overrides where `None` removes a variable.
|
||||
pub(crate) env: HashMap<String, Option<String>>,
|
||||
/// Maximum wall-clock duration before app-server cancels the command.
|
||||
@@ -49,22 +49,19 @@ pub(crate) struct WorkspaceCommand {
|
||||
|
||||
impl WorkspaceCommand {
|
||||
/// Creates a workspace command with conservative defaults for metadata probes.
|
||||
pub(crate) fn new(argv: impl IntoIterator<Item = impl Into<String>>) -> Self {
|
||||
pub(crate) fn new(
|
||||
argv: impl IntoIterator<Item = impl Into<String>>,
|
||||
cwd: impl Into<PathBuf>,
|
||||
) -> Self {
|
||||
Self {
|
||||
argv: argv.into_iter().map(Into::into).collect(),
|
||||
cwd: None,
|
||||
cwd: cwd.into(),
|
||||
env: HashMap::new(),
|
||||
timeout: Duration::from_secs(/*secs*/ 5),
|
||||
disable_output_cap: false,
|
||||
}
|
||||
}
|
||||
|
||||
/// Sets the command working directory.
|
||||
pub(crate) fn cwd(mut self, cwd: impl Into<PathBuf>) -> Self {
|
||||
self.cwd = Some(cwd.into());
|
||||
self
|
||||
}
|
||||
|
||||
/// Adds or replaces one environment variable override.
|
||||
pub(crate) fn env(mut self, key: impl Into<String>, value: impl Into<String>) -> Self {
|
||||
self.env.insert(key.into(), Some(value.into()));
|
||||
@@ -192,7 +189,7 @@ impl WorkspaceCommandExecutor for AppServerWorkspaceCommandRunner {
|
||||
disable_output_cap: command.disable_output_cap,
|
||||
disable_timeout: false,
|
||||
timeout_ms: Some(timeout_ms),
|
||||
cwd: command.cwd,
|
||||
cwd: Some(command.cwd),
|
||||
env,
|
||||
size: None,
|
||||
sandbox_policy: None,
|
||||
|
||||
Reference in New Issue
Block a user