{"record":{"id":"4294d7bfbabf2583","repo":"Hmbown/CodeWhale","slug":"initial-prompt-ready-complete-setup-to-send-it","errorCode":null,"errorMessage":"Initial prompt ready; complete setup to send it","messagePattern":"Initial prompt ready; complete setup to send it","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"info","filePath":"crates/tui/src/tui/ui/dispatch.rs","lineNumber":578,"sourceCode":"            warning: Some(\n                \"message_submit hook executor did not run; submission continued because no strict gate matched\"\n                    .to_string(),\n            ),\n        }\n    } else {\n        crate::hooks::MessageSubmitOutcome::Blocked {\n            reason: \"message_submit hook executor did not run; a strict gate blocked submission\"\n                .to_string(),\n        }\n    }\n}\n\npub(crate) fn prepare_user_dispatch(\n    app: &mut App,\n    config: &Config,\n    message: QueuedMessage,\n) -> Result<UserDispatchPrepare> {\n    anyhow::ensure!(!app.redaction_gate, \"{INITIAL_PROMPT_DEFERRED_STATUS}\");\n    let _ = app.maybe_nudge_plugin_for_prompt(&message.display);\n\n    // Plan paused-command changes without touching App or the engine pause\n    // gate. Route selection can await and client preflight can fail; neither\n    // may resume or discard a paused command unless a turn is ready to send.\n    let paused_dispatch = plan_paused_command_message(app, &message.display);\n\n    let cwd = std::env::current_dir().ok();\n    // One cache for this submit: the references pass and the payload pass\n    // otherwise each shell out for `@git`/`@diff`, making git compute a large\n    // working-tree diff twice to attach it once (#4067 review follow-up).\n    let mut git_cache = crate::tui::git_mention::GitMentionCache::default();\n    let completion_index = app.composer.mention_discovery.fuzzy_candidates(\n        &app.workspace,\n        &app.composer.mention_cwd,\n        app.mention_walk_depth,\n        app.workspace_follow_symlinks,\n    );","sourceCodeStart":560,"sourceCodeEnd":596,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/tui/ui/dispatch.rs#L560-L596","documentation":"This is the human-readable status string stored in INITIAL_PROMPT_DEFERRED_STATUS, raised via anyhow::ensure! when a user submits a prompt while the redaction gate is active. The redaction gate means the TUI is still in initial setup (e.g. secrets/redaction consent not yet completed), so user input is accepted but deliberately not dispatched to the engine. The message tells the user their prompt is queued and will be sent once setup completes.","triggerScenarios":"Calling prepare_user_dispatch (via dispatch_user_message_with_recovery or start_user_dispatch) while `app.redaction_gate == true` — i.e. submitting composer input or an initial prompt before completing the setup/redaction-consent flow.","commonSituations":"Launching the TUI with a CLI-supplied initial prompt (`codew \"...\"`) and typing before finishing first-run setup; automation or scripted keystrokes that send input immediately on launch; resuming a session that requires re-consent to redaction rules.","solutions":["Complete the in-TUI setup/redaction consent flow; the queued prompt is then dispatched automatically.","Check app.redaction_gate before submitting and wait for setup to finish before sending input.","If the gate is stuck, restart the TUI and finish setup in a fresh interactive session.","For unattended runs, use `codewhale exec \"…\"` which does not route through the gated TUI dispatch path."],"exampleFix":"// before\nlet dispatch = prepare_user_dispatch(app, config, message)?;\n// after\nif app.redaction_gate {\n    // prompt stays queued; surface status instead of erroring\n    app.status_message = Some(\"Initial prompt ready; complete setup to send it\".into());\n    return Ok(UserDispatchPrepare::deferred());\n}\nlet dispatch = prepare_user_dispatch(app, config, message)?;","handlingStrategy":"validation","validationCode":"// call before dispatching a user message\nfn can_dispatch(app: &App) -> bool {\n    !app.redaction_gate\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check app.redaction_gate before submitting composer input in scripts or macros.","Complete the setup/redaction flow immediately on first launch before typing.","For unattended runs use `codewhale exec`, which bypasses the gated TUI dispatch.","Treat the message as a deferral, not a failure: the prompt stays queued."],"tags":["tui","setup","redaction","deferred-input"],"backgroundTag":"feature-not-enabled","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}