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:
Eric Traut
2026-10-14 17:36:18 +00:00
committed by copyberry
parent 534c70863c
commit 9671d20fc8
9 changed files with 40 additions and 36 deletions
+4 -7
View File
@@ -36,7 +36,7 @@ impl FsmonitorProbeRunner for WorkspaceFsmonitorProbeRunner<'_> {
let argv = ["git", "-c", codex_git_utils::SAFE_BARE_REPOSITORY_CONFIG]
.into_iter()
.chain(args.iter().copied());
let command = WorkspaceCommand::new(argv).cwd(self.cwd.to_path_buf());
let command = WorkspaceCommand::new(argv, self.cwd.to_path_buf());
match self.runner.run(command).await {
Ok(output) if output.success() => Some(output.stdout.into_bytes()),
_ => None,
@@ -242,8 +242,7 @@ async fn run_git_command(
]
.into_iter()
.chain(args.iter().copied());
let mut command = WorkspaceCommand::new(argv)
.cwd(cwd.to_path_buf())
let mut command = WorkspaceCommand::new(argv, cwd.to_path_buf())
.timeout(DIFF_COMMAND_TIMEOUT)
.disable_output_cap();
if !config_overrides.is_empty() {
@@ -830,7 +829,7 @@ mod tests {
fn assert_command_metadata(commands: &[WorkspaceCommand], cwd: &Path) {
for command in commands {
assert_eq!(command.cwd.as_deref(), Some(cwd));
assert_eq!(command.cwd.as_path(), cwd);
if matches!(
command.argv.get(3).map(String::as_str),
Some("config" | "version")
@@ -911,9 +910,7 @@ mod tests {
> {
Box::pin(async move {
let mut process = ProcessCommand::new(&command.argv[0]);
process
.args(&command.argv[1..])
.current_dir(command.cwd.expect("test command cwd"));
process.args(&command.argv[1..]).current_dir(command.cwd);
for (key, value) in command.env {
match value {
Some(value) => {