Skip to content

Commit 95e0f68

Browse files
committed
fix(cli): enable HITL confirmation so file edits actually work
File-modifying tools (write/edit/patch) require a confirmation manager; without one they fail with "requires confirmation but no HITL confirmation manager is configured" — so the agent could never edit files in the TUI. Enable ConfirmationPolicy on the session (long timeout so the approve/deny modal never expires). Now write/edit emit ConfirmationRequired → the TUI modal (or /auto) approves → the tool runs → the diff renders. Verified end-to-end against gpt-4o: "create note.txt with hello" → approved → file written, exit 0.
1 parent 2c88188 commit 95e0f68

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

cli/src/main.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use std::sync::Arc;
1313
use std::time::Duration;
1414

15+
use a3s_code_core::hitl::TimeoutAction;
1516
use a3s_code_core::{Agent, AgentEvent, AgentSession, SessionOptions};
1617
use a3s_tui::cmd::{self, Cmd};
1718
use a3s_tui::components::modal::{Modal, ModalMsg};
@@ -815,10 +816,18 @@ async fn main() -> anyhow::Result<()> {
815816
.map_err(|e| anyhow::anyhow!("failed to open session store {store_dir:?}: {e}"))?,
816817
);
817818
const SESSION_ID: &str = "tui-default";
819+
// Enable HITL confirmation so file-modifying tools (write/edit/patch) can
820+
// run — they require a confirmation manager, otherwise they fail with
821+
// "requires confirmation but no HITL confirmation manager is configured".
822+
// The TUI is that manager (approve/deny modal, or /auto). Long timeout so
823+
// the modal never expires while the user reads it.
824+
let confirmation = a3s_code_core::hitl::ConfirmationPolicy::enabled()
825+
.with_timeout(3_600_000, TimeoutAction::Reject);
818826
let session = match agent.resume_session(
819827
SESSION_ID,
820828
SessionOptions::new()
821829
.with_session_store(store.clone())
830+
.with_confirmation_policy(confirmation.clone())
822831
.with_auto_save(true),
823832
) {
824833
Ok(s) => s,
@@ -828,6 +837,7 @@ async fn main() -> anyhow::Result<()> {
828837
SessionOptions::new()
829838
.with_session_store(store.clone())
830839
.with_session_id(SESSION_ID)
840+
.with_confirmation_policy(confirmation)
831841
.with_auto_save(true),
832842
),
833843
)?,

0 commit comments

Comments
 (0)