{"record":{"id":"4da2a792bb962d22","repo":"Hmbown/CodeWhale","slug":"queued-plugin-skill-belongs-to-a-different-workspa","errorCode":null,"errorMessage":"Queued plugin skill belongs to a different workspace and was denied","messagePattern":"Queued plugin skill belongs to a different workspace and was denied","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/tui/src/tui/ui/dispatch.rs","lineNumber":365,"sourceCode":"    } else if let Err(_err) =\n        dispatch_user_message_with_recovery(app, config, engine_handle, message, recovery).await\n    {\n        // The completion closure re-queued the message and set the status.\n    } else {\n        app.status_message = Some(app.tr(MessageId::ToastSentIntoTurn).into_owned());\n    }\n    Ok(())\n}\n\npub(crate) fn queued_message_content_for_app(\n    app: &App,\n    message: &QueuedMessage,\n    cwd: Option<PathBuf>,\n    git_cache: &mut crate::tui::git_mention::GitMentionCache,\n) -> Result<String> {\n    if let Some(authority) = message.skill_provenance.as_ref() {\n        if authority.workspace != app.workspace {\n            anyhow::bail!(\"Queued plugin skill belongs to a different workspace and was denied\");\n        }\n        crate::plugins::registry::verify_plugin_component_authority(\n            authority,\n            crate::plugins::activation::PluginActivationCapability::Skills,\n        )\n        .map_err(anyhow::Error::msg)?;\n    }\n    // Pass the process CWD explicitly so the resolver's two-pass logic can\n    // honor the user's launch directory when it differs from `--workspace`\n    // (issue #101 — file mentions silently routing to the wrong root).\n    // The completion index is the composer's already-built fuzzy scan: a\n    // bounded fallback for exact misses, with no submit-time tree walk (#4365).\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":347,"sourceCodeEnd":383,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/tui/ui/dispatch.rs#L347-L383","documentation":"Before rendering/serializing a queued message, the dispatcher checks the message's plugin-skill provenance. If the skill was recorded under a different workspace than the current one, executing it would cross a trust boundary, so the queued message is rejected outright rather than silently retargeted.","triggerScenarios":"Calling `queued_message_content_for_app` (directly or via prepare_user_dispatch / steer_user_message / preview builders) on a `QueuedMessage` whose `skill_provenance.workspace` differs from `app.workspace` — e.g. a queue persisted in a shared or restored session and then opened from another workspace.","commonSituations":"Restoring a session queue saved in project A while the TUI runs in project B; copying session state between machines/worktrees; switching workspaces with queued plugin-skill messages pending.","solutions":["Re-queue the plugin skill from within the current workspace so its provenance matches","Discard the queued message (it is intentionally denied); type the request again in the current workspace","If you genuinely moved workspaces, reopen the session from the original workspace to run the queued skill"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"if let Some(auth) = message.skill_provenance.as_ref() {\n    if auth.workspace != app.workspace {\n        eprintln!(\"queued skill is from another workspace; dropping\");\n        return Ok(String::new());\n    }\n}","typeGuard":"fn skill_in_current_workspace(m: &QueuedMessage, app: &App) -> bool {\n    m.skill_provenance\n        .as_ref()\n        .map_or(true, |a| a.workspace == app.workspace)\n}","tryCatchPattern":"let content = match queued_message_content_for_app(app, msg, cwd, git_cache) {\n    Err(e) if e.to_string().contains(\"different workspace\") => {\n        drop_or_requeue(msg); String::new()\n    }\n    r => r?,\n};","preventionTips":["Re-queue plugin skills after switching workspaces instead of carrying the old queue","Don't share or copy session state containing queued plugin messages across workspaces","Verify `skill_provenance.workspace` matches before restoring persisted queues"],"tags":["rust","plugins","workspace","trust-boundary"],"backgroundTag":"cross-workspace-permission-denied","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"}