Warn when trusting Git subdirectories (#18602)

Addresses #18505

## Summary

When Codex is launched from a subdirectory of a Git repository, the
onboarding trust prompt says it is trusting the current directory even
though the persisted trust target is the repository root. That can make
the scope of the trust decision unclear.

This updates the TUI trust prompt to show a yellow note only when the
current directory differs from the resolved trust target, explaining
that trust applies to the repository root and displaying that root. It
also removes the stale onboarding TODO now that the warning is
implemented.
This commit is contained in:
Eric Traut
2026-04-20 16:43:21 -07:00
committed by GitHub
Unverified
parent 33fa952426
commit 216e7a0a56
2 changed files with 17 additions and 1 deletions
@@ -139,7 +139,6 @@ impl OnboardingScreen {
error: None,
}))
}
// TODO: add git warning.
Self {
request_frame: tui.frame_requester(),
steps,
@@ -51,6 +51,23 @@ impl WidgetRef for &TrustDirectoryWidget {
]));
column.push("");
if self.cwd != self.trust_target {
#[allow(clippy::disallowed_methods)]
let git_root_warning = Paragraph::new(format!(
"Note: Youre in a subdirectory of a Git project. Trusting will apply to the repository root: {}",
self.trust_target.display()
))
.yellow();
column.push(
git_root_warning
.wrap(Wrap { trim: true })
.inset(Insets::tlbr(
/*top*/ 0, /*left*/ 2, /*bottom*/ 0, /*right*/ 0,
)),
);
column.push("");
}
column.push(
Paragraph::new(
"Do you trust the contents of this directory? Working with untrusted \