Skip to content

Commit 0e71894

Browse files
committed
refactor(tui): remove the cfg(local-workspace) code and its Cargo features (A.4-4)
The `local-workspace` feature was never enabled by any consumer build, so everything behind `#[cfg(feature = "local-workspace")]` was code rustc never compiled and no lint could flag. It is gone together with the feature: - `rsrm cfgfeat` deleted the 197 nodes whose cfg is false with the feature off (3.1k lines across 23 pi-pager files) and stripped the redundant `#[cfg(not(feature = "local-workspace"))]` attributes; - `views/welcome/workspace_mode.rs`, the `--local-workspace*` CLI flags, the per-session "on your machine" permission-title qualifier and the `session_flags` parameter of `finalize_chat_session_meta` / `session_flags_for_effects` went with it; - the feature lines and `default-bazel` entries are removed from the pi-shell-base, pi-shell, pi-pager and pi-pager-bin manifests. `cargo check --all-targets` on the consumer set is clean (0 warnings) and the touched test filters pass (358 passed).
1 parent 886d5af commit 0e71894

27 files changed

Lines changed: 17 additions & 3684 deletions

File tree

‎tui/crates/codegen/pi-pager-bin/Cargo.toml‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,9 @@ default = [
8383
default-bazel = [
8484
"jemalloc",
8585
"sandbox-enforce",
86-
"local-workspace",
8786
]
8887
jemalloc = ["dep:tikv-jemallocator", "dep:tikv-jemalloc-sys", "dep:tikv-jemalloc-ctl"]
8988
sandbox-enforce = ["pi-pager/sandbox-enforce"]
90-
local-workspace = ["pi-pager/local-workspace"]
9189
release-dist = [
9290
"pi-pager/release-dist",
9391
]

‎tui/crates/codegen/pi-pager/Cargo.toml‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,7 @@ default-bazel = [
230230
"jemalloc",
231231
"sandbox-enforce",
232232
"test-support",
233-
"local-workspace",
234233
]
235-
local-workspace = ["pi-shell/local-workspace"]
236234
# No-op on this crate: the actual `#[global_allocator]` (and the
237235
# `tikv-jemallocator` dep) live on the composition-root binary
238236
# `pi-pager-bin`, which owns `main.rs`. Kept as an empty feature so the

‎tui/crates/codegen/pi-pager/src/app/acp_handler/permissions.rs‎

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -150,17 +150,8 @@ fn enqueue_permission(
150150
});
151151

152152
// 3. Build title and description from the tool call.
153-
let (title, description, bash_command_raw) = build_permission_display(
154-
&perm.request,
155-
bash_highlights.as_ref(),
156-
#[cfg(feature = "local-workspace")]
157-
matches!(
158-
agent.workspace_mode,
159-
crate::views::welcome::WelcomeWorkspaceMode::LocalWorkspace
160-
),
161-
#[cfg(not(feature = "local-workspace"))]
162-
false,
163-
);
153+
let (title, description, bash_command_raw) =
154+
build_permission_display(&perm.request, bash_highlights.as_ref());
164155

165156
// 4. Assign a monotonic ID.
166157
let perm_id = agent.next_perm_req_id;
@@ -230,7 +221,6 @@ fn enqueue_permission(
230221
fn build_permission_display(
231222
req: &acp::RequestPermissionRequest,
232223
bash_highlights: Option<&BashCommandHighlights>,
233-
session_local_workspace: bool,
234224
) -> (String, Vec<String>, Option<String>) {
235225
let is_bash = bash_highlights.is_some();
236226

@@ -298,29 +288,11 @@ fn build_permission_display(
298288
}
299289
};
300290

301-
let title = qualify_permission_title_for_local_workspace(title, session_local_workspace);
302291
let description = permission_description_lines(req);
303292
let bash_cmd = if is_execute { raw_command } else { None };
304293
(title, description, bash_cmd)
305294
}
306295

