fix(tui): preserve standing YOLO authority for runtime continuations#3817
Conversation
Runtime continuations and sub-agent handoffs are not fresh user authorization, but they should not lose YOLO/auto-approval that was already in force on the session. Scope the relaxed inheritance to effective_input_policy and leave UserInputProvenance::can_authorize_work() strict for other authorization gates. Imported transcripts, memory recall, and assistant-generated pseudo-user text still downgrade to approval-required mode when they would otherwise inherit automatic authority. Add a six-provenance matrix for both YOLO and non-YOLO sessions so the gate preserves existing authority without inventing it. Verification: cargo fmt; cargo test -p codewhale-tui --bin codewhale-tui --locked provenance_gate; git diff --check
|
Claude finished @Hmbown's task in 2m 20s —— View job PR Review: fix(tui): preserve standing YOLO authority for runtime continuations
SummaryThe logic is sound: introducing Findings1.
// engine.rs:1986 — still uses can_authorize_work(), not provenance_can_inherit_standing_auto_authority
format!(
"Input authority: {}",
if provenance.can_authorize_work() {
"external_current_turn"
} else {
"non_authoritative" // ← Runtime/SubAgentHandoff in YOLO land here
}
),Either update this block to expose three tiers ( 2. Test gap: Agent-mode
Suggested case to add: // Runtime in Agent mode keeps standing trust_mode
let policy = effective_input_policy(
UserInputProvenance::Runtime,
AppMode::Agent,
"continue",
true, // allow_shell
true, // trust_mode — standing flag
false, // auto_approve
crate::tui::approval::ApprovalMode::Suggest,
);
assert_eq!(policy.mode, AppMode::Agent);
assert!(policy.trust_mode); // inherited, not invented
assert!(policy.status.is_none());3. Minor: The downgrade path explicitly checks What's good
|
Refs #3800.
Problem
A YOLO session can still prompt for force-push / PR-create approval when the action comes from a runtime continuation or sub-agent handoff. The session already had standing YOLO authority, but
effective_input_policystrippedmode = Yolo,trust_mode,auto_approve, and auto/bypass approval for every provenance exceptExternalUser.Change
RuntimeandSubAgentHandoffinherit standing auto-approval authority insideeffective_input_policy.UserInputProvenance::can_authorize_work()strict for other authorization callers.ImportedTranscript,MemoryRecall, andAssistantGeneratedstill continue with approvals required if they would otherwise inherit automatic authority.Verification
cargo fmtcargo test -p codewhale-tui --bin codewhale-tui --locked provenance_gategit diff --checkThe new tests cover all six
UserInputProvenancevariants under both a YOLO session and a non-YOLO session.