307-
/// Per-session HITL copy — not process-global CLI stamp.
308-
fn qualify_permission_title_for_local_workspace(
309-
title: String,
310-
session_local_workspace: bool,
311-
) -> String {
312-
if !session_local_workspace {
313-
return title;
314-
}
315-
if title.contains("on your machine") {
316-
return title;
317-
}
318-
if let Some(stripped) = title.strip_suffix('?') {
319-
return format!("{stripped} (on your machine)?");
320-
}
321-
format!("{title} (on your machine)")
322-
}
323-
324296
/// Lines shown under the permission title: protected-edit note (if any), then
325297
/// MCP planned-argument lines (empty for bash/edit).
326298
fn permission_description_lines(req: &acp::RequestPermissionRequest) -> Vec<String> {
@@ -555,19 +527,3 @@ pub(super) fn apply_recap_block(agent: &mut AgentView, auto: bool, recap_block:
555527
}
556528
}
557529

558-
#[cfg(all(test, feature = "local-workspace"))]
559-
mod tests {
560-
use super::*;
561-
562-
#[test]
563-
fn permission_title_qualifies_for_local_workspace() {
564-
assert_eq!(
565-
qualify_permission_title_for_local_workspace("Allow Edit?".into(), false),
566-
"Allow Edit?"
567-
);
568-
assert_eq!(
569-
qualify_permission_title_for_local_workspace("Allow Edit?".into(), true),
570-
"Allow Edit (on your machine)?"
571-
);
572-
}
573-
}

‎tui/crates/codegen/pi-pager/src/app/actions.rs‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,6 @@ pub enum Action {
101101
/// load effect; under `--chat`, local Build disk rows are refused in
102102
/// dispatch (never coerced).
103103
LoadSession(String, Option<std::path::PathBuf>, bool),
104-
/// Welcome Local workspace ACK confirmed (y); write ack + start session.
105-
#[cfg(feature = "local-workspace")]
106-
ConfirmWelcomeLocalWorkspaceAck,
107104
/// Create a new session with a client-chosen session ID (`--session-id`).
108105
NewSessionWithId(String),
109106
/// Send the current prompt text to the agent.

‎tui/crates/codegen/pi-pager/src/app/agent_view/mod.rs‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -739,12 +739,6 @@ pub struct AgentView {
739739
/// Unlike `chat_kind`, stays `false` for a `/chat` one-shot session in
740740
/// a Build process, whose picker still lists local sessions.
741741
pub app_chat_mode: bool,
742-
/// Durable workspace mode for the in-session status indicator (`--chat`).
743-
#[cfg(feature = "local-workspace")]
744-
pub workspace_mode: crate::views::welcome::WelcomeWorkspaceMode,
745-
/// True when CLI/env locked local workspace at startup for this session.
746-
#[cfg(feature = "local-workspace")]
747-
pub workspace_mode_cli_locked: bool,
748742
/// Mocked credit balance for the status bar indicator.
749743
pub credit_balance: Option<crate::views::credit_bar::CreditBalance>,
750744
/// Auto top-up rule paired with `credit_balance` for the prompt warning.

‎tui/crates/codegen/pi-pager/src/app/agent_view/render.rs‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -890,20 +890,6 @@ impl AgentView {
890890
}
891891
status.push("plan", Line::from(Span::styled("plan", plan_style)));
892892
}
893-
#[cfg(feature = "local-workspace")]
894-
if self.chat_kind || self.app_chat_mode {
895-
let label = self
896-
.workspace_mode
897-
.status_label(self.workspace_mode_cli_locked);
898-
let mut mode_style = Style::default().fg(theme.accent_user).bg(theme.bg_base);
899-
if self.workspace_mode_cli_locked {
900-
mode_style = mode_style.add_modifier(ratatui::style::Modifier::DIM);
901-
}
902-
status.push(
903-
"workspace_mode",
904-
Line::from(Span::styled(label, mode_style)),
905-
);
906-
}
907893
let ctx_used = self.context_state.as_ref().map(|c| c.used);
908894
let model_window = self.session.models.get_context_window();
909895
let ctx_total = self

‎tui/crates/codegen/pi-pager/src/app/agent_view/session.rs‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,6 @@ impl AgentView {
156156
chat_kind: false,
157157
conversation_entry: false,
158158
app_chat_mode: false,
159-
#[cfg(feature = "local-workspace")]
160-
workspace_mode: crate::views::welcome::WelcomeWorkspaceMode::Sandbox,
161-
#[cfg(feature = "local-workspace")]
162-
workspace_mode_cli_locked: false,
163159
credit_balance: None,
164160
auto_topup: None,
165161
turn_start_ms: None,

0 commit comments

Comments
 (0)