Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

fix(permissions): remove local approval deadline

vastsad7aaaf58fe5b
diff --git a/apps/desktop/src/components/PermissionCard.tsx b/apps/desktop/src/components/PermissionCard.tsx
index 87596bd06..2b805993b 100644
--- a/apps/desktop/src/components/PermissionCard.tsx
+++ b/apps/desktop/src/components/PermissionCard.tsx
@@ -1,9 +1,6 @@
-import { useEffect, useMemo, useRef, useState } from "react";
+import { useMemo, useState } from "react";
import { Trans, useTranslation } from "react-i18next";
-import {
- permissionSecondsLeft,
- type PendingPermission,
-} from "../lib/pending-permissions";
+import type { PendingPermission } from "../lib/pending-permissions";
import { useAppStore } from "../stores/app-store";
import { buildToolPresentation } from "../lib/tool-presentation";
import { ToolDetailBlocks } from "./ToolDetails";
@@ -23,11 +20,7 @@ export function PermissionCard({
const workspace = useAppStore((state) =>
state.sessions.find((session) => session.id === permission.sessionId)?.projectPath,
);
- const [secondsLeft, setSecondsLeft] = useState(() =>
- permissionSecondsLeft(permission.receivedAt),
- );
const [resolving, setResolving] = useState(false);
- const timeoutHandled = useRef(false);
const restoreComposerFocus = () => {
window.requestAnimationFrame(() => {
@@ -52,20 +45,6 @@ export function PermissionCard({
}
};
- useEffect(() => {
- timeoutHandled.current = false;
- const update = () => setSecondsLeft(permissionSecondsLeft(permission.receivedAt));
- update();
- const timer = window.setInterval(update, 1000);
- return () => window.clearInterval(timer);
- }, [permission.receivedAt, permission.requestId]);
-
- useEffect(() => {
- if (secondsLeft > 0 || timeoutHandled.current || resolving) return;
- timeoutHandled.current = true;
- void resolve("deny");
- }, [resolving, secondsLeft]);
-
// Same structured presentation as the transcript tool rows: a command reads
// as shell, file content as code, everything else as labeled fields.
const argBlocks = useMemo(
@@ -123,9 +102,6 @@ export function PermissionCard({
workspace: workspace || t("permission.temporarySession"),
})}
</span>
- <span role="timer">
- {t("permission.countdown", { seconds: secondsLeft })}
- </span>
</div>
<div className="permission-card-actions">
<Button
diff --git a/apps/desktop/src/lib/pending-permissions.ts b/apps/desktop/src/lib/pending-permissions.ts
index 6a43a343c..1d0658188 100644
--- a/apps/desktop/src/lib/pending-permissions.ts
+++ b/apps/desktop/src/lib/pending-permissions.ts
@@ -1,10 +1,6 @@
import type { ToolPermissionRequest } from "@pi-desktop/shared";
-export const PERMISSION_TIMEOUT_MS = 120_000;
-
-export type PendingPermission = ToolPermissionRequest & {
- receivedAt: number;
-};
+export type PendingPermission = ToolPermissionRequest;
/**
* Per-session queue of permission requests, oldest first.
@@ -107,7 +103,3 @@ export function clearSessionPermissions(
delete next[sessionId];
return next;
}
-
-export function permissionSecondsLeft(receivedAt: number, now = Date.now()): number {
- return Math.max(0, Math.ceil((receivedAt + PERMISSION_TIMEOUT_MS - now) / 1000));
-}
diff --git a/apps/desktop/src/stores/slices/events-slice.ts b/apps/desktop/src/stores/slices/events-slice.ts
index 45de6fd00..a5f4f24f4 100644
--- a/apps/desktop/src/stores/slices/events-slice.ts
+++ b/apps/desktop/src/stores/slices/events-slice.ts
@@ -401,7 +401,6 @@ export function createEventsSlice({
set((state) => ({
pendingPermissions: enqueuePermission(state.pendingPermissions, {
...event.request,
- receivedAt: envelope.ts,
}),
}));
notifyInteractivePrompt(envelope.sessionId, "permission", {
@@ -587,7 +586,6 @@ export function createEventsSlice({
set((state) => ({
pendingPermissions: enqueuePermission(state.pendingPermissions, {
...event.request,
- receivedAt: envelope.ts,
}),
}));
notifyInteractivePrompt(envelope.sessionId, "permission", {
diff --git a/apps/desktop/test/permission-inline.test.mjs b/apps/desktop/test/permission-inline.test.mjs
index 04ecd9e4c..e57206cf0 100644
--- a/apps/desktop/test/permission-inline.test.mjs
+++ b/apps/desktop/test/permission-inline.test.mjs
@@ -13,7 +13,6 @@ import {
clearSessionPermissions,
enqueuePermission,
headPermission,
- permissionSecondsLeft,
queuedPermissionCount,
removePermission,
removePermissionForToolCall,
@@ -58,7 +57,6 @@ function permission(sessionId, requestId, extra = {}) {
argsPreview: { path: `${sessionId}.txt` },
risk: "high",
reason: "Modify a workspace file",
- receivedAt: 1_000,
...extra,
};
}
@@ -106,15 +104,15 @@ test("a finished tool call clears its request from anywhere in the queue", () =>
const second = permission("session-a", "request-second");
const queues = enqueuePermission(enqueuePermission({}, first), second);
- // The host answers an expired request itself, so a queued card that was
- // never shown still has to leave the queue on `tool_end`.
- const afterExpiry = removePermissionForToolCall(
+ // A cancelled request that was never shown still has to leave the queue on
+ // `tool_end`.
+ const afterCancellation = removePermissionForToolCall(
queues,
"session-a",
"tool-request-second",
);
- assert.equal(headPermission(afterExpiry, "session-a"), first);
- assert.equal(queuedPermissionCount(afterExpiry, "session-a"), 0);
+ assert.equal(headPermission(afterCancellation, "session-a"), first);
+ assert.equal(queuedPermissionCount(afterCancellation, "session-a"), 0);
assert.equal(
removePermissionForToolCall(queues, "session-a", "tool-unknown"),
queues,
@@ -193,11 +191,9 @@ test("asktool card is a stepwise, non-expiring composer question surface", () =>
);
});
-test("permission countdown uses its absolute receipt time", () => {
- assert.equal(permissionSecondsLeft(1_000, 1_000), 120);
- assert.equal(permissionSecondsLeft(1_000, 61_001), 60);
- assert.equal(permissionSecondsLeft(1_000, 121_000), 0);
- assert.equal(permissionSecondsLeft(1_000, 180_000), 0);
+test("permission approval stays pending until an explicit decision", () => {
+ assert.doesNotMatch(cardSource, /setInterval|permissionSecondsLeft|role="timer"/);
+ assert.doesNotMatch(eventsSource, /receivedAt/);
});
test("permission approval is an inline transcript card, never a global dialog", () => {
@@ -225,7 +221,7 @@ test("permission approval is an inline transcript card, never a global dialog",
assert.match(cardSource, /requestAnimationFrame/);
assert.match(cardSource, /showToast/);
assert.doesNotMatch(cardSource, /<section[^>]*aria-live=/);
- assert.match(cardSource, /permissionSecondsLeft\(permission\.receivedAt\)/);
+ assert.doesNotMatch(cardSource, /permissionSecondsLeft|permission\.receivedAt/);
assert.match(browserSource, /blocking overlay/);
assert.doesNotMatch(browserSource, /permission dialog/);
});
diff --git a/apps/desktop/test/plugin-timeout-budgets.test.mjs b/apps/desktop/test/plugin-timeout-budgets.test.mjs
index 670a29eda..189f4a2b0 100644
--- a/apps/desktop/test/plugin-timeout-budgets.test.mjs
+++ b/apps/desktop/test/plugin-timeout-budgets.test.mjs
@@ -21,7 +21,6 @@ const pluginRuntime = source("apps/desktop/electron/main/plugin-runtime.ts");
const pluginMcp = source("apps/desktop/electron/main/plugin-mcp.ts");
const sharedTimeouts = source("packages/shared/src/rpc-timeouts.ts");
const hostTools = source("crates/host-core/src/tools/mod.rs");
-const hostPermissions = source("crates/host-core/src/permissions.rs");
const hostToolBudget = source("crates/host-core/src/tool_budget.rs");
const hostRpc = source("crates/host-core/src/rpc/mod.rs");
@@ -79,15 +78,13 @@ test("the manual-compaction deadline outlasts the summary request it wraps", ()
);
});
-test("host-core budgets match their TypeScript mirrors", () => {
+test("host-core execution budgets remain mirrored while approval has no deadline", () => {
const hostDispatch = constMs(hostTools, "DESKTOP_TOOL_DISPATCH_TIMEOUT_MS");
assert.equal(constMs(sharedTimeouts, "DESKTOP_TOOL_DISPATCH_TIMEOUT_MS"), hostDispatch);
- assert.equal(
- constMs(sharedTimeouts, "PERMISSION_TIMEOUT_MS"),
- constMs(hostPermissions, "PERMISSION_TIMEOUT_MS"),
- );
assert.equal(
constMs(sharedTimeouts, "TOOL_QUEUE_WAIT_MS"),
constMs(hostToolBudget, "TOOL_QUEUE_WAIT_MS"),
);
+ assert.doesNotMatch(sharedTimeouts, /PERMISSION_TIMEOUT_MS/);
+ assert.doesNotMatch(hostRpc, /PERMISSION_TIMEOUT_MS/);
});
diff --git a/crates/host-core/src/permissions.rs b/crates/host-core/src/permissions.rs
index 475b9387f..2b983904c 100644
--- a/crates/host-core/src/permissions.rs
+++ b/crates/host-core/src/permissions.rs
@@ -1,12 +1,10 @@
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
-use std::time::{Duration, Instant};
+use std::time::Instant;
use uuid::Uuid;
use crate::db::{ms_to_ts, now_ms};
-pub const PERMISSION_TIMEOUT_MS: u64 = 120_000;
-
/// Longest string leaf kept in a permission request's args preview. Full args
/// (e.g. a Write's whole file content) would otherwise cross every stdio/IPC
/// hop and stall the renderer right as the dialog opens.
@@ -63,7 +61,6 @@ pub struct PermissionRequest {
pub risk: Risk,
pub args_preview: serde_json::Value,
pub reason: String,
- pub timeout_ms: u64,
#[serde(skip_serializing_if = "Option::is_none")]
pub command_shell_id: Option<String>,
}
@@ -113,8 +110,6 @@ pub struct PendingPermission {
#[serde(flatten)]
pub request: PermissionRequest,
pub created_at: String,
- pub expires_at: String,
- pub remaining_ms: u64,
}
#[derive(Default)]
@@ -317,7 +312,6 @@ impl PermissionManager {
risk: Self::tool_risk_with_declared(tool_name, declared_risk),
args_preview: preview_value(&args_preview),
reason: reason.to_string(),
- timeout_ms: PERMISSION_TIMEOUT_MS,
command_shell_id: command_shell_id.map(str::to_string),
};
let (tx, rx) = tokio::sync::oneshot::channel();
@@ -338,26 +332,18 @@ impl PermissionManager {
}
/// Open requests, oldest first, optionally scoped to one session. Requests
- /// past the timeout are omitted even before `expire_stale` sweeps them,
- /// so a reader never sees a request that can no longer be answered.
+ /// remain open until an explicit decision or cancellation settles them.
pub fn pending_requests(&self, session_id: Option<&str>) -> Vec<PendingPermission> {
- let timeout = Duration::from_millis(PERMISSION_TIMEOUT_MS);
let mut open: Vec<&Pending> = self
.pending
.values()
- .filter(|pending| pending.created_at.elapsed() <= timeout)
.filter(|pending| session_id.is_none_or(|id| pending.session_id == id))
.collect();
open.sort_by_key(|pending| (pending.created_at_ms, pending.sequence));
open.into_iter()
- .map(|pending| {
- let elapsed = pending.created_at.elapsed();
- PendingPermission {
- request: pending.request.clone(),
- created_at: ms_to_ts(pending.created_at_ms),
- expires_at: ms_to_ts(pending.created_at_ms + PERMISSION_TIMEOUT_MS as i64),
- remaining_ms: timeout.saturating_sub(elapsed).as_millis() as u64,
- }
+ .map(|pending| PendingPermission {
+ request: pending.request.clone(),
+ created_at: ms_to_ts(pending.created_at_ms),
})
.collect()
}
@@ -370,13 +356,6 @@ impl PermissionManager {
let Some(mut pending) = self.pending.remove(request_id) else {
return Err("NOT_FOUND".into());
};
- if pending.created_at.elapsed() > Duration::from_millis(PERMISSION_TIMEOUT_MS) {
- let _ = pending
- .tx
- .take()
- .map(|tx| tx.send(PermissionDecision::Deny));
- return Err("PERMISSION_TIMEOUT".into());
- }
if let Some(tx) = pending.tx.take() {
let _ = tx.send(decision);
}
@@ -406,23 +385,6 @@ impl PermissionManager {
.map(|(request_id, _)| request_id.clone());
request_id.is_some_and(|request_id| self.cancel(&request_id))
}
-
- pub fn expire_stale(&mut self) {
- let timeout = Duration::from_millis(PERMISSION_TIMEOUT_MS);
- let stale: Vec<String> = self
- .pending
- .iter()
- .filter(|(_, p)| p.created_at.elapsed() > timeout)
- .map(|(k, _)| k.clone())
- .collect();
- for id in stale {
- if let Some(mut p) = self.pending.remove(&id) {
- if let Some(tx) = p.tx.take() {
- let _ = tx.send(PermissionDecision::Deny);
- }
- }
- }
- }
}
#[cfg(test)]
@@ -454,8 +416,6 @@ mod tests {
assert_eq!(all.len(), 2);
assert_eq!(all[0].request.request_id, first.request_id);
assert_eq!(all[0].request.tool_name, "Bash");
- assert!(all[0].remaining_ms <= PERMISSION_TIMEOUT_MS);
- assert!(all[0].expires_at > all[0].created_at);
let scoped = pm.pending_requests(Some("session-b"));
assert_eq!(scoped.len(), 1);
assert_eq!(scoped[0].request.request_id, second.request_id);
@@ -466,6 +426,27 @@ mod tests {
assert!(pm.pending_requests(None).is_empty());
}
+ #[test]
+ fn pending_permissions_remain_resolvable_without_deadline() {
+ let mut pm = PermissionManager::default();
+ let (request, _rx) = pm.create_request(
+ "session-a",
+ "call-1",
+ "Bash",
+ serde_json::json!({ "command": "ls" }),
+ "high risk",
+ );
+ pm.pending
+ .get_mut(&request.request_id)
+ .expect("request is pending")
+ .created_at = Instant::now() - std::time::Duration::from_secs(121);
+
+ assert_eq!(pm.pending_requests(None).len(), 1);
+ assert!(pm
+ .resolve(&request.request_id, PermissionDecision::AllowOnce)
+ .is_ok());
+ }
+
#[test]
fn ask_mode_prompts_for_high_risk() {
let pm = PermissionManager::default();
diff --git a/crates/host-core/src/rpc/mod.rs b/crates/host-core/src/rpc/mod.rs
index 9ca16b89d..fb12345ad 100644
--- a/crates/host-core/src/rpc/mod.rs
+++ b/crates/host-core/src/rpc/mod.rs
@@ -3510,7 +3510,6 @@ async fn handle_request(
if st.shutting_down {
return Err(rpc_err(1001, "host is shutting down", "HOST_SHUTTING_DOWN"));
}
- st.permissions.expire_stale();
// Effective permission mode (D115): per-session override
// unless it is `inherit`, then the global settings default,
// then `ask`. A subagent's tool call carries its own scope
@@ -3658,8 +3657,7 @@ async fn handle_request(
"toolName": req.tool_name,
"risk": req.risk,
"argsPreview": req.args_preview,
- "reason": req.reason,
- "timeoutMs": req.timeout_ms
+ "reason": req.reason
});
if let Some(shell_id) = req.command_shell_id.as_deref() {
permission_params["commandShellId"] = json!(shell_id);
@@ -3685,14 +3683,9 @@ async fn handle_request(
d
}
} else if let Some(rx) = pending_rx {
- let permission_wait = tokio::time::timeout(
- std::time::Duration::from_millis(crate::permissions::PERMISSION_TIMEOUT_MS),
- rx,
- );
- tokio::pin!(permission_wait);
tokio::select! {
- outcome = &mut permission_wait => match outcome {
- Ok(Ok(d)) => d,
+ outcome = rx => match outcome {
+ Ok(d) => d,
_ => PermissionDecision::Deny,
},
_ = wait_for_bash_cancellation(&mut permission_cancellation) => {
@@ -7374,6 +7367,7 @@ mod tests {
.unwrap();
let permission: Value = serde_json::from_str(&permission).unwrap();
assert_eq!(permission["method"], "permissions.request");
+ assert!(permission["params"].get("timeoutMs").is_none());
let request_id = permission["params"]["requestId"]
.as_str()
.unwrap()
@@ -7392,11 +7386,9 @@ mod tests {
assert_eq!(requests[0]["requestId"], request_id);
assert_eq!(requests[0]["sessionId"], session.id);
assert_eq!(requests[0]["toolName"], "Bash");
- assert_eq!(requests[0]["timeoutMs"], 120000);
- assert!(
- requests[0]["expiresAt"].as_str().unwrap() > requests[0]["createdAt"].as_str().unwrap()
- );
- assert!(requests[0]["remainingMs"].as_u64().unwrap() <= 120000);
+ assert!(requests[0].get("timeoutMs").is_none());
+ assert!(requests[0].get("expiresAt").is_none());
+ assert!(requests[0].get("remainingMs").is_none());
let other = handle_request(
state.clone(),
diff --git a/docs/adr/0011-host-rpc-and-storage-defaults.md b/docs/adr/0011-host-rpc-and-storage-defaults.md
index 7892e3e6f..e5d95d784 100644
--- a/docs/adr/0011-host-rpc-and-storage-defaults.md
+++ b/docs/adr/0011-host-rpc-and-storage-defaults.md
@@ -1,6 +1,7 @@
# ADR 0011: Freeze host RPC, storage ownership, and mode defaults
-- Status: Accepted; mode-profile clause superseded in part by ADR 0053
+- Status: Accepted; mode-profile clause superseded in part by ADR 0053;
+ permission-timeout clause amended by ADR 0310
- Date: 2026-07-25
## Context
@@ -11,7 +12,7 @@ After baseline 0.3.0, implementation still depended on several high-impact defau
- SQLite ownership
- default interaction mode
- former restricted-profile tool split (superseded by ADR 0053)
-- permission timeout behavior
+- local permission approval behavior
## Decision
@@ -23,7 +24,8 @@ Freeze the following defaults for implementation:
4. The former restricted profile was read-only; this mode-profile clause is
superseded by ADR 0053, which supersedes the historical operating-state
decision in ADR 0052 and replaces it with the current Plan workflow
-5. Permission timeout = **120s deny**
+5. Local permission approvals have **no automatic deadline**; they remain
+ pending until an explicit decision, cancellation, or host/process shutdown
6. Session grants = **by toolName**
7. First release platform = **macOS arm64 only**
8. TS schema = **typebox**
diff --git a/docs/adr/0205-remote-agent-control-boundary.md b/docs/adr/0205-remote-agent-control-boundary.md
index 69fa10d54..4a5153820 100644
--- a/docs/adr/0205-remote-agent-control-boundary.md
+++ b/docs/adr/0205-remote-agent-control-boundary.md
@@ -158,10 +158,9 @@ required more than v1 can carry. The following changes apply to decisions 3,
and a remote decision closes the local desktop card.
8. **Remote permission ceiling and approval lifetime.** A remote-initiated
turn runs under the lower of the session mode and a Host-configured
- ceiling that defaults to `ask`. The local 120-second deny timeout stays
- the default; a Host with remote control enabled may configure a longer
- bounded lifetime for approvals raised while a remote subscriber is
- attached.
+ ceiling that defaults to `ask`. Local desktop permission approvals have no
+ automatic deadline. The remote approval record may use a longer bounded
+ lifetime while a remote subscriber is attached, as amended by ADR 0310.
9. **Host link relay profile.** The Gateway-to-Host connection multiplexes
logical client connections so server-initiated approval requests and
attachment bytes reach the right endpoint without an inbound port; the
@@ -230,8 +229,8 @@ answers below were chosen by the maintainer the same day.
until a controller attaches. The schema bump is recorded by its own ADR
when R1 starts.
8. **Remote approval lifetime.** While a remote subscriber is attached the
- default approval lifetime is 30 minutes, operator-adjustable within a
- bound; the local 120-second default is unchanged.
+ default remote approval lifetime is 30 minutes, operator-adjustable within
+ a bound; local desktop permission approvals have no automatic deadline.
9. **Second scheduled milestone: outbound messaging integration.** An
adapter beside the Host relays redacted event summaries to a webhook
first, then Telegram and Slack through outbound channels, and maps a fixed
diff --git a/docs/adr/0310-local-permission-approvals-without-deadline.md b/docs/adr/0310-local-permission-approvals-without-deadline.md
new file mode 100644
index 000000000..d4a5bbd3b
--- /dev/null
+++ b/docs/adr/0310-local-permission-approvals-without-deadline.md
@@ -0,0 +1,49 @@
+# ADR 0310: Keep local permission approvals pending until resolved
+
+- Status: Accepted for implementation
+- Date: 2026-09-29
+- Deciders: PI-Desktop maintainers
+- Amends: D005 / [ADR 0011](0011-host-rpc-and-storage-defaults.md)
+- Related: D636, issue #1214, E2E-017
+
+## Context
+
+The local `ask` permission flow displayed a 120-second countdown and then
+denied a request in host-core. The same deadline was copied into the renderer
+card, the pending-permission snapshot, and the RPC transport budgets. A user
+who did not notice the card in time therefore made an unintended decision, and
+the visible card disappeared even though the user had not acted.
+
+## Decision
+
+Local permission-gated `tools.execute` requests remain pending until one of
+these explicit lifecycle events occurs:
+
+- the user chooses Allow once, Allow for session, or Deny;
+- the tool call or turn is cancelled; or
+- the host / sidecar process shuts down.
+
+The renderer shows no countdown. Host-core does not expire or sweep local
+permission requests, and `permissions.pending` returns every open request
+without `timeoutMs`, `expiresAt`, or `remainingMs`. The transport does not set
+a deadline for `tools.execute`; cancellation and process-close handling remain
+the liveness paths. Tool-specific execution budgets, Plan/Goal contract
+approval lifetimes, and the separate RACP approval broker lifetimes are not
+changed by this decision.
+
+## Consequences
+
+- Users can leave a permission card unanswered without an automatic denial.
+- An unattended permission request can keep its agent turn paused, so explicit
+ cancellation remains available and must continue to wake the host waiter.
+- The local permission wire shape is simplified and no longer carries a
+ misleading expiry time.
+- A lost host response is still bounded by process-close handling; ordinary
+ non-tool RPCs retain their finite transport deadlines.
+
+## Verification
+
+`permissions.rs` covers resolving a request after the old 120-second boundary,
+`parent-host-proxy.test.ts` covers indefinite tool transport waits,
+`permission-inline.test.mjs` covers the no-countdown card contract, and the
+host RPC test covers pending snapshots without expiry fields.
diff --git a/docs/adr/README.md b/docs/adr/README.md
index 0a69f87a9..f0e96ece5 100644
--- a/docs/adr/README.md
+++ b/docs/adr/README.md
@@ -340,6 +340,7 @@ Each ADR includes:
| 0307 | [Sync the API-key service catalog with pi-ai's built-in providers](0307-pi-ai-api-key-provider-sync.md) | Accepted (amends ADR 0012 / 0020 / 0116 / 0155) |
| 0308 | [Remove the Pull Requests destination and listing tool](0308-remove-pull-requests-destination.md) | Accepted |
| 0309 | [Remove bundled macOS first-launch guidance](0309-remove-macos-first-launch-artifacts.md) | Accepted (D634; amends D457 / ADR 0296) |
+| 0310 | [Keep local permission approvals pending until resolved](0310-local-permission-approvals-without-deadline.md) | Accepted for implementation |
| turn-process-and-thinking-display | [Turn process and thinking presentation](turn-process-and-thinking-display.md) | Accepted |
| provider-display-order | [Provider display order](provider-display-order.md) | Accepted |
| registry-header-variable-spelling | [Remote header variables accept the registry's `{name}` spelling](registry-header-variable-spelling.md) | Proposed |
diff --git a/docs/spec/00-baseline.md b/docs/spec/00-baseline.md
index b8fecb293..b407796ec 100644
--- a/docs/spec/00-baseline.md
+++ b/docs/spec/00-baseline.md
@@ -1,8 +1,8 @@
# PI-Desktop Baseline Freeze
-- Baseline Version: `0.4.18`
-- Date: `2026-09-14`
-- Status: `Frozen for implementation details (Plan checkpoint artifact + approval/execution startup fence + protocol v11 + schema v16 + host-owned plugin session import/read/update/delete P0/P1 + selectable shell catalog + icon-free composer prompt row + turn-boundary context checkpoint compaction + session-scoped work panel + edge-specific work-panel/chat resize ownership + models.dev model catalog with a bundled release snapshot + provider/runtime safety + M5 hardening + settings IA + project archive + sidebar organization + app update delivery + three-platform release + Extensions page density and theme-readable actions + custom global UI font + ChatGPT-style logical project groups)`
+- Baseline Version: `0.4.19`
+- Date: `2026-09-29`
+- Status: `Frozen for implementation details (indefinite local permission approvals + Plan checkpoint artifact + approval/execution startup fence + protocol v11 + schema v16 + host-owned plugin session import/read/update/delete P0/P1 + selectable shell catalog + icon-free composer prompt row + turn-boundary context checkpoint compaction + session-scoped work panel + edge-specific work-panel/chat resize ownership + models.dev model catalog with a bundled release snapshot + provider/runtime safety + M5 hardening + settings IA + project archive + sidebar organization + app update delivery + three-platform release + Extensions page density and theme-readable actions + custom global UI font + ChatGPT-style logical project groups)`
- Language policy: **English-first**
- Backend policy: **Rust host core + pi agent sidecar**
@@ -89,6 +89,9 @@
> host-backed adjustment of logical project roots. The editor keeps the Primary
> root fixed, supports adding/removing eligible additional roots, and rejects
> removal of roots that still own chats.
+> `0.4.19` removes the automatic deadline from local permission approvals. The
+> inline card and host pending state remain open until an explicit decision,
+> cancellation, or process shutdown; per-tool execution timeouts remain.
> The current post-baseline amendments add the P0/P1 host-owned plugin session
> API through ADR 0200 / D367, explicit project ids plus host-owned session
@@ -128,7 +131,7 @@
value remains a conversation-surface implementation detail, not an
operating mode
16. Agent tools: **Read / Glob / Grep / Write / Edit / Bash**
-17. Permission timeout: **120s → deny**
+17. Local permission approvals: **no automatic deadline; explicit decision or cancellation required**
18. Session grant scope: **by toolName**
19. `~/.pi` one-shot auto-import: **not in MVP**. ADR 0254 adds read-only
native-session discovery and explicit continuation against the canonical Pi
diff --git a/docs/spec/02-architecture/05-remote-agent-control.md b/docs/spec/02-architecture/05-remote-agent-control.md
index 49fa83d94..00b278319 100644
--- a/docs/spec/02-architecture/05-remote-agent-control.md
+++ b/docs/spec/02-architecture/05-remote-agent-control.md
@@ -402,10 +402,10 @@ transition that outlives the submitting turn. A remote client cannot select
an unadvertised permission mode or execute a tool directly; changing a
durable mode uses `session/configure` from the remote-host profile and is
idle-only, exactly as locally. A Gateway-routed turn never exceeds the Host's
-remote permission ceiling. Approval lifetime is Host policy: the local
-default stays 120 seconds then deny, and while a remote subscriber is
-attached the default is 30 minutes (D375), bounded and operator-adjustable,
-because a remote approver is rarely at the keyboard.
+remote permission ceiling. Local desktop permission approvals have no
+automatic deadline. While a remote subscriber is attached, the remote approval
+record defaults to 30 minutes (D375), bounded and operator-adjustable, because
+a remote approver is rarely at the keyboard.
## 10. Failure and recovery model
diff --git a/docs/spec/03-runtime/03-tools-and-permissions.md b/docs/spec/03-runtime/03-tools-and-permissions.md
index 4a94b8b83..c787cc578 100644
--- a/docs/spec/03-runtime/03-tools-and-permissions.md
+++ b/docs/spec/03-runtime/03-tools-and-permissions.md
@@ -1,6 +1,6 @@
# 03. Tools and Permissions
-> Decisions applied: D003, D004, D005, D006, D013, D015, D093, D114, D115, D181, D186,
+> Decisions applied: D003, D004, D006, D013, D015, D093, D114, D115, D181, D186, D636,
> D189, D190, D195 (ADR 0057), D315, D384 (ADR 0211), ADR 0087
## 0. Frozen policy summary
@@ -13,7 +13,7 @@
| Goal tools | Read / Glob / Grep / BrowserPreview / Bash / SubmitGoal + plugin tools that declare plan-safe actions |
| Plan and Goal hard deny | Write / Edit / plugin tools without `planSafeActions` / unknown tools / the other kind's submit tool |
| Plugin `planSafeActions` | Non-empty array of `action` strings; runtime hides plugin tools without one in Plan/Goal, host admits listed tools, plugin-runtime rejects any action outside the list (ADR 0211) |
-| Permission timeout | 120s → deny |
+| Local permission approval | No automatic deadline; explicit decision or cancellation required |
| allow-session scope | toolName |
| Bash style | non-interactive; selected host catalog shell with streamed output |
| Edit contract | line-anchored ops + whole-file `tag`; no `old_string`/`new_string` (ADR 0087) |
@@ -158,7 +158,7 @@ low-risk auto-allow decision:
- `ask` and `accept-edits` emit the ordinary permission card;
- `allow-once` executes only the current call, while `allow-session` follows
the existing per-tool session grant scope;
-- denial, timeout, or cancellation never executes the operation;
+- denial or cancellation never executes the operation;
- relative `..` escapes and symlink escapes use the same rule as absolute
paths;
- successful external `Read`/`Write`/`Edit` results carry `root: "external"`
@@ -464,8 +464,10 @@ tool call
→ deny? return tool error result
```
-Permission confirmation timeout:
-- After 120s, auto-deny (D005: fail closed, do not hang forever)
+Permission confirmation:
+- The local approval remains pending until Allow once, Allow for session, Deny,
+ cancellation, or host/process shutdown. Tool-specific execution timeouts
+ still apply after approval.
## 8. Tool Result Visibility to the Model
diff --git a/docs/spec/03-runtime/06-host-rpc-protocol.md b/docs/spec/03-runtime/06-host-rpc-protocol.md
index 5c91866d4..b53f7f1b4 100644
--- a/docs/spec/03-runtime/06-host-rpc-protocol.md
+++ b/docs/spec/03-runtime/06-host-rpc-protocol.md
@@ -799,7 +799,7 @@ Authoritative mode and workspace resolution are session-scoped:
For `Read`/`Glob`/`Grep`/`Write`/`Edit`, the host classifies an explicit path
outside the workspace and scratch roots before the low-risk auto-allow rule.
`auto` executes it, while `ask` and `accept-edits` emit
-`permissions.request`; denial, timeout, or cancellation returns `TOOL_DENIED`
+`permissions.request`; denial or cancellation returns `TOOL_DENIED`
without executing the operation. Relative `..` and symlink escapes use the
same classification. Bash's working directory and implicit recursive walks do
not inherit this exception.
@@ -1061,7 +1061,6 @@ params: {
risk: "low" | "medium" | "high"
argsPreview: unknown
reason: string
- timeoutMs: 120000
}
```
@@ -1075,14 +1074,16 @@ params: {
}
```
-Timeout behavior (**D005**): after 120s unresolved → deny.
+Local permission behavior (**D636 / ADR 0310**): an unresolved request remains
+pending until an explicit decision, cancellation, or host/process shutdown.
+The transport does not apply a deadline to `tools.execute`; tool-specific
+execution budgets still apply after approval.
`permissions.pending` returns the open requests as Host state (D374/D375):
`{ requests: PendingPermission[] }`, oldest first, optionally scoped by
`sessionId`. Each entry carries the same fields as the `permissions.request`
-notification plus `createdAt`, `expiresAt`, and `remainingMs`. Requests past
-the timeout are omitted. A client that attaches after the notification was
-emitted reads this list and answers through the unchanged
+notification plus `createdAt`. Requests remain listed until settled. A client
+that attaches after the notification was emitted reads this list and answers through the unchanged
`permissions.resolve`; the notification path itself does not change.
## 7. Error codes
@@ -1173,7 +1174,7 @@ Tool outcomes (`TOOL_DENIED`, `TOOL_TIMEOUT`, `PATH_OUTSIDE_WORKSPACE`,
1. Electron spawns host and completes handshake
2. health method returns ok
3. denied tool path returns `TOOL_DENIED`
-4. timeout path returns deny decision after 120s
+4. an unresolved permission remains pending until an explicit decision or cancellation
5. switching the selected workspace from A to B does not change the tool root
of a call issued by session A
6. Protocol v4 `session.endTurn` creates/returns exactly one notification for
diff --git a/docs/spec/03-runtime/08-error-codes.md b/docs/spec/03-runtime/08-error-codes.md
index 28ead59b8..36c623f8b 100644
--- a/docs/spec/03-runtime/08-error-codes.md
+++ b/docs/spec/03-runtime/08-error-codes.md
@@ -134,7 +134,7 @@ does not turn temporary thread pressure into a host process exit.
| `SHELL_NOT_FOUND` | no | no effective platform shell is available after catalog fallback; message carries guidance |
| `COMMAND_SHELL_CHANGED` | no | pinned shell ID or dialect changed before execution |
| `COMMAND_SHELL_INVALID` | no | settings supplied an unknown, unavailable, or wrong-platform shell ID |
-| `PERMISSION_TIMEOUT` | no | permission prompt timed out (mapped to deny) |
+| `PERMISSION_TIMEOUT` | no | legacy compatibility code for an older permission prompt timeout; current local prompts remain pending instead |
| `PERMISSION_REQUIRED` | no | waiting for user decision |
| `WRITE_DISABLED_IN_PLAN` | no | contract-mode hard-deny for Write |
| `EDIT_DISABLED_IN_PLAN` | no | contract-mode hard-deny for Edit |
@@ -424,7 +424,9 @@ the pool it started on. The route in effect is reproduced, never downgraded to a
direct connection.
### Permission timeout
-UI/host timeout emits `PERMISSION_TIMEOUT` internally, tool result presented as denied (`TOOL_DENIED`) to agent.
+`PERMISSION_TIMEOUT` is a legacy compatibility code and is no longer emitted
+for local desktop permission requests. An unresolved local permission remains
+pending; explicit denial or cancellation is reported as `TOOL_DENIED`.
### Shell and Plan/Goal checkpoint failures
diff --git a/docs/spec/03-runtime/09-logging-and-observability.md b/docs/spec/03-runtime/09-logging-and-observability.md
index fad46b88e..86f84dbfe 100644
--- a/docs/spec/03-runtime/09-logging-and-observability.md
+++ b/docs/spec/03-runtime/09-logging-and-observability.md
@@ -136,7 +136,7 @@ record.
- host/agent spawn, handshake, and unexpected exit;
- session create/delete;
- prompt accepted/aborted;
-- tool completion/failure/interruption and permission request/decision/timeout;
+- tool completion/failure/interruption and permission request/decision/cancellation;
- Plan artifact creation, approval, expiry, rejection, execution transition,
and startup interruption;
- shell identity, timeout, abort, and process-tree shutdown;
diff --git a/docs/spec/03-runtime/10-session-state-machine.md b/docs/spec/03-runtime/10-session-state-machine.md
index c7ac66fb7..11f18f1e3 100644
--- a/docs/spec/03-runtime/10-session-state-machine.md
+++ b/docs/spec/03-runtime/10-session-state-machine.md
@@ -107,7 +107,9 @@ turn that has ended.
tool row begins, abort preserves the partial transcript and restores no
draft. The snapshot keeps structured file/image references and is never
reconstructed by parsing model-facing `@path` text.
-5. Permission timeout moves to tool denied, then agent may continue or end based on runtime handling
+5. A local permission remains in `waiting_permission` until explicit allow,
+ deny, cancellation, or host shutdown; an explicit deny then moves to tool
+ denied and the agent may continue or end based on runtime handling
6. Session status returns to idle after terminal turn states are persisted
7. Changing the renderer's active project/session does not transition or abort
any background session
diff --git a/docs/spec/03-runtime/19-remote-agent-control-protocol.md b/docs/spec/03-runtime/19-remote-agent-control-protocol.md
index 9b7c49218..48b267a54 100644
--- a/docs/spec/03-runtime/19-remote-agent-control-protocol.md
+++ b/docs/spec/03-runtime/19-remote-agent-control-protocol.md
@@ -488,8 +488,9 @@ Rules:
is the local `AskToolResolution` contract.
4. Approval summaries MUST be safe to display. Raw provider credentials,
secret values, and unbounded tool results are never included.
-5. Expiry maps the local `PERMISSION_TIMEOUT` and `PLAN_APPROVAL_TIMEOUT`
- outcomes to `APPROVAL_EXPIRED`; the tool is never executed after expiry.
+5. Expiry maps a legacy `PERMISSION_TIMEOUT` from an older local host, and
+ `PLAN_APPROVAL_TIMEOUT`, to `APPROVAL_EXPIRED`; the tool is never executed
+ after expiry. Current local permission prompts do not expire.
### 5.6 Attachment
@@ -1132,7 +1133,7 @@ The initial target limits are:
| `connection/initialize` deadline | 10 seconds |
| Read/metadata operation deadline | 15 seconds |
| `turn/start` admission deadline | 5 seconds |
-| Approval lifetime, local default | 120 seconds, then deny |
+| Approval lifetime, local default | No automatic deadline; explicit decision or cancellation |
| Approval lifetime, remote policy | 30 minutes by default while a remote subscriber is attached; Host-configured, bounded, advertised as `approvalLifetimeMs` |
| Heartbeat interval | 30 seconds |
| Terminal output replay ring | 128 KiB per terminal |
@@ -1142,12 +1143,12 @@ The initial target limits are:
The Host MAY advertise stricter limits. It MUST return a structured limit
error rather than truncating a command silently.
-Approval lifetime is a Host policy. The local default stays at 120 seconds
-then deny (frozen decision 17). While a remote subscriber is attached the
-default lifetime is 30 minutes (D375), because a remote approver is rarely at
-the keyboard; the Host operator may shorten or lengthen it within a bound, the
-tool call stays blocked for that lifetime unless a local or remote decision
-arrives earlier, and a disconnect never extends it.
+Approval lifetime is a Host policy. Local desktop permission requests have no
+automatic deadline and remain pending until an explicit decision, cancellation,
+or shutdown. While a remote subscriber is attached, the remote approval record
+has a 30-minute default lifetime (D375), because a remote approver is rarely at
+the keyboard; the Host operator may shorten or lengthen it within a bound, and
+a disconnect never extends it.
## 13. Errors
@@ -1284,4 +1285,3 @@ D375 (2026-09-10) re-sequenced the deployments and extended the catalog:
- queued turns persisted by host-core and held after a restart, the
30-minute default approval lifetime for remote subscribers, and the
`applyCeilingToPairedDevices` policy.
-
diff --git a/docs/spec/04-ux/01-ui-ia.md b/docs/spec/04-ux/01-ui-ia.md
index 5483131d9..260dedb13 100644
--- a/docs/spec/04-ux/01-ui-ia.md
+++ b/docs/spec/04-ux/01-ui-ia.md
@@ -421,7 +421,7 @@ shared capability contract:
tabs over the currently selected project. Messages, tool events, permission
requests, and panel resources remain scoped to that session. Explicitly
opening the conversation restores its retained panel context and reveals any
- pending permission card with its original deadline.
+ pending permission card, which remains actionable without a deadline.
- Completed/failed turn not already visible → host-core appends one durable
inbox row. A result shown in the visible, focused current chat and every
`aborted` turn append none. Background sessions and any turn finishing while
diff --git a/docs/spec/04-ux/03-permission-ux.md b/docs/spec/04-ux/03-permission-ux.md
index f7095e49a..f2cfbbd77 100644
--- a/docs/spec/04-ux/03-permission-ux.md
+++ b/docs/spec/04-ux/03-permission-ux.md
@@ -43,7 +43,6 @@ No `allow-always` in MVP.
pending → allowed_once
pending → allowed_session
pending → denied
-pending → timeout_denied
```
- A request is keyed by both `sessionId` and `requestId`.
@@ -53,12 +52,14 @@ pending → timeout_denied
- Replacing or resolving one request never removes another session's request
or a newer request in the same session.
-## 5. Timeout
+## 5. Waiting behavior
-- Default timeout: **120 seconds**
-- On timeout: auto `deny`
-- UI shows timeout state explicitly
-- Agent receives tool error result: user denied / timed out
+- A local permission card has no automatic deadline or countdown.
+- The request remains pending until Allow once, Allow for session, Deny,
+ cancellation, or host/process shutdown.
+- Tool-specific execution timeouts still apply after approval.
+- The agent receives a denied result only for an explicit denial, cancellation,
+ or host/process failure.
## 6. Card content requirements
@@ -74,7 +75,7 @@ Must show:
The card is rendered inline only in its originating session's transcript.
Background requests remain pending without opening an overlay, changing the
active page/project/session, or moving keyboard focus. Opening that session
-reveals its card with the original absolute countdown deadline.
+reveals its still-pending card.
Resolving a request never initiates navigation. Any resulting tool artifact is
recorded in the same session's retained work-panel context. If that session is
@@ -94,11 +95,9 @@ answerable.
invisibly; their delegates stay blocked, which is the intended back-pressure.
- Answers are matched by `requestId`, never by position, so a late answer can
only clear the request it answered and can never resolve a successor.
-- A request the host closed itself (expiry, cancelled tool call) is removed by
+- A request the host closed itself (cancelled tool call) is removed by
`toolCallId` from anywhere in the queue, so a card that was never shown still
- leaves. The 120s deadline (§5) runs from arrival for every request, queued or
- not — a request can therefore expire while waiting, and the host's own denial
- is what the delegate sees.
+ leaves. Queued requests do not expire while waiting.
- Abort denies the **whole** queue, not just the visible card: a queued delegate
would otherwise keep its tool call alive behind a stop the user already asked
for.
@@ -182,7 +181,8 @@ after a full Host/app restart.
2. Plan and Goal Bash prompt under Ask and Accept edits and run without confirmation
under Auto, with the mutation tradeoff visible
3. Agent mode uses the normal high-risk permission policy
-4. timeout becomes deny in UI + tool result
+4. unanswered local permissions remain pending until an explicit decision or
+ cancellation; execution timeouts remain enforced after approval
5. allow-session suppresses repeat prompts for same toolName only
6. concurrent session requests remain isolated and never take over the visible
conversation or its work panel; post-approval artifacts remain assigned to
diff --git a/docs/spec/04-ux/08-component-spec.md b/docs/spec/04-ux/08-component-spec.md
index f51e0a2b6..36e05d9d3 100644
--- a/docs/spec/04-ux/08-component-spec.md
+++ b/docs/spec/04-ux/08-component-spec.md
@@ -2577,7 +2577,6 @@ Inline transcript card requesting user approval for a high-risk tool call. See
| Workspace: /Users/dev/project |
| ─────────────────────────── |
| [Allow once] [Allow for session] [Deny] |
-| Timeout: 120s countdown |
+----------------------------------------------+
```
@@ -2591,27 +2590,27 @@ fields. It is never a JSON dump.
- Only the active session's pending request is mounted. Background requests
stay in session-keyed renderer state without inserting content into the
visible transcript or covering another destination.
-- Different sessions may each hold one pending request. Resolution, timeout,
+- Different sessions may each hold one pending request. Resolution, cancellation,
abort, tool completion, and session deletion clear only the matching
request.
-- Countdown uses the request's absolute receipt time and does not restart when
- the user switches away and back.
+- A pending request remains visible when the user switches away and back; it
+ has no countdown or expiry timestamp.
### 10.4 States
| State | Appearance | Actions |
|---|---|---|
-| Pending | warning accent, countdown visible | Allow once / Allow session / Deny buttons active |
+| Pending | warning accent | Allow once / Allow session / Deny buttons active |
| Resolving | pending appearance retained | All three buttons disabled until the request settles |
| Allowed once | success border, "Allowed (once)" label | No actions |
| Allowed session | success border, "Allowed (session)" label | No actions |
| Denied | error border, "Denied" label | No actions |
-| Timeout denied | warning border, "Denied (timeout)" label | No actions |
### 10.5 Interactions
- Buttons: primary (Allow once), secondary (Allow session), danger (Deny)
-- Countdown: visible timer decrementing from 120s
+- No countdown is shown; the card remains pending until an explicit decision or
+ cancellation.
- The first action locks all buttons. Resolution errors use an error toast;
successful or failed completion returns focus to the current composer.
- The originating session's composer cannot send during pending permission,
@@ -2621,7 +2620,7 @@ fields. It is never a JSON dump.
### 10.6 Accessibility
- `role="region"` with a localized accessible name; the static title supplies
- the polite live announcement so the per-second timer is not re-announced
+ the polite live announcement without a per-second timer
- Buttons clearly labeled and reachable in normal transcript tab order; the
card never traps or forcibly moves focus
- Countdown announced periodically (every 30s) or on request
@@ -3965,7 +3964,7 @@ Sidebar footer Popover (360px max)
compact composer with 1–7-line draft growth) match spec
4. Chat content band defaults to 760px and is user-resizable; user plates stay compact
5. ToolCallCard shows status, args preview, result preview, duration per [01-ui-ia.md](01-ui-ia.md) §5
-6. PermissionCard shows tool name, risk, args, countdown, and three action buttons per [03-permission-ux.md](03-permission-ux.md)
+6. PermissionCard shows tool name, risk, args, and three action buttons per [03-permission-ux.md](03-permission-ux.md)
7. Composer: Enter sends when Enter-to-send is on; when it is off, Cmd/Ctrl+Enter
sends and Enter inserts a newline; Shift+Enter always inserts a newline;
draft grows from one through seven visible lines then scrolls, and the single
diff --git a/docs/spec/04-ux/09-interaction-patterns.md b/docs/spec/04-ux/09-interaction-patterns.md
index cd2594fac..d2b0a4fdb 100644
--- a/docs/spec/04-ux/09-interaction-patterns.md
+++ b/docs/spec/04-ux/09-interaction-patterns.md
@@ -918,7 +918,6 @@ may be retained while exactly one workspace supplies the visible shell context.
Agent calls a permission-gated tool (including Plan/Goal Bash under Ask or Accept edits)
→ PermissionCard inserted inline in transcript
→ Composer disabled (cannot send new prompt)
- → Countdown starts (120s)
→ User responds: Allow once / Allow session / Deny
→ Card transitions to resolved state
→ Composer re-enabled
@@ -930,8 +929,8 @@ Agent calls a permission-gated tool (including Plan/Goal Bash under Ask or Accep
- Each session has at most one active permission card because that agent loop
is paused; multiple sessions may wait independently.
- Abort cancels only the active session's pending permission.
-- Timeout (120s from original receipt) auto-denies only the matching request;
- switching sessions never resets the deadline.
+- An unanswered request remains pending; switching sessions does not remove or
+ reset it. Explicit cancellation still clears only the matching request.
### 5.3 Focus management during permission
@@ -1605,7 +1604,8 @@ This does not prevent state changes — it makes them instant.
finishes the current boundary before releasing its prioritized prompt
4. Long content (>50 lines for messages, >10 for args, >20 for results) is collapsed by default with expand link
5. Tool results that were cut short show a truncation marker or chip per D306; a filled Read window of a longer file does not
-6. Permission interrupt inserts inline card, disables composer, shows countdown, and re-enables after resolution
+6. Permission interrupt inserts an inline card, disables the composer, and
+ re-enables it after explicit resolution or cancellation
7. Toasts used for transient background operations; inline errors used for context-specific failures
8. Focus returns to composer after session switch, message send, permission resolution, and abort
9. Background message, tool, completion, and permission events never change
diff --git a/docs/spec/05-security/02-remote-control-security.md b/docs/spec/05-security/02-remote-control-security.md
index 404e75aad..4b9e8f7c7 100644
--- a/docs/spec/05-security/02-remote-control-security.md
+++ b/docs/spec/05-security/02-remote-control-security.md
@@ -336,16 +336,16 @@ verifies request id, Session id, turn id, principal role, expiry, allowed
decision, permission-mode selection, and current state in one operation.
Pending requests are Host state. Rust host-core keeps the pending permission
-table and its timer; the Agent Host reads it through `permissions.pending`
+table; the Agent Host reads it through `permissions.pending`
so a late-attaching client receives open requests. That read is redacted the
same way as the request event and never returns tool arguments beyond the
bounded preview.
-Approval lifetime is Host policy. The local default remains 120 seconds then
-deny (frozen decision 17). While a remote subscriber is attached the default
-is 30 minutes (D375); the operator may shorten or lengthen it within a bound,
-the blocked tool waits for that lifetime unless a local or remote decision
-arrives earlier, and a client disconnect never extends it.
+Approval lifetime is Host policy. Local desktop permission requests have no
+automatic deadline and remain pending until a decision, cancellation, or
+shutdown. While a remote subscriber is attached, the remote approval record
+defaults to 30 minutes (D375); the operator may shorten or lengthen that
+bounded remote lifetime, and a client disconnect never extends it.
An approval response that arrives after disconnect, expiry, abort, crash, or
turn completion is a no-op or a structured stale/expired error. It never
diff --git a/docs/spec/06-delivery/02-acceptance-criteria.md b/docs/spec/06-delivery/02-acceptance-criteria.md
index a1158ba7a..d2390c757 100644
--- a/docs/spec/06-delivery/02-acceptance-criteria.md
+++ b/docs/spec/06-delivery/02-acceptance-criteria.md
@@ -48,7 +48,8 @@ MVP passes when:
- [x] Plan and Goal Bash prompt under Ask/Accept edits and run without confirmation
under explicit Auto — auto:`test:e2e:plan` E2E-105 + host-core permission tests
- [x] Agent mode uses permission policy for Write/Edit/Bash — manual:M3
-- [x] Permission timeout (120s) becomes deny — manual:M3 (D005)
+- [x] Local permission cards remain pending until an explicit decision or
+ cancellation; tool execution budgets remain enforced — unit/host-core: issue #1214 (D636)
- [x] Read/Glob/Grep work inside the project — auto:`test:e2e` (glob tool)
- [x] Write/Edit/Bash trigger an inline, session-scoped confirmation card — manual:M3
- [x] Background events and permission requests never activate or cover another
diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.md
index 01425791c..fa06fb977 100644
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@ -2185,14 +2185,14 @@ identify the platform validation still needed.
- **Milestone**: M3
- **Status**: Automated (protocol smoke: Read + Glob in sample project)
-### Permission Allow / Deny / Timeout
+### Permission Allow / Deny / Cancellation
#### E2E-014: Write/Edit/Bash triggers permission card
- **Preconditions**: Agent mode; project open.
- **Steps**: 1) Ask agent to write a file. 2) Observe permission card.
- **Expected**: Permission card appears inline in the originating transcript
- with tool name, workspace, arguments preview, countdown, and allow/deny
+ with tool name, workspace, arguments preview, and allow/deny
options. It creates no backdrop or modal and does not cover another session.
- **Specs linked**: `04-ux/03-permission-ux.md`, `03-runtime/03-tools-and-permissions.md`
- **Acceptance**: E (Write/Edit/Bash trigger confirmation)
@@ -2219,11 +2219,14 @@ identify the platform validation still needed.
- **Milestone**: M3
- **Status**: Draft
-#### E2E-017: Permission timeout defaults to deny
+#### E2E-017: Local permission approval has no automatic deadline
- **Preconditions**: Permission card displayed; no user action.
-- **Steps**: 1) Wait 120 seconds without responding to permission card. 2) Observe outcome.
-- **Expected**: Permission auto-denied after timeout; tool not executed.
+- **Steps**: 1) Leave the permission card unanswered. 2) Confirm it remains
+ visible and the tool call remains pending. 3) Choose Deny and observe the
+ outcome.
+- **Expected**: No countdown or automatic denial appears; the request remains
+ pending until the explicit Deny action, and the tool is not executed.
- **Specs linked**: `03-runtime/03-tools-and-permissions.md`
- **Acceptance**: E (timeout → deny)
- **Milestone**: M3
@@ -5418,7 +5421,7 @@ must keep splitting are covered by `markdown-blocks.test.mjs`.
- **Expected**: B's background events update only B's row and retained state;
they do not change A's active session/project/page, transcript, draft, scroll,
or keyboard focus, and no global modal appears. Opening B reveals only B's
- inline card with its original countdown. Both requests remain independently
+ inline card with no countdown. Both requests remain independently
actionable, and resolving B does not clear A. The final rapid selection stays
on B even when A's older load finishes later. Only explicit notification or
session activation may navigate. A's post-approval review card is retained only in
@@ -5431,7 +5434,7 @@ must keep splitting are covered by `markdown-blocks.test.mjs`.
- **Acceptance**: C (session isolation), E (permission isolation), Quality
- **Milestone**: M5
- **Status**: Unit-covered (`permission-inline.test.mjs` for scoped state,
- inline rendering contract, absolute countdown, and latest-selection guard;
+ inline rendering contract, no-countdown behavior, and latest-selection guard;
`work-panel.test.mjs` and `browser-preview-tool.test.mjs` for session-scoped
artifact retention and routing); full UI scenario Draft
@@ -9761,8 +9764,8 @@ This test plan spec is accepted when:
- Expect no backdrop, modal, page/session switch, work-panel hide, transcript
replacement, or composer-focus change in A. B retains its pending state.
- Open B explicitly and expect one inline permission card after B's latest
- activity, with readable risk, args, workspace, countdown, and wrapping action
- controls. Switching away and back preserves the absolute deadline.
+ activity, with readable risk, args, workspace, and wrapping action controls.
+ Switching away and back preserves the pending request without a deadline.
- Make A and B pending together, resolve each independently, and confirm neither
action removes or changes the other card.
- Resolve A's Write/Edit permission and switch to B before completion. Expect no
diff --git a/docs/spec/07-plugins/12-plugin-ipc-and-host-services.md b/docs/spec/07-plugins/12-plugin-ipc-and-host-services.md
index b2c7cecad..35c849f3a 100644
--- a/docs/spec/07-plugins/12-plugin-ipc-and-host-services.md
+++ b/docs/spec/07-plugins/12-plugin-ipc-and-host-services.md
@@ -235,7 +235,7 @@ permission gate and result envelope stay in host-core:
1. Model calls `plugin_<pluginIdSafe>_<toolName>`; the sidecar forwards it
to host `tools.execute` like any built-in tool.
2. host-core resolves the durable operating mode first. In Agent it runs the
- normal permission flow (risk, session grants, 120s timeout), then emits
+ normal permission flow (risk, session grants, no automatic deadline), then emits
notification `plugins.execute`
`{ executionId, sessionId, toolCallId, toolName, args, turnId }`. `turnId` is
the runtime turn identity, forwarded unchanged so the plugin tool context can
@@ -249,10 +249,9 @@ permission gate and result envelope stay in host-core:
(`DESKTOP_TOOL_DISPATCH_TIMEOUT_MS`, above both the 110s plugin tool budget
and the widest MCP leg — a 10s lazy handshake, a 30s `tools/list` traversal,
then the 100s call) and then maps to `TOOL_TIMEOUT`; an unknown/unloaded tool
- maps to `TOOL_NOT_FOUND`. The transport deadline for these calls covers the
- 120s permission wait, the 30s admission queue wait, that dispatch, and 10s of
- slack (`rpcTimeoutMs`), so no outer layer gives up before host-core reports
- the outcome.
+ maps to `TOOL_NOT_FOUND`. The `tools.execute` transport has no deadline while
+ waiting for the explicit permission decision; after approval, host-core's
+ execution budget remains authoritative.
The model-facing registry gains plugin tools per prompt: main passes registered
defs (`fullName`, description, JSON-schema parameters) to `agent.prompt`, and
diff --git a/docs/spec/08-meta/decisions-log.md b/docs/spec/08-meta/decisions-log.md
index d4fb90190..3251fbc58 100644
--- a/docs/spec/08-meta/decisions-log.md
+++ b/docs/spec/08-meta/decisions-log.md
@@ -14,7 +14,7 @@ This log freezes previously open questions into concrete decisions.
| D002 | SQLite ownership | **Rust host-core owns SQLite exclusively** | Single writer, clearer privilege boundary |
| D003 | Default mode | **Agent** | Product is an agent desktop, not pure chat |
| D004 | Former restricted profile | *(superseded by D189)* **The former Chat read-only profile is removed; persisted Chat values migrate to Plan.** | The product now has one Agent with a planning state and a separate approval boundary |
-| D005 | Permission timeout | **120s → deny** | Fail closed, do not hang forever |
+| D005 | Permission timeout *(amended by D636 / ADR 0310)* | **Historical: 120s → deny. Local permission approvals now have no automatic deadline; explicit decision or cancellation is required.** | D636 preserves explicit cancellation and tool execution budgets without turning an unattended card into an automatic decision |
| D006 | `allow-session` scope | **By `toolName`** | Simple UX; workspace sandbox still enforces path safety |
| D007 | `~/.pi` compatibility | **No auto-import in MVP** | Keep config ownership clean in `~/.pi-desktop` |
| D008 | Node runtime packaging | **Dev uses system Node; release runs the bundled sidecar on the Electron binary via `ELECTRON_RUN_AS_NODE=1` (no separate Node shipped)** | Unblock M1–M4; resolved at M5, see 03-runtime/07-process-model §6 |
@@ -30,6 +30,7 @@ This log freezes previously open questions into concrete decisions.
| D457 | Signed macOS DMG is a two-icon install | *(amended by D634)* **Amend D406 / ADR 0232 / ADR 0204: official and local DMGs contain only PI-Desktop.app and the Applications link on a branded 720×440 plate. The ZIP contains PI-Desktop.app only. Neither macOS format includes the opening note or command helper, including unsigned debug artifacts. See ADR 0296 / ADR 0309 and E2E-196b.** | Tagged DMGs are signed and notarized (D450); unsigned first-launch guidance is no longer needed in package artifacts. |
| D634 | Remove bundled macOS first-launch guidance | **Amend D457 / ADR 0296 and the macOS distribution provisions of ADR 0232 / ADR 0204: neither macOS DMG nor ZIP ships `PI-Desktop-macOS-open.command`, `PI-Desktop-macOS-opening-help.txt`, or another bundled quarantine-clearing helper or opening note. The ZIP contains `PI-Desktop.app` at its root; the DMG remains a two-icon install. This applies to signed releases and local or opt-in unsigned debug builds. See ADR 0309 and E2E-196b.** | The signed release lane has eliminated the user need for an unsigned first-launch workaround; shipping it beside debug builds risks suggesting a Gatekeeper bypass. |
| D635 | Work-area-capped 800×560 window minimum | **Supersede the 1040×700 window minimum in D156 / D447 (and the matching clauses of ADR 0029 / ADR 0238) and the `1040..10000` `window/setWorkPanelChatWidth` range (ADR 0146): Electron enforces an 800×560 minimum, capped per dimension to the current display work area by `clampMinimumSizeToWorkArea`. The chat-width IPC and renderer accept `800..10000`. On narrow windows the existing `workPanelLayout` budget caps the docked panel so MainChat keeps its 450px floor, collapsing the sidebar first. See US-UI-19 and E2E-167.** | At 150% Windows scaling the work area is about 1280×672 DIP, so a fixed minimum could exceed the screen and leave the window unfittable. |
+| D636 | Local permission approvals have no automatic deadline | **Amend D005 / ADR 0011 and supersede the local tool-permission timeout clauses in the runtime and UX specs: a permission-gated `tools.execute` request remains pending in host-core, the renderer, and the transport until the user chooses Allow once, Allow for session, or Deny, or the request is cancelled / the process shuts down. Remove the 120-second countdown and timeout fields from the local permission contract. Tool-specific execution budgets and the separate RACP/Plan approval lifetimes remain unchanged. See ADR 0310, issue #1214, and E2E-017.** | A visible permission request could be missed while the user worked elsewhere; automatic denial after 120 seconds silently prevented the requested action. Keeping cancellation and execution budgets preserves control and resource safety without turning inattention into a decision. |
| D450 | Signed macOS GitHub Releases | **Amend D078 / ADR 0022: GitHub tag releases Developer ID-sign, notarize (`notarytool` via electron-builder 26), staple, and Gatekeeper-verify macOS DMG/ZIP before upload, using identity `Developer ID Application: XingYu Liu (DUV63RKYTW)` / team `DUV63RKYTW` from Actions secrets (`CSC_LINK`, `CSC_KEY_PASSWORD`, `APPLE_ID`, `APPLE_APP_SPECIFIC_PASSWORD`, `APPLE_TEAM_ID`). Missing secrets fail the job. Local unsigned packaging without a certificate remains. `workflow_dispatch` may set `sign_macos: false` only for unsigned debug artifacts. Packaged macOS uses in-app `electron-updater` (ZIP + merged `latest-mac.yml`); Linux deb/rpm and Windows portable ZIP stay notify-and-link. No afterPack/afterSign adhoc codesign (ADR 0278).** | Production DMGs must open without a Gatekeeper warning, and signed macOS installs can download and restart into a new tag. See ADR 0289, E2E-196c, E2E-067A. |
## B. Secondary implementation defaults
@@ -234,7 +235,7 @@ Gold source: local Codex electron captures; latest row wins where rows conflict.
| D098 | Review tab reads the git working tree *(superseded by D180)* | **Historical decision: Review rendered the workspace's uncommitted state through the git CLI.** | Superseded because commits erased message-level evidence and could not support safe per-message rollback |
| D099 | Terminal tab is a real PTY *(superseded by D251)* | **Historical decision: the former work panel exposed an interactive shell as a session-scoped terminal tab.** | The current product removes that separate shell surface; Agent Bash remains non-interactive and transcript-owned |
| D100 | Browser tab embeds a WebContentsView | **The preview browser is a main-process WebContentsView with renderer-driven bounds sync, hardened (deny popups→external, deny permission requests, http(s)-only navigation, isolated persist partition); it hides while blocking overlays (palette, permission dialog, settings) are open. The user drives it; the agent does not.** | Recommended modern embedding without webview-tag caveats; hide rules resolve its compositor z-order over renderer overlays |
-| D138 | Session-scoped inline permission requests | **Tool approval is an inline PermissionCard owned by its originating `sessionId`, never a global dialog. Different sessions retain independent pending requests and absolute timeout deadlines; background message/tool/permission events update only scoped state and never activate, cover, or focus another conversation. Resolution and cleanup match both session and request identity. This supersedes only D100's permission-dialog overlay/hide clause; palette, search, settings, and other blocking surfaces retain their existing browser hide behavior.** | Concurrent agents must not steal the active workflow or overwrite each other's approval requests; the existing protocol already carries the required session/request identity. |
+| D138 | Session-scoped inline permission requests | **Tool approval is an inline PermissionCard owned by its originating `sessionId`, never a global dialog. Different sessions retain independent pending requests without automatic deadlines; background message/tool/permission events update only scoped state and never activate, cover, or focus another conversation. Resolution and cleanup match both session and request identity. This supersedes only D100's permission-dialog overlay/hide clause; palette, search, settings, and other blocking surfaces retain their existing browser hide behavior.** | Concurrent agents must not steal the active workflow or overwrite each other's approval requests; the existing protocol already carries the required session/request identity. |
| D139 | Navigation intent and shortcut event guards | **Every explicit session, project, page, fork, or history navigation begins or reuses one renderer navigation intent; asynchronous work commits visible state only while that intent remains current. Global shortcuts ignore modifier-only and IME composition events, while history navigation also ignores key-repeat events.** | Late session/project loads and incomplete keyboard events must not cause unexplained page or history jumps. |
| D128 | Artifact-driven work panel tabs (shortcut clause superseded by D207) | **The work panel has no empty manual entry point, welcome chooser, titlebar/menu command, or Cmd/Ctrl+J shortcut. A file/URL/BrowserPreview/successful-command artifact creates and activates a closeable top tab; successful active-session workspace Write/Edit artifacts create and activate the singleton Review tab. File tabs are keyed by lexically normalized path, singleton tool tabs deduplicate, closing the active tab selects its right neighbor then left, closing the last tab hides the panel, and the sole panel-level control collapses it without deleting retained runtime tabs. Changing the visible session or workspace closes and clears tabs so relative resources never cross context boundaries. Startup is closed with no tabs; only panel width persists, while temporary OS-window expansion is excluded from launch bounds. Background-session, failed, and scratch writes do not steal focus. This supersedes D097's fixed tab entry points and `{open, tab}` persistence, refines D098's automatic refresh, and supersedes only D112's welcome-chooser clause.** | Match Codex's output-driven work surface, avoid an empty tool launcher, and make each visible tab correspond to work the session actually produced or explicitly previewed. D128 corrects the initially duplicated D119 identifier; D119 remains the transcript file-store decision. |
| D140 | Session-owned dirty-workspace transcript review entry *(superseded by D179)* | **After a session produces a successful workspace Write/Edit, its transcript ends with one explicit Review changes command outside collapsed activity groups while that Git working tree remains dirty; other sessions in the same project do not inherit the command. It reports the capped file count and addition/deletion totals and creates, reopens, or activates D128's singleton Review tab. The entry and Review share one workspace-keyed diff refreshed on workspace activation, successful Write/Edit/Bash completion (500ms debounce), explicit Review refresh, and window focus; sequenced requests discard prior-workspace responses. Clean and non-Git results clear review ownership for that workspace; clean, non-Git, missing-workspace, and failed-refresh states hide the entry. Review ownership is renderer-memory state discarded on relaunch with D142's work-panel contexts. This is a contextual artifact/status entry, not the empty manual launcher forbidden by D128.** | Automatic panel opening alone leaves no discoverable return path after collapse or tab close, while session ownership prevents unrelated conversations from claiming project-wide edits. Sharing the real diff makes the conversation entry accurate and keeps Review deduplicated. |
@@ -7320,3 +7321,16 @@ must keep splitting are covered by `markdown-blocks.test.mjs`.
clauses of ADR 0029 / ADR 0238) and the `1040..10000` chat-width range in
ADR 0146. `work-panel-window.test.mjs` and `work-panel-resize.test.mjs`
cover the clamp and chat-width range; see US-UI-19 and E2E-167.
+
+## 2026-09-29 — Local permission approvals remain pending until resolved (D636)
+
+- D636 amends D005 / ADR 0011 for the local desktop permission gate. A
+ permission-gated `tools.execute` request has no automatic deadline: host-core
+ keeps it in `permissions.pending`, the renderer keeps the inline card, and
+ the transport does not install a timer. Allow once, allow for session, deny,
+ explicit cancellation, and process shutdown remain the settlement paths.
+- The permission request no longer carries `timeoutMs`; pending snapshots no
+ longer expose `expiresAt` or `remainingMs`, and the UI has no countdown.
+ Tool-specific command/plugin execution budgets and the independent Plan/Goal
+ and RACP approval lifetimes are unchanged. See ADR 0310, issue #1214, and
+ E2E-017.
diff --git a/docs/spec/README.md b/docs/spec/README.md
index c10d0e2e2..28f54bb73 100644
--- a/docs/spec/README.md
+++ b/docs/spec/README.md
@@ -96,7 +96,8 @@ docs/spec/
checkpoints, `plan_approvals` execution fields, startup interruption, shell
identity, and host-owned session collaboration. v11 withdraws the A2A method
domain added in v10.
-10. Permission timeout 120s deny; Bash timeout 60s by default
+10. Local permission approvals have no automatic deadline; Bash timeout 60s by
+ default
11. Local user-installable plugins (market later)
12. Tag releases = macOS arm64 and Intel x64, Windows x64, and Linux x64 (D126/D285)
13. Universal provider/model coverage (native + OpenAI-compatible + custom)
diff --git a/docs/zh-CN/spec/00-baseline.md b/docs/zh-CN/spec/00-baseline.md
index f548ad149..f5ef5de92 100644
--- a/docs/zh-CN/spec/00-baseline.md
+++ b/docs/zh-CN/spec/00-baseline.md
@@ -3,8 +3,8 @@
> **翻译说明:** 本页是与 [英文源规格](/spec/00-baseline) 一一对应的机器辅助翻译。代码、协议字段和标识符保持原文;如翻译与英文源事实有歧义,以英文版本为准。
-- 基线版本:`0.4.16`
-- 日期:`2026-08-14`
+- 基线版本:`0.4.19`
+- 日期:`2026-09-29`
- 状态:`Frozen for implementation details (Plan checkpoint artifact + approval/execution startup fence + protocol v11 + schema v15 + host-owned plugin session import/read/update/delete P0/P1 + selectable shell catalog + icon-free composer prompt row + turn-boundary context checkpoint compaction + session-scoped work panel + pi-owned model metadata + provider/runtime safety + M5 hardening + settings IA + project archive + sidebar organization + app update delivery + three-platform release + Extensions page density and theme-readable actions + custom global UI font)`
- 语言政策:**英语优先**
- 后端策略:**Rust 主机核心 + pi 代理 sidecar**
@@ -111,7 +111,7 @@
值仍然是对话表面的实现细节,而不是
操作模式
16.Agent 工具:**读取/Glob/Grep/写入/编辑/Bash**
-17、权限超时:**120s→拒绝**
+17、本地权限确认:**无自动截止时间;必须明确决定或取消**
18. 会话授予范围:**按工具名称**
19. `~/.pi` 自动导入:**不在 MVP 中**
20.不在MVP中:**网关/远程WebUI控制**;D370 记录的本地回环 MCP 控制是
diff --git a/docs/zh-CN/spec/02-architecture/05-remote-agent-control.md b/docs/zh-CN/spec/02-architecture/05-remote-agent-control.md
index a8e6816b6..98f5c5e58 100644
--- a/docs/zh-CN/spec/02-architecture/05-remote-agent-control.md
+++ b/docs/zh-CN/spec/02-architecture/05-remote-agent-control.md
@@ -141,8 +141,8 @@ Host -> turn terminal event, next queued turn starts
远程审批使用与桌面相同的决策词汇:工具审批为 `allow-once`、
`allow-session`、`deny`;Plan/Goal 审批为带显式权限模式的 `approve` 或
`reject`;asktool 输入支持逐题回答或跳过。修改持久模式使用远端 Host profile
-的 `session/configure`,与本地一样仅限空闲时。审批寿命由 Host 策略决定:本地
-默认仍是 120 秒后拒绝,有远程订阅者接入时默认 30 分钟(D375),有界且可由运维调整。
+的 `session/configure`,与本地一样仅限空闲时。审批寿命由 Host 策略决定:本地桌面权限确认
+没有自动截止时间;有远程订阅者接入时,远程审批记录默认 30 分钟(D375),有界且可由运维调整。
## 6. 传输档案
diff --git a/docs/zh-CN/spec/03-runtime/03-tools-and-permissions.md b/docs/zh-CN/spec/03-runtime/03-tools-and-permissions.md
index b0a36d87a..d7916aeb0 100644
--- a/docs/zh-CN/spec/03-runtime/03-tools-and-permissions.md
+++ b/docs/zh-CN/spec/03-runtime/03-tools-and-permissions.md
@@ -3,7 +3,7 @@
> **翻译说明:** 本页是与 [英文源规格](/spec/03-runtime/03-tools-and-permissions) 一一对应的机器辅助翻译。代码、协议字段和标识符保持原文;如翻译与英文源事实有歧义,以英文版本为准。
-> 应用的决定:D003、D004、D005、D006、D013、D015、D093、D114、D115、D181、D186、
+> 应用的决定:D003、D004、D006、D013、D015、D093、D114、D115、D181、D186、D636、
> D189、D190、D195(ADR 0057)、D315、D384(ADR 0211)、ADR 0087
## 0. 冻结政策总结
@@ -16,7 +16,7 @@
| Goal 工具 | 读取 / Glob / Grep / BrowserPreview / Bash / SubmitGoal + 声明 plan-safe 动作的插件工具 |
| Plan 和 Goal 硬拒绝 | 写入 / 编辑 / 没有 `planSafeActions` 的插件工具 / 未知工具 / 另一类的提交工具 |
| 插件 `planSafeActions` | 非空的 `action` 字符串数组;运行时在 Plan/Goal 中隐藏没有该列表的插件工具,host 放行已列出的工具,plugin-runtime 拒绝列表外的任何动作(ADR 0211) |
-| 权限超时 | 120秒→拒绝 |
+| 本地权限确认 | 无自动截止时间;必须明确决定或取消 |
| 允许会话范围 | 工具名称 |
| 重击风格 | 非交互式;具有流输出的选定主机目录外壳 |
| Edit 契约 | 行锚定操作 + 整文件 `tag`;不再有 `old_string`/`new_string`(ADR 0087) |
@@ -148,7 +148,7 @@ schema 中放宽到 100000000,好让毫秒值先通过校验:超过 21,600
- `ask`和`accept-edits`发出普通权限卡;
- `allow-once` 仅执行当前调用,而 `allow-session` 紧随其后
现有的每个工具会话授予范围;
-- 拒绝、超时或取消永远不会执行该操作;
+- 拒绝或取消永远不会执行该操作;
- 相对 `..` 转义和符号链接转义使用与绝对相同的规则
路径;
- 成功的外部 `..`/`Read`/`Write` 结果携带 `root: "external"`
@@ -431,8 +431,8 @@ tool call
→ deny? return tool error result
```
-权限确认超时:
-- 120秒后,自动拒绝(D005:失败关闭,不永远挂起)
+权限确认:
+- 本地确认会一直保持待处理,直到允许一次、允许会话、拒绝、取消或主机/进程关闭。批准后仍执行工具自身的超时限制。
## 8. 工具结果对模型的可见性
diff --git a/docs/zh-CN/spec/03-runtime/06-host-rpc-protocol.md b/docs/zh-CN/spec/03-runtime/06-host-rpc-protocol.md
index c61da3f3b..242668a2b 100644
--- a/docs/zh-CN/spec/03-runtime/06-host-rpc-protocol.md
+++ b/docs/zh-CN/spec/03-runtime/06-host-rpc-protocol.md
@@ -581,7 +581,7 @@ type ToolsExecuteParams = {
对于`Read`/`Glob`/`Grep`/`Write`/`Edit`,主机分类显式路径
在工作区之外并在低风险自动允许规则之前从头开始。
`auto` 执行它,而 `ask` 和 `accept-edits` 发出
-`permissions.request`;拒绝、超时或取消返回 `TOOL_DENIED`
+`permissions.request`;拒绝或取消返回 `TOOL_DENIED`
而不执行该操作。相对 `..` 和符号链接转义使用
相同的分类。 Bash 的工作目录和隐式递归遍历
不继承这个异常。
@@ -843,7 +843,6 @@ params: {
risk: "low" | "medium" | "high"
argsPreview: unknown
reason: string
- timeoutMs: 120000
}
```
@@ -857,12 +856,11 @@ params: {
}
```
-超时行为 (**D005**):120 秒后未解决 → 拒绝。
+本地权限行为(**D636 / ADR 0310**):未解决的请求会一直保持待处理,直到明确决定、取消或主机/进程关闭。`tools.execute` 的传输不设置截止时间;批准后仍执行工具自身的超时限制。
`permissions.pending` 把待处理请求作为 Host 状态返回(D374/D375):
`{ requests: PendingPermission[] }`,最早的在前,可按 `sessionId` 过滤。每一项包含与
-`permissions.request` 通知相同的字段,外加 `createdAt`、`expiresAt` 和 `remainingMs`;
-已超时的请求不会出现。在通知发出之后才接入的客户端读取此列表,并通过不变的
+`permissions.request` 通知相同的字段,外加 `createdAt`;请求解决前会一直列出。在通知发出之后才接入的客户端读取此列表,并通过不变的
`permissions.resolve` 作答;通知路径本身不变。
## 7. 错误代码
@@ -953,7 +951,7 @@ JSON-RPC 错误携带一个数字 `code` 以及 `data.errorCode`,后者是来
1. Electron 生成主机并完成握手
2.health方法返回ok
3. 拒绝刀具路径返回 `TOOL_DENIED`
-4.超时路径120s后返回拒绝决策
+4. 未解决的权限请求会一直保持待处理,直到明确决定或取消
5.将选定的工作空间从A切换到B不会改变工具根
会话 A 发出的呼叫的
6. 协议 v4 `session.endTurn` creates/returns 恰好有一个通知
diff --git a/docs/zh-CN/spec/03-runtime/08-error-codes.md b/docs/zh-CN/spec/03-runtime/08-error-codes.md
index 29fa49acb..c30ff27b6 100644
--- a/docs/zh-CN/spec/03-runtime/08-error-codes.md
+++ b/docs/zh-CN/spec/03-runtime/08-error-codes.md
@@ -136,7 +136,7 @@ stdio 与 Tokio 的动态阻塞池隔离,因此后一种情况
| `SHELL_NOT_FOUND` | 不 | 目录回退后没有有效的平台 shell 可用;消息承载指引 |
| `COMMAND_SHELL_CHANGED` | 不 | 固定的 shell ID 或方言在执行前已更改 |
| `COMMAND_SHELL_INVALID` | 不 | 设置提供了未知、不可用或错误的平台 shell ID |
-| `PERMISSION_TIMEOUT` | 不 | 权限提示超时(映射为拒绝) |
+| `PERMISSION_TIMEOUT` | 不 | 旧版权限提示超时的兼容错误码;当前本地提示会一直保持待处理 |
| `PERMISSION_REQUIRED` | 不 | 等待用户决定 |
| `WRITE_DISABLED_IN_PLAN` | 不 | Write 的契约模式硬拒绝 |
| `EDIT_DISABLED_IN_PLAN` | 不 | 编辑的契约模式硬拒绝 |
@@ -405,7 +405,7 @@ errno 猜测。
链路会被原样复现,绝不会悄悄降级为直连。
### 权限超时
-UI/host 超时在内部发出 `PERMISSION_TIMEOUT`,工具结果向代理显示为拒绝 (`TOOL_DENIED`)。
+`PERMISSION_TIMEOUT` 是旧版兼容错误码,当前本地桌面权限请求不会再发出;未解决的本地权限会保持待处理,明确拒绝或取消时向代理显示为 `TOOL_DENIED`。
### Shell 和 Plan/Goal 检查点失败
diff --git a/docs/zh-CN/spec/03-runtime/19-remote-agent-control-protocol.md b/docs/zh-CN/spec/03-runtime/19-remote-agent-control-protocol.md
index e05123bba..aba1fa19b 100644
--- a/docs/zh-CN/spec/03-runtime/19-remote-agent-control-protocol.md
+++ b/docs/zh-CN/spec/03-runtime/19-remote-agent-control-protocol.md
@@ -258,8 +258,9 @@ Plan/Goal 审批为带显式 `permissionMode` 的 `approve` 或 `reject`,且
会话级转换;asktool 回答为 `Array<string[] | null>`,`null` 表示跳过。待处理请求
是 Host 状态,host-core 通过 `permissions.pending` 提供读取,晚接入的客户端在
快照中看到它们;首个有效决定生效,之后的有效响应返回 `alreadyResolved`。审批
-寿命由 Host 策略决定:本地默认 120 秒后拒绝,有远程订阅者接入时默认 30 分钟
-(D375),Host 可在上限内调整,本地或远程任一决定先到即生效,断线不会延长它。
+寿命由 Host 策略决定:本地桌面权限确认没有自动截止时间,会一直保持待处理直到明确决定、
+取消或关闭;有远程订阅者接入时,远程审批记录默认 30 分钟(D375),Host 可在上限内调整,
+断线不会延长它。
大附件使用 `attachment/create`、HTTPS 上传和 `attachment/complete`;
远程本地路径、`file://` 和任意 URL 都不允许作为附件来源。经 Gateway 时上传
@@ -314,7 +315,7 @@ Plan/Goal 审批为带显式 `permissionMode` 的 `approve` 或 `reject`,且
| `connection/initialize` deadline | 10 seconds |
| Read/metadata operation deadline | 15 seconds |
| `turn/start` admission deadline | 5 seconds |
-| Approval lifetime, local default | 120 秒后拒绝 |
+| Approval lifetime, local default | 无自动截止时间;必须明确决定或取消 |
| Approval lifetime, remote policy | 有远程订阅者接入时默认 30 分钟;Host 配置、有界,以 `approvalLifetimeMs` 公布 |
| Heartbeat interval | 30 seconds |
| Terminal output replay ring | 每终端 128 KiB |
@@ -334,7 +335,7 @@ Plan/Goal 审批为带显式 `permissionMode` 的 `approve` 或 `reject`,且
| `IDEMPOTENCY_CONFLICT` | no | 同一 key 使用了不同输入 |
| `CURSOR_EXPIRED` | no | epoch 已变化或游标不在回放窗口内 |
| `CLIENT_TOO_SLOW` | yes | 有界事件队列溢出 |
-| `APPROVAL_EXPIRED` | no | 审批已不可执行;映射自 `PERMISSION_TIMEOUT` 与 `PLAN_APPROVAL_TIMEOUT` |
+| `APPROVAL_EXPIRED` | no | 审批已不可执行;旧版本地 Host 的 `PERMISSION_TIMEOUT` 或 `PLAN_APPROVAL_TIMEOUT` 映射为此错误码,当前本地权限提示不会过期 |
| `APPROVAL_STALE` | no | 审批响应针对旧 revision |
| `PAYLOAD_TOO_LARGE` | no | 请求、事件或附件超限 |
| `RATE_LIMITED` | yes | 主体、会话或 Host 超额 |
diff --git a/docs/zh-CN/spec/04-ux/03-permission-ux.md b/docs/zh-CN/spec/04-ux/03-permission-ux.md
index e974e3aff..22a66f296 100644
--- a/docs/zh-CN/spec/04-ux/03-permission-ux.md
+++ b/docs/zh-CN/spec/04-ux/03-permission-ux.md
@@ -42,7 +42,6 @@ MVP 中没有 `allow-always`。
pending → allowed_once
pending → allowed_session
pending → denied
-pending → timeout_denied
```
- 请求由 `sessionId` 和 `requestId` 键入。
@@ -52,12 +51,12 @@ pending → timeout_denied
- 替换或解决一个请求永远不会删除另一个会话的请求
或同一会话中的新请求。
-## 5. 超时
+## 5. 等待行为
-- 默认超时:**120 秒**
-- 超时:自动 `deny`
-- UI 明确显示超时状态
-- Agent 收到工具错误结果:用户拒绝/超时
+- 本地权限卡没有自动截止时间或倒计时。
+- 请求会一直保持待处理,直到允许一次、允许会话、拒绝、取消或主机/进程关闭。
+- 批准后仍执行工具自身的超时限制。
+- Agent 只会在明确拒绝、取消或主机/进程失败时收到拒绝结果。
## 6. 卡片内容要求
@@ -73,7 +72,7 @@ pending → timeout_denied
该卡仅在其原始会话的记录中内联呈现。
后台请求保持挂起状态,无需打开覆盖层,更改
活动 page/project/session,或移动键盘焦点。打开该会话
-亮出其卡牌,上面有原来的绝对倒计时期限。
+会显示仍在等待的卡片。
解决请求永远不会启动导航。任何生成的工具工件都是
记录在同一会话保留的工作面板上下文中。如果该会话是
@@ -93,11 +92,9 @@ open/close 循环介入对话。
无形地;他们的代表仍然受阻,这是预期的背压。
- 答案按 `requestId` 匹配,而不是按位置匹配,因此迟到的答案可以
只能清除它所回答的请求,而永远无法解决后继者。
-- 主机自行关闭的请求(过期、取消的工具调用)被删除
+- 主机自行关闭的请求(取消的工具调用)被删除
`toolCallId` 来自队列中的任何位置,因此一张从未显示过的卡片仍然存在
- 叶子。 120 秒的截止时间 (§5) 从每个请求到达时算起,无论是排队的还是
- not — 因此,请求可能会在等待期间过期,并且主机自己会拒绝
- 是代表所看到的。
+ 叶子。排队请求不会在等待期间过期。
- 中止拒绝**整个**队列,而不仅仅是可见的卡:排队的委托
否则将在用户已经请求的停止之后保持其工具调用处于活动状态
为.
@@ -180,7 +177,7 @@ approved/completed,或中断的终端卡。这样的卡可能会保留
2.“Ask”和“Accept”编辑下的 Plan 和 Goal Bash 提示,无需确认即可运行
在自动下,突变权衡可见
3、Agent模式使用普通高危权限策略
-4. UI + 工具结果中的超时变为拒绝
+4. 未回答的本地权限会一直保持待处理,直到明确决定或取消;批准后的工具执行预算仍然生效
5.allow-session 仅抑制相同 toolName 的重复提示
6.并发会话请求保持隔离,永远不会接管可见的
对话或其工作小组;批准后工件仍分配给
diff --git a/docs/zh-CN/spec/04-ux/08-component-spec.md b/docs/zh-CN/spec/04-ux/08-component-spec.md
index 7164f9cc9..4b1e3e1c1 100644
--- a/docs/zh-CN/spec/04-ux/08-component-spec.md
+++ b/docs/zh-CN/spec/04-ux/08-component-spec.md
@@ -1832,7 +1832,6 @@ pi-ai 结果信封携带 `details` 中的结构化有效负载并重复它
| 工作空间:/Users/dev/project |
| ─────────────────────────── |
| [允许一次] [允许会话] [拒绝] |
-| 超时:120秒倒计时 |
+----------------------------------------------+
```
@@ -1846,27 +1845,25 @@ pi-ai 结果信封携带 `details` 中的结构化有效负载并重复它
- 仅挂载活动会话的待处理请求。后台请求
保持会话键控渲染器状态,而不将内容插入到
可见的文字记录或覆盖另一个目的地。
-- 不同的会话可能各自持有一个待处理的请求。分辨率、超时、
+- 不同的会话可能各自持有一个待处理的请求。分辨率、取消、
中止、工具完成和会话删除仅清除匹配的
请求。
-- 倒计时使用请求的绝对接收时间,并且不会在以下时间重新开始
- 用户切换离开并返回。
+- 用户切换离开并返回时,待处理请求仍然存在;它没有倒计时或过期时间。
### 10.4 状态
| 状态 | 外观 | 行动 |
|---|---|---|
-| 待定 | 警告重音,倒计时可见 | 允许一次/允许会话/拒绝按钮处于活动状态 |
+| 待定 | 警告重音 | 允许一次/允许会话/拒绝按钮处于活动状态 |
| 解决 | 保留待出庭 | 在请求解决之前,所有三个按钮均被禁用 |
| 允许一次 | 成功边框,“允许(一次)”标签 | 没有动作 |
| 允许的会话 | 成功边框,“允许(会话)”标签 | 没有动作 |
| 被拒绝 | 错误边框,“拒绝”标签 | 没有动作 |
-| 超时被拒绝 | 警告边框,“拒绝(超时)”标签 | 没有动作 |
### 10.5 互动
- 按钮:主要(允许一次)、次要(允许会话)、危险(拒绝)
-- 倒计时:可见计时器从 120 秒递减
+- 不显示倒计时;卡片会一直保持待处理,直到明确决定或取消。
- 第一个操作锁定所有按钮。解决错误使用错误提示;
成功或失败的完成会将焦点返回到当前输入框。
- 原始会话的输入框无法在等待许可期间发送,
@@ -1879,7 +1876,7 @@ pi-ai 结果信封携带 `details` 中的结构化有效负载并重复它
礼貌的实时公告,因此每秒计时器不会重新公告
- 按钮清楚地标记并且可以按正常的转录选项卡顺序访问;的
卡永远不会捕获或强制移动焦点
-- 定期(每 30 秒)或根据要求宣布倒计时
+- 不宣布每秒变化的倒计时;静态标题提供礼貌的实时提示
### 10.7 MVP 约束
@@ -2799,7 +2796,7 @@ Sidebar footer Popover (360px max)
具有 1-7 行草稿增长的紧凑型输入框)匹配规范
4. 聊天消息最大宽度限制为 720px
5. ToolCallCard 根据 [01-ui-ia.md](/zh-CN/spec/04-ux/01-ui-ia) §5 显示状态、参数预览、结果预览、持续时间
-6. PermissionCard 显示工具名称、风险、参数、倒计时和每个 [03-permission-ux.md](/zh-CN/spec/04-ux/03-permission-ux) 的三个操作按钮
+6. PermissionCard 显示工具名称、风险、参数和 [03-permission-ux.md](/zh-CN/spec/04-ux/03-permission-ux) 的三个操作按钮
7. Composer:开启回车发送时 Enter 发送;关闭后 Cmd/Ctrl+Enter 发送、Enter 换行;
Shift+Enter 始终换行。草稿从一增长到七条可见线后滚动;单一提交槽位在有内容时或空闲/空草稿时显示发送,仅在运行中且草稿为空时显示停止
8. Composer 模型 × 推理芯片显示 provider/model 对;流期间仍可作为下一回合
diff --git a/docs/zh-CN/spec/04-ux/09-interaction-patterns.md b/docs/zh-CN/spec/04-ux/09-interaction-patterns.md
index f99a60f65..46c293d40 100644
--- a/docs/zh-CN/spec/04-ux/09-interaction-patterns.md
+++ b/docs/zh-CN/spec/04-ux/09-interaction-patterns.md
@@ -739,7 +739,6 @@
Agent calls a permission-gated tool (including Plan/Goal Bash under Ask or Accept edits)
→ PermissionCard inserted inline in transcript
→ Composer disabled (cannot send new prompt)
- → Countdown starts (120s)
→ User responds: Allow once / Allow session / Deny
→ Card transitions to resolved state
→ Composer re-enabled
@@ -751,8 +750,8 @@ Agent calls a permission-gated tool (including Plan/Goal Bash under Ask or Accep
- 每个会话最多有一张活动权限卡,因为该代理会循环
已暂停;多个会话可以独立等待。
- 中止仅取消活动会话的待处理权限。
-- 超时(从原始接收开始 120 秒)仅自动拒绝匹配的请求;
-切换会话永远不会重置截止日期。
+- 未回答的请求会一直保持待处理;切换会话不会移除或重置它。
+ 明确取消仍只清除匹配的请求。
### 5. 3 权限期间的焦点管理
@@ -1186,7 +1185,7 @@ Mode/provider/model/permission/shell 配置和新提示仍然存在
3. Abort 立即取消正在运行的回合和挂起的权限,无需确认对话框
4.长内容(>50行消息,>10行参数,>20行结果)默认通过展开链接折叠
5. 被切断的工具结果按 D306 显示截断标记或芯片;更长文件上已填满的 Read 窗口不显示
-6.权限中断插入内联卡,禁用composer,显示倒计时,解决后重新启用
+6.权限中断插入内联卡,禁用 composer,明确解决或取消后重新启用
7. 用于短暂后台操作的Toast;用于特定于上下文的失败的内联错误
8. 会话切换、消息发送、权限解析、中止后焦点返回到composer
9.后台消息、工具、完成、权限事件永不改变
diff --git a/docs/zh-CN/spec/05-security/02-remote-control-security.md b/docs/zh-CN/spec/05-security/02-remote-control-security.md
index 920b263c4..12127b586 100644
--- a/docs/zh-CN/spec/05-security/02-remote-control-security.md
+++ b/docs/zh-CN/spec/05-security/02-remote-control-security.md
@@ -128,9 +128,8 @@ MCP 服务器和不需要会话工作区的插件工具;中继工具在桌面
执行,绝不在 Host 运行、绝不针对远程工作区,Host 的权限决定先于中继请求,Host 只传
Agent 的参数不传 secret,中继连接丢失则工具失败而回合继续。会话终端是以 `pi-host`
用户身份在 Host 机器上运行的 shell,工作目录为会话根,只有 SSH 配对的 owner 设备或
-持有显式 `terminal` scope 的主体可以打开。provider secret 在任何方向都不经过 RACP。审批寿命是 Host 策略:本地默认仍是 120 秒后拒绝,有远程订阅者接入时默认
-30 分钟(D375),Host 可在上限内调整,被阻塞的工具在本地或远程任一决定先到之前
-一直等待,断线不会延长它。
+持有显式 `terminal` scope 的主体可以打开。provider secret 在任何方向都不经过 RACP。审批寿命是 Host 策略:本地桌面权限确认没有自动截止时间;有远程订阅者接入时,远程审批记录默认
+30 分钟(D375),Host 可在上限内调整,断线不会延长它。
审计记录包含 principal、tenant、Host、clientConnectionId、Session、Turn、
operation、准入模式与 `effectivePermissionMode`、授权决定、epoch 与序号范围,
diff --git a/docs/zh-CN/spec/06-delivery/02-acceptance-criteria.md b/docs/zh-CN/spec/06-delivery/02-acceptance-criteria.md
index 73b5c4f68..ee1c7357c 100644
--- a/docs/zh-CN/spec/06-delivery/02-acceptance-criteria.md
+++ b/docs/zh-CN/spec/06-delivery/02-acceptance-criteria.md
@@ -51,7 +51,7 @@ MVP 在以下情况下通过:
- [x] Plan 和 Goal Ask/Accept 下的 Bash 提示编辑并运行而无需确认
在显式 Auto — auto:`test:e2e:plan` E2E-105 + host-core 权限测试下
- [x] Agent 模式使用 Write/Edit/Bash 的权限策略 — 手册:M3
-- [x] 权限超时(120s)变为拒绝 — 手动:M3 (D005)
+- [x] 本地权限卡片会一直保持待处理,直到明确决定或取消;批准后的工具执行预算仍然生效 — 单元/host-core:issue #1214 (D636)
- [x] Read/Glob/Grep 在项目内部工作 — auto:`test:e2e`(glob 工具)
- [x] Write/Edit/Bash 触发内联、会话范围的确认卡 — 手册:M3
- [x] 后台事件和权限请求永远不会激活或覆盖其他事件
diff --git a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
index d32b5063f..b313db95b 100644
--- a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
@@ -899,14 +899,14 @@ task-candidate E2E 从请求工作树运行,但使用主工作区已经准备
- **里程碑**:M3
- **状态**:自动化(协议烟雾:示例项目中的 Read + Glob)
-### 权限允许/拒绝/超时
+### 权限允许/拒绝/取消
#### E2E-014:Write/Edit/Bash 触发权限卡
- **先决条件**:Agent 模式;项目开放。
- **步骤**: 1) 要求代理写入文件。 2)遵守许可卡。
- **预期**:许可卡内联显示在原始成绩单中
- 包含工具名称、工作区、参数预览、倒计时和 allow/deny
+ 包含工具名称、工作区、参数预览和 allow/deny
选项。它不创建背景或模式,也不覆盖其他会话。
- **链接规格**:`04-ux/03-permission-ux.md`、`03-runtime/03-tools-and-permissions.md`
- **接受**:E(Write/Edit/Bash 触发确认)
@@ -933,13 +933,13 @@ task-candidate E2E 从请求工作树运行,但使用主工作区已经准备
- **里程碑**:M3
- **状态**:草案
-#### E2E-017:权限超时默认为拒绝
+#### E2E-017:本地权限确认没有自动截止时间
- **前提条件**:显示许可卡;没有用户操作。
-- **步骤**: 1) 等待 120 秒而不响应权限卡。 2)观察结果。
-- **预期**:超时后自动拒绝权限;工具未执行。
+- **步骤**:1) 不响应权限卡。2) 确认卡片仍可见且工具仍在等待。3) 点击拒绝并观察结果。
+- **预期**:没有倒计时或自动拒绝;请求会一直等到明确拒绝,工具不会执行。
- **链接规格**:`03-runtime/03-tools-and-permissions.md`
-- **接受**:E(超时→拒绝)
+- **接受**:E(无倒计时,明确决定→结果)
- **里程碑**:M3
- **状态**:草案
@@ -3229,7 +3229,7 @@ IPC 请求无法关闭。
- **预期**:B的后台事件仅更新B的行和保留状态;
他们不会更改 A 的活动 session/project/page、记录、草稿、卷轴、
或键盘焦点,并且不会出现全局模式。打开 B 仅显示 B
- 内联卡及其原始倒计时。两个请求保持独立
+ 内联卡且没有倒计时。两个请求保持独立
可操作,并且解决B并没有清除A。最终的快速选择保持不变
即使 A 的较旧负载稍后完成,也会在 B 上执行。仅明确通知或
会话激活可以导航。 A 的批准后审阅卡仅保留在
@@ -3242,7 +3242,7 @@ IPC 请求无法关闭。
- **验收**:C(会话隔离)、E(权限隔离)、质量
- **里程碑**:M5
- **状态**:单位覆盖(`permission-inline.test.mjs` 表示作用域状态,
- 内嵌渲染契约、绝对倒计时、最新选择守护;
+ 内嵌渲染契约、无倒计时行为、最新选择守护;
用于会话范围的 `work-panel.test.mjs` 和 `browser-preview-tool.test.mjs`
工件保留和路由);完整的 UI 场景草稿
@@ -6233,8 +6233,7 @@ eleven-tool-round desktop paths are verified by
- 没有背景、模态、page/session 开关、工作面板隐藏、转录
A 中的替换或输入框焦点更改。B 保留其挂起状态。
- 明确打开 B 并期望在 B 最新的之后有一张内联权限卡
- 活动,具有可读的风险、参数、工作区、倒计时和包装操作
- 控制。切换回来可以保留绝对期限。
+ 活动,具有可读的风险、参数、工作区和包装操作控制。切换回来仍保留待处理请求,但没有截止时间。
- 将A和B一起挂起,各自独立解决,并且都不确认
操作删除或更改另一张卡。
- 解析A的Write/Edit权限,完成前切换到B。预计不会
diff --git a/docs/zh-CN/spec/07-plugins/12-plugin-ipc-and-host-services.md b/docs/zh-CN/spec/07-plugins/12-plugin-ipc-and-host-services.md
index 187123e23..d5b18d225 100644
--- a/docs/zh-CN/spec/07-plugins/12-plugin-ipc-and-host-services.md
+++ b/docs/zh-CN/spec/07-plugins/12-plugin-ipc-and-host-services.md
@@ -202,7 +202,7 @@ toast 加上 `pluginChanged` 到渲染器。
1.模型调用`plugin_<pluginIdSafe>_<toolName>`; sidecar 转发它
像任何内置工具一样托管 `tools.execute`。
2. host-core 首先解析持久操作模式。在 Agent 中,它运行
- 正常权限流程(风险、会话授予、120 秒超时),然后发出
+ 正常权限流程(风险、会话授予、无自动截止时间),然后发出
通知 `plugins.execute`
`{ executionId, sessionId, toolCallId, toolName, args, turnId }`。`turnId` 是
运行时回合身份,原样转发,以便插件工具上下文能与
@@ -216,8 +216,8 @@ toast 加上 `pluginChanged` 到渲染器。
(`DESKTOP_TOOL_DISPATCH_TIMEOUT_MS`,高于 110 秒的插件工具预算,也高于最宽的
MCP 支路:10 秒惰性握手 + 30 秒 `tools/list` 遍历 + 100 秒调用),超时映射到
`TOOL_TIMEOUT`;unknown/unloaded 工具映射到 `TOOL_NOT_FOUND`。这类调用的传输截止
- 时间覆盖 120 秒权限等待、30 秒准入排队、上述调度和 10 秒余量(`rpcTimeoutMs`),
- 因此外层不会在 host-core 报告结果之前先放弃。
+ 等待明确权限决定时,`tools.execute` 传输没有截止时间;批准后仍以 host-core 的工具
+ 执行预算为准。
面向模型的注册表根据提示获得插件工具:已注册主要通道
defs(`fullName`、描述、JSON 架构参数)到 `agent.prompt`,以及
diff --git a/docs/zh-CN/spec/08-meta/decisions-log.md b/docs/zh-CN/spec/08-meta/decisions-log.md
index 26c4443f6..08c3fc17c 100644
--- a/docs/zh-CN/spec/08-meta/decisions-log.md
+++ b/docs/zh-CN/spec/08-meta/decisions-log.md
@@ -17,7 +17,7 @@
| D002 | SQLite 所有权 | **Rust host-core 独家拥有 SQLite** | 单写入者,权限边界更清晰 |
| D003 | 默认模式 | **Agent** | 产品是座席桌面,不是纯聊天 |
| D004 | 前受限个人资料 | *(由 D189 取代)* **以前的聊天只读配置文件已删除;持久的聊天值迁移到 Plan。** | 该产品现在有一个 Agent,具有规划状态和单独的批准边界 |
-| D005 | 权限超时 | **120秒→拒绝** | 失败关闭,不会永远挂起 |
+| D005 | 权限超时 | *(由 D636 / ADR 0310 修订)* **本地权限确认没有自动截止时间;必须明确决定或取消** | 避免用户未注意到卡片时被意外拒绝 |
| D006 | `allow-session` 范围 | **由 `toolName` 提供** | 简单的用户体验;工作区沙箱仍然强制路径安全 |
| D007 | `~/.pi` 兼容性 | **MVP 中没有自动导入** | 在 `~/.pi-desktop` 中保持配置所有权干净 |
| D008 | Node 运行时打包 | **开发人员使用系统 Node;版本通过 `ELECTRON_RUN_AS_NODE=1` 在 Electron 二进制文件上运行捆绑的 sidecar(未提供单独的 Node)** | 疏通M1–M4;在 M5 处解决,请参阅 03-runtime/07-process-model §6 |
@@ -33,6 +33,7 @@
| D457 | 已签名 macOS DMG 改为双图标安装 | *(由 D634 修订)* **修订 D406 / ADR 0232 / ADR 0204:正式与本地 DMG 只包含 PI-Desktop.app 和 Applications 链接,使用 720×440 品牌背景。ZIP 只包含 PI-Desktop.app。任何 macOS 格式(包括未签名调试工件)都不再附带打开说明或 command 助手。见 ADR 0296 / ADR 0309 与 E2E-196b。** | 标签 DMG 已签名公证(D450);打包工件不再需要未签名首次启动指引。 |
| D634 | 移除 macOS 首次启动辅助文件 | **修订 D457 / ADR 0296 及 ADR 0232 / ADR 0204 中的 macOS 分发约定:macOS DMG 与 ZIP 均不再附带 `PI-Desktop-macOS-open.command`、`PI-Desktop-macOS-opening-help.txt`,或其他捆绑的 quarantine 清理助手/打开说明。ZIP 根目录只包含 `PI-Desktop.app`;DMG 仍为双图标安装。该规定适用于签名发布和本地或可选的未签名调试构建。见 ADR 0309 与 E2E-196b。** | 已签名发布通道不再需要未签名首次启动兜底;随调试包附带此类文件可能误导用户绕过 Gatekeeper。 |
| D635 | 按工作区上限裁剪的 800×560 窗口最小尺寸 | **取代 D156 / D447 中的 1040×700 窗口最小尺寸(及 ADR 0029 / ADR 0238 的对应条款)和 `window/setWorkPanelChatWidth` 的 `1040..10000` 范围(ADR 0146):Electron 强制 800×560 最小尺寸,并由 `clampMinimumSizeToWorkArea` 按维度裁剪到当前显示器工作区。聊天宽度 IPC 与渲染层接受 `800..10000`。窄窗口下沿用现有 `workPanelLayout` 预算:限制停靠面板宽度以保证 MainChat 的 450px 下限,并优先收起侧边栏。见 US-UI-19 与 E2E-167。** | Windows 150% 缩放下工作区约为 1280×672 DIP,固定最小尺寸可能超过屏幕,导致窗口无法适配。 |
+| D636 | 本地权限确认没有自动截止时间 | **修订 D005 / ADR 0011:需要权限的 `tools.execute` 请求会在 host-core、渲染层和传输中保持待处理,直到用户选择允许一次、允许会话或拒绝,或请求被取消/进程关闭。移除 120 秒倒计时以及本地权限契约中的超时字段。工具自身执行预算以及独立的 RACP/Plan 审批时限保持不变。见 ADR 0310、issue #1214 与 E2E-017。** | 用户可能在其他工作期间错过可见的权限请求;保持取消和执行预算即可保留控制与资源安全,又不会把“未注意”变成一个决定。 |
| D450 | 签名的 macOS GitHub Release | **修订 D078 / ADR 0022:GitHub tag 发布使用身份 `Developer ID Application: XingYu Liu (DUV63RKYTW)` / 团队 `DUV63RKYTW`,通过 Actions 密钥(`CSC_LINK`、`CSC_KEY_PASSWORD`、`APPLE_ID`、`APPLE_APP_SPECIFIC_PASSWORD`、`APPLE_TEAM_ID`)对 macOS DMG/ZIP 做 Developer ID 签名、`notarytool` 公证、装订和 Gatekeeper 校验;缺少密钥则失败。无证书的本地未签名打包仍可用。`workflow_dispatch` 仅可把 `sign_macos: false` 用于未签名调试产物。打包的 macOS 走应用内 `electron-updater`(ZIP + 合并后的 `latest-mac.yml`);Linux deb/rpm 与 Windows 便携版 ZIP 仍为通知并打开发布页。禁止 afterPack/afterSign adhoc 签名(ADR 0278)。** | 正式 DMG 应无需 Gatekeeper 警告即可打开,已签名 macOS 安装可下载并重启到新 tag。见 ADR 0289、E2E-196c、E2E-067A。 |
## B. 辅助实现默认值
@@ -237,7 +238,7 @@
| D098 | Review 选项卡读取 git 工作树 *(由 D180 取代)* | **历史性决定:通过 git CLI 审核呈现工作区的未提交状态。** | 被取代,因为提交删除了消息级证据并且无法支持安全的每消息回滚 |
| D099 | 终端选项卡是真正的 PTY(已由 D251 取代) | **历史决策:旧版工作面板曾提供按会话范围保留的交互式 shell 选项卡。** | 当前产品移除了独立 shell 表面;Agent Bash 仍是非交互式并归对话所有 |
| D100 | 浏览器选项卡嵌入 WebContentsView | **预览浏览器是一个主进程 WebContentsView,具有渲染器驱动的边界同步、强化(拒绝弹出窗口→外部、拒绝权限请求、仅限 http(s) 导航、隔离持久分区);当阻止覆盖(调色板、权限对话框、设置)打开时它会隐藏。用户驾驶它;代理没有。** | 推荐现代嵌入,无需 webview-tag 警告;隐藏规则通过渲染器覆盖解析其合成器 z 顺序 |
-| D138 | 会话范围的内联权限请求 | **工具批准是其原始 `sessionId` 拥有的内联 PermissionCard,而不是全局对话框。不同的会话保留独立的待处理请求和绝对的超时期限;后台 message/tool/permission 事件仅更新范围内的状态,并且从不激活、覆盖或聚焦其他对话。解析和清理与会话和请求身份相匹配。这仅取代 D100 的权限对话框 overlay/hide 子句;调色板、搜索、设置和其他阻塞表面保留其现有的浏览器隐藏行为。** | 并发代理不得窃取活动工作流程或覆盖彼此的批准请求;现有协议已携带所需的 session/request 身份。 |
+| D138 | 会话范围的内联权限请求 | **工具批准是其原始 `sessionId` 拥有的内联 PermissionCard,而不是全局对话框。不同的会话保留独立的待处理请求且没有自动截止时间;后台 message/tool/permission 事件仅更新范围内的状态,并且从不激活、覆盖或聚焦其他对话。解析和清理与会话和请求身份相匹配。这仅取代 D100 的权限对话框 overlay/hide 子句;调色板、搜索、设置和其他阻塞表面保留其现有的浏览器隐藏行为。** | 并发代理不得窃取活动工作流程或覆盖彼此的批准请求;现有协议已携带所需的 session/request 身份。 |
| D139 | 导航意图和快捷方式事件防护 | **每个显式会话、项目、页面、分支或历史导航都开始或重用一个渲染器导航意图;异步工作仅在该意图保持当前状态时提交可见状态。全局快捷键忽略仅修饰符和 IME 组合事件,而历史导航也忽略按键重复事件。** | 延迟的 session/project 加载和不完整的键盘事件不得导致无法解释的页面或历史跳转。 |
| D128 | 工件驱动的工作面板选项卡(由 D207 取代的快捷方式子句) | **工作面板没有空的手动入口点、欢迎选择器、titlebar/menu 命令或 Cmd/Ctrl+J 快捷方式。 file/URL/BrowserPreview/successful-command 工件创建并激活可关闭的顶部选项卡;成功的活动会话工作区 Write/Edit 工件创建并激活单例“审阅”选项卡。文件选项卡由词法规范化路径键入,单例工具选项卡重复数据删除,关闭活动选项卡选择其右侧邻居然后选择左侧,关闭最后一个选项卡隐藏面板,唯一的面板级控件将其折叠,而不删除保留的运行时选项卡。更改可见会话或工作区会关闭并清除选项卡,因此相关资源永远不会跨越上下文边界。启动关闭,没有任何选项卡;只有面板宽度仍然存在,而临时操作系统窗口扩展被排除在启动范围之外。后台会话、失败和临时写入不会抢走焦点。这取代了 D097 的固定选项卡入口点和 `{open, tab}` 持久性,改进了 D098 的自动刷新,并且仅取代了 D112 的welcome-chooser 子句。** | 匹配 Codex 的输出驱动工作界面,避免空工具启动器,并使每个可见选项卡对应于会话实际生成或显式预览的工作。 D128 纠正最初重复的 D119 标识符; D119 仍然是记录文件存储决策。 |
| D140 | 会话拥有的脏工作区成绩单审核条目*(由 D179 取代)* | **会话成功生成工作区 Write/Edit 后,其记录以折叠活动组之外的一个明确的“审阅更改”命令结束,而 Git 工作树仍然是脏的;同一项目中的其他会话不会继承该命令。它报告上限文件计数和 addition/deletion 总数,并创建、重新打开或激活 D128 的单个“审阅”选项卡。条目和审阅共享一个工作区键控差异,在工作区激活、成功 Write/Edit/Bash 完成(500 毫秒去抖)、显式审阅刷新和窗口焦点时刷新;排序的请求会丢弃先前的工作空间响应。干净和非 Git 结果明确了该工作区的审查所有权; clean、non-Git、missing-workspace 和 failed-refresh 状态会隐藏该条目。审查所有权是在使用 D142 工作面板上下文重新启动时丢弃的渲染器内存状态。这是上下文 artifact/status 条目,而不是 D128 禁止的空手动启动器。** | 自动面板打开在折叠或选项卡关闭后不会留下可发现的返回路径,而会话所有权可防止不相关的对话声明项目范围的编辑。共享真实的差异可以使对话条目准确并保持评论的重复数据。 |
@@ -5144,3 +5145,13 @@ Markdown 源码,不是 `text/html` 负载;对禁用行内 HTML 的外部编
- D635 取代 D156 / D447 中的 1040×700 最小尺寸(及 ADR 0029 / ADR 0238 的对应条款)
和 ADR 0146 中 `1040..10000` 的聊天宽度范围。`work-panel-window.test.mjs` 与
`work-panel-resize.test.mjs` 覆盖裁剪与聊天宽度范围;见 US-UI-19 与 E2E-167。
+
+## 2026-09-29 —— 本地权限确认一直保持待处理直到解决(D636)
+
+- D636 针对本地桌面权限门控修订 D005 / ADR 0011。需要权限的
+ `tools.execute` 请求没有自动截止时间:host-core 保留其
+ `permissions.pending` 状态,渲染层保留内联卡片,传输不安装计时器。
+ 允许一次、允许会话、拒绝、明确取消和进程关闭仍是解决路径。
+- 权限请求不再携带 `timeoutMs`;pending 快照不再暴露 `expiresAt` 或
+ `remainingMs`,UI 也不再显示倒计时。工具自身的命令/插件执行预算以及独立的
+ Plan/Goal 和 RACP 审批时限保持不变。见 ADR 0310、issue #1214 与 E2E-017。
diff --git a/docs/zh-CN/spec/README.md b/docs/zh-CN/spec/README.md
index b5e1e7bf9..c1be35dca 100644
--- a/docs/zh-CN/spec/README.md
+++ b/docs/zh-CN/spec/README.md
@@ -95,7 +95,7 @@ docs/spec/
9. 协议 v11 和存储架构 v15 对 Plan/Goal 检查点、
`plan_approvals` 执行字段、启动中断和外壳身份具有权威性。
v11 撤回 v10 添加的 A2A 方法域。
-10、权限超时120s拒绝; Bash 超时默认 60 秒
+10、本地权限确认无自动截止时间;Bash 超时默认 60 秒
11.本地用户可安装的插件(稍后上市)
12. 标签版本 = macOS arm64、Intel x64、Windows x64 和 Linux x64 (D126/D285)
13. 通用 provider/model 覆盖范围(原生 + OpenAI 兼容 + 定制)
diff --git a/packages/agent-host/src/approvals.ts b/packages/agent-host/src/approvals.ts
index 3809a45d2..61ab7479e 100644
--- a/packages/agent-host/src/approvals.ts
+++ b/packages/agent-host/src/approvals.ts
@@ -32,7 +32,7 @@ export interface ApprovalPort {
export type PendingToolRequest = ToolPermissionRequest & {
createdAt: string;
- expiresAt: string;
+ expiresAt?: string;
};
type PendingApproval = {
@@ -120,7 +120,10 @@ export class ApprovalBroker {
): Promise<RacpApprovalRequest[]> {
const open = await this.port.listPendingTools(sessionId);
return open.map((request) =>
- this.fromToolPermission(request, { ...context, expiresAt: request.expiresAt }),
+ this.fromToolPermission(
+ request,
+ request.expiresAt ? { ...context, expiresAt: request.expiresAt } : context,
+ ),
);
}
diff --git a/packages/agent-runtime/src/parent-host-proxy.test.ts b/packages/agent-runtime/src/parent-host-proxy.test.ts
index 839295dcd..57007613f 100644
--- a/packages/agent-runtime/src/parent-host-proxy.test.ts
+++ b/packages/agent-runtime/src/parent-host-proxy.test.ts
@@ -47,7 +47,7 @@ describe("ParentHostProxy RPC deadlines", () => {
}
});
- it("bounds the default Bash command deadline until the host responds", async () => {
+ it("keeps a prompted Bash call open until the host responds", async () => {
vi.useFakeTimers();
const stdout = stubStdout();
try {
@@ -64,7 +64,7 @@ describe("ParentHostProxy RPC deadlines", () => {
},
);
- await vi.advanceTimersByTimeAsync(189_999);
+ await vi.advanceTimersByTimeAsync(10 * 60_000);
expect(settled).toBe(false);
proxy.handleParentMessage({ id: request.id, result: { ok: true } });
await expect(pending).resolves.toEqual({ ok: true });
@@ -74,7 +74,7 @@ describe("ParentHostProxy RPC deadlines", () => {
}
});
- it("adds permission and buffer time to explicit Bash command timeouts", async () => {
+ it("does not apply a transport deadline to explicit Bash command timeouts", async () => {
vi.useFakeTimers();
const stdout = stubStdout();
try {
@@ -84,11 +84,19 @@ describe("ParentHostProxy RPC deadlines", () => {
timeoutMs: 1_000,
});
const request = JSON.parse(String(stdout.mock.calls[0][0]));
- const rejection = expect(pending).rejects.toThrow("parent host proxy timeout");
-
- await vi.advanceTimersByTimeAsync(131_000);
- await expect(Promise.resolve()).resolves.toBeUndefined();
- await rejection;
+ let settled = false;
+ void pending.then(
+ () => {
+ settled = true;
+ },
+ () => {
+ settled = true;
+ },
+ );
+ await vi.advanceTimersByTimeAsync(10 * 60_000);
+ expect(settled).toBe(false);
+ proxy.handleParentMessage({ id: request.id, result: { ok: true } });
+ await expect(pending).resolves.toEqual({ ok: true });
expect(request.params.method).toBe("tools.execute");
await proxy.dispose();
} finally {
diff --git a/packages/agent-runtime/src/parent-host-proxy.ts b/packages/agent-runtime/src/parent-host-proxy.ts
index f44991993..4329435c1 100644
--- a/packages/agent-runtime/src/parent-host-proxy.ts
+++ b/packages/agent-runtime/src/parent-host-proxy.ts
@@ -106,12 +106,14 @@ export class ParentHostProxy {
params: { method, params },
}) + "\n";
return new Promise<T>((resolve, reject) => {
- const timer = setTimeout(() => {
- if (this.pending.has(id)) {
- this.pending.delete(id);
- reject(new Error(`parent host proxy timeout: ${method}`));
- }
- }, deadlineMs);
+ const timer = deadlineMs === undefined
+ ? undefined
+ : setTimeout(() => {
+ if (this.pending.has(id)) {
+ this.pending.delete(id);
+ reject(new Error(`parent host proxy timeout: ${method}`));
+ }
+ }, deadlineMs);
this.pending.set(id, {
resolve: resolve as (v: any) => void,
reject,
diff --git a/packages/i18n/src/locales/de/index.ts b/packages/i18n/src/locales/de/index.ts
index c1475e7a9..7d16c17db 100644
--- a/packages/i18n/src/locales/de/index.ts
+++ b/packages/i18n/src/locales/de/index.ts
@@ -1735,7 +1735,6 @@ sklm: {
},
"workspace": "Projekt: {{workspace}}",
"temporarySession": "Temporärer Chat",
- "countdown": "Automatische Ablehnung in {{seconds}}s, wenn Sie nicht antworten",
"fromSubagent": "Gefragt vom {{agent}}-Subagenten",
"queued_one": "{{count}} weitere Anfragen warten",
"queued_other": "{{count}} weitere Anfragen warten"
diff --git a/packages/i18n/src/locales/en/index.ts b/packages/i18n/src/locales/en/index.ts
index c158291e1..80329309b 100644
--- a/packages/i18n/src/locales/en/index.ts
+++ b/packages/i18n/src/locales/en/index.ts
@@ -1753,7 +1753,6 @@ sklm: {
},
workspace: "Project: {{workspace}}",
temporarySession: "Temporary chat",
- countdown: "Auto-denies in {{seconds}}s if you don't respond",
fromSubagent: "Asked by the {{agent}} subagent",
queued_one: "{{count}} more request is waiting",
queued_other: "{{count}} more requests are waiting",
diff --git a/packages/i18n/src/locales/es/index.ts b/packages/i18n/src/locales/es/index.ts
index 9336a7bf0..2422fe8d7 100644
--- a/packages/i18n/src/locales/es/index.ts
+++ b/packages/i18n/src/locales/es/index.ts
@@ -1735,7 +1735,6 @@ sklm: {
},
"workspace": "Proyecto: {{workspace}}",
"temporarySession": "Chat temporal",
- "countdown": "Denegación automática en {{seconds}}s si no respondes",
"fromSubagent": "Pregunta del {{agent}} subagente",
"queued_one": "{{count}} solicitud más está esperando",
"queued_other": "{{count}} más solicitudes están esperando"
diff --git a/packages/i18n/src/locales/fr/index.ts b/packages/i18n/src/locales/fr/index.ts
index 0eb03b7aa..9d4240d1b 100644
--- a/packages/i18n/src/locales/fr/index.ts
+++ b/packages/i18n/src/locales/fr/index.ts
@@ -1735,7 +1735,6 @@ sklm: {
},
"workspace": "Projet : {{workspace}}",
"temporarySession": "Chat temporaire",
- "countdown": "Refus automatique dans {{seconds}}s si vous ne répondez pas",
"fromSubagent": "Demandé par le sous-agent {{agent}}",
"queued_one": "{{count}} demande supplémentaire en attente",
"queued_other": "{{count}} demande supplémentaire en attente"
diff --git a/packages/i18n/src/locales/ko/index.ts b/packages/i18n/src/locales/ko/index.ts
index 3d3ef40b7..ea8d3480d 100644
--- a/packages/i18n/src/locales/ko/index.ts
+++ b/packages/i18n/src/locales/ko/index.ts
@@ -1750,7 +1750,6 @@ sklm: {
},
workspace: "프로젝트: {{workspace}}",
temporarySession: "임시 채팅",
- countdown: "응답하지 않으면 {{seconds}}초 후 자동 거부",
fromSubagent: "{{agent}} 서브에이전트가 요청함",
queued_one: "요청 {{count}}개가 더 대기 중",
queued_other: "요청 {{count}}개가 더 대기 중",
diff --git a/packages/i18n/src/locales/pt-BR/index.ts b/packages/i18n/src/locales/pt-BR/index.ts
index 9b0cafb93..d6dbe9f46 100644
--- a/packages/i18n/src/locales/pt-BR/index.ts
+++ b/packages/i18n/src/locales/pt-BR/index.ts
@@ -1690,7 +1690,6 @@ export const ptBR = {
},
workspace: "Projeto: {{workspace}}",
temporarySession: "Conversa temporária",
- countdown: "Recusa automaticamente em {{seconds}}s se você não responder",
fromSubagent: "Solicitado pelo subagente {{agent}}",
queued_one: "Mais {{count}} solicitação aguardando",
queued_other: "Mais {{count}} solicitações aguardando",
diff --git a/packages/i18n/src/locales/tr/index.ts b/packages/i18n/src/locales/tr/index.ts
index 688c8b620..aaa474276 100644
--- a/packages/i18n/src/locales/tr/index.ts
+++ b/packages/i18n/src/locales/tr/index.ts
@@ -1740,7 +1740,6 @@ sklm: {
},
workspace: "Proje: {{workspace}}",
temporarySession: "Geçici sohbet",
- countdown: "Yanıt vermezseniz {{seconds}} sn içinde otomatik reddedilir",
fromSubagent: "{{agent}} alt ajanı sordu",
queued_one: "{{count}} istek daha bekliyor",
queued_other: "{{count}} istek daha bekliyor",
diff --git a/packages/i18n/src/locales/zh-CN/index.ts b/packages/i18n/src/locales/zh-CN/index.ts
index c47a2fc36..e58791063 100644
--- a/packages/i18n/src/locales/zh-CN/index.ts
+++ b/packages/i18n/src/locales/zh-CN/index.ts
@@ -1721,7 +1721,6 @@ sklm: {
},
workspace: "项目:{{workspace}}",
temporarySession: "临时对话",
- countdown: "若 {{seconds}} 秒内未响应将自动拒绝",
fromSubagent: "由 {{agent}} 子智能体发起",
queued_one: "还有 {{count}} 个请求在排队",
queued_other: "还有 {{count}} 个请求在排队",
diff --git a/packages/i18n/src/locales/zh-TW/index.ts b/packages/i18n/src/locales/zh-TW/index.ts
index 7043ca6c9..d55df5632 100644
--- a/packages/i18n/src/locales/zh-TW/index.ts
+++ b/packages/i18n/src/locales/zh-TW/index.ts
@@ -1721,7 +1721,6 @@ sklm: {
},
workspace: "專案:{{workspace}}",
temporarySession: "臨時對話",
- countdown: "若 {{seconds}} 秒內未響應將自動拒絕",
fromSubagent: "由 {{agent}} 子智慧體發起",
queued_one: "還有 {{count}} 個請求在排隊",
queued_other: "還有 {{count}} 個請求在排隊",
diff --git a/packages/shared/src/protocol.test.ts b/packages/shared/src/protocol.test.ts
index dc45dbb72..1b7bb2755 100644
--- a/packages/shared/src/protocol.test.ts
+++ b/packages/shared/src/protocol.test.ts
@@ -236,27 +236,13 @@ describe("Plan protocol contracts", () => {
).toBe(false);
});
- it("derives transport deadlines from command execution semantics", () => {
- expect(rpcTimeoutMs("tools.execute", { toolName: "Bash" })).toBe(190_000);
+ it("leaves tool approval transport open until the user decides", () => {
+ expect(rpcTimeoutMs("tools.execute", { toolName: "Bash" })).toBeUndefined();
expect(
- rpcTimeoutMs("tools.execute", { toolName: "Bash", timeoutMs: 5_000 }),
- ).toBe(135_000);
- expect(
- rpcTimeoutMs("tools.execute", { toolName: "Bash", timeoutMs: 60_000 }),
- ).toBe(190_000);
- expect(
- rpcTimeoutMs("tools.execute", { toolName: "Bash", timeoutMs: 0 }),
- ).toBe(190_000);
- expect(
- rpcTimeoutMs("tools.execute", {
- toolName: "Bash",
- timeoutMs: 2_147_483_647,
- }),
- ).toBe(2_147_483_647);
- expect(rpcTimeoutMs("tools.execute", { toolName: "Read" })).toBe(130_000);
- expect(rpcTimeoutMs("tools.execute", { toolName: "BrowserPreview" })).toBe(
- 130_000,
- );
+ rpcTimeoutMs("tools.execute", { toolName: "plugin_advisor_ask", timeoutMs: 5_000 }),
+ ).toBeUndefined();
+ expect(rpcTimeoutMs("tools.execute", { toolName: "Read" })).toBeUndefined();
+ expect(rpcTimeoutMs("tools.execute", { toolName: "BrowserPreview" })).toBeUndefined();
expect(rpcTimeoutMs("tools.abort", { sessionId: "s", toolCallId: "t" })).toBe(
130_000,
);
@@ -284,28 +270,6 @@ describe("Plan protocol contracts", () => {
expect(rpcTimeoutMs("agent.getStatus", { sessionId: "s" })).toBe(130_000);
});
- it("covers the permission wait, the admission queue, and host-core dispatch", () => {
- // Permission (120s) + admission queue (30s) + host-core dispatch (150s) +
- // slack (10s). A flat 130s would cut off a prompted plugin tool that is
- // still inside its budget, and dropping the queue wait would cut off a call
- // that had to wait for a saturated plugin class before it was dispatched.
- expect(rpcTimeoutMs("tools.execute", { toolName: "plugin_advisor_ask" })).toBe(
- 310_000,
- );
- expect(rpcTimeoutMs("tools.execute", { toolName: "mcp_github_search" })).toBe(
- 310_000,
- );
- expect(
- rpcTimeoutMs("tools.execute", {
- toolName: "plugin_advisor_ask",
- timeoutMs: 5_000,
- }),
- ).toBe(165_000);
- expect(
- rpcTimeoutMs("tools.execute", { toolName: "plugin_advisor_ask", timeoutMs: 0 }),
- ).toBe(310_000);
- });
-
it("lets a whole cloud sync finish instead of failing on a lost reply", () => {
// The sync is one request that answers only when every phase is done, and
// the host keeps running after a transport deadline fires. The progress
diff --git a/packages/shared/src/rpc-timeouts.ts b/packages/shared/src/rpc-timeouts.ts
index b754263e2..e34c25d28 100644
--- a/packages/shared/src/rpc-timeouts.ts
+++ b/packages/shared/src/rpc-timeouts.ts
@@ -1,16 +1,10 @@
-import { IMAGE_BATCH_TIMEOUT_MS } from "./image-generation.js";
-
export const DEFAULT_RPC_TIMEOUT_MS = 130_000;
-export const PERMISSION_TIMEOUT_MS = 120_000;
export const DEFAULT_COMMAND_TIMEOUT_MS = 60_000;
export const COMMAND_RPC_BUFFER_MS = 10_000;
-export const DEFAULT_BASH_RPC_TIMEOUT_MS =
- PERMISSION_TIMEOUT_MS + DEFAULT_COMMAND_TIMEOUT_MS + COMMAND_RPC_BUFFER_MS;
/**
* host-core's admission queue wait: what a call costs when its tool class is
- * saturated. It is spent after the permission gate and before the tool runs, so
- * a transport deadline that omits it can still give up before host-core reports
- * an outcome. Mirrors `TOOL_QUEUE_WAIT_MS` in
+ * saturated. It is spent after the permission gate and before the tool runs.
+ * Mirrors `TOOL_QUEUE_WAIT_MS` in
* `crates/host-core/src/tool_budget.rs`.
*/
export const TOOL_QUEUE_WAIT_MS = 30_000;
@@ -19,14 +13,10 @@ export const TOOL_QUEUE_WAIT_MS = 30_000;
* main executes. It outlasts every budget Electron enforces inside it: the
* plugin tool budget (110s) and the widest MCP leg, a lazy handshake plus the
* whole `tools/list` traversal plus the call (10s + 30s + 100s). Mirrors
- * `DESKTOP_TOOL_DISPATCH_TIMEOUT_MS` in `crates/host-core/src/tools/mod.rs`.
+ * `DESKTOP_TOOL_DISPATCH_TIMEOUT_MS` in `crates/host-core/src/tools/mod.rs`;
+ * the transport no longer adds this budget to a permission wait.
*/
export const DESKTOP_TOOL_DISPATCH_TIMEOUT_MS = 150_000;
-export const DEFAULT_DESKTOP_TOOL_RPC_TIMEOUT_MS =
- PERMISSION_TIMEOUT_MS +
- TOOL_QUEUE_WAIT_MS +
- DESKTOP_TOOL_DISPATCH_TIMEOUT_MS +
- COMMAND_RPC_BUFFER_MS;
/**
* The sidecar's zero-event stream watchdog. Mirrors
* `STREAM_IDLE_TIMEOUT_DEFAULT_MS` in
@@ -76,18 +66,6 @@ export const AGENT_COMPACT_RPC_TIMEOUT_MS =
* budget.
*/
export const CONFIG_SYNC_RPC_TIMEOUT_MS = 1_800_000;
-const MAX_TIMER_DELAY_MS = 2_147_483_647;
-
-function isRecord(value: unknown): value is Record<string, unknown> {
- return typeof value === "object" && value !== null && !Array.isArray(value);
-}
-
-function isDesktopDispatchedTool(toolName: unknown): boolean {
- return (
- typeof toolName === "string" &&
- (toolName.startsWith("plugin_") || toolName.startsWith("mcp_"))
- );
-}
/**
* Whether an error came from a transport deadline rather than from the peer.
@@ -100,63 +78,18 @@ export function isRpcTimeoutError(error: unknown): boolean {
}
/**
- * Return the transport deadline for an RPC call. Bash and desktop-dispatched
- * (`plugin_*` / `mcp_*`) tools include the waits host-core can spend before it
- * reports an outcome — the permission gate, the admission queue, and the
- * effective execution timeout — plus transport slack, so the transport never
- * gives up before host-core reports its own timeout. A manual context
- * checkpoint carries the same property against the sidecar's summary request
- * (`AGENT_COMPACT_RPC_TIMEOUT_MS`), and a manual cloud sync carries it against
- * the whole remote run (`CONFIG_SYNC_RPC_TIMEOUT_MS`). Every call has a finite
- * deadline so a lost response cannot leave a pending promise forever.
+ * Return the transport deadline for an RPC call. `tools.execute` can wait for
+ * an explicit user decision for an unbounded period, so its transport call has
+ * no deadline. Host-core still enforces each tool's execution budget after the
+ * permission gate, and cancellation or process shutdown still settles the
+ * request. Other long-running methods retain their explicit finite ceilings.
*/
export function rpcTimeoutMs(
method: string,
- params: unknown,
-): number {
+ _params: unknown,
+): number | undefined {
if (method === "agent.compact") return AGENT_COMPACT_RPC_TIMEOUT_MS;
if (method === "configSync.syncNow") return CONFIG_SYNC_RPC_TIMEOUT_MS;
- if (method !== "tools.execute") return DEFAULT_RPC_TIMEOUT_MS;
-
- const input = isRecord(params) ? params : undefined;
- if (input?.toolName === "GenerateImages") return IMAGE_BATCH_TIMEOUT_MS + PERMISSION_TIMEOUT_MS + TOOL_QUEUE_WAIT_MS + COMMAND_RPC_BUFFER_MS;
- if (isDesktopDispatchedTool(input?.toolName)) {
- return executionRpcTimeoutMs(
- input?.timeoutMs,
- DEFAULT_DESKTOP_TOOL_RPC_TIMEOUT_MS,
- TOOL_QUEUE_WAIT_MS,
- );
- }
- if (input?.toolName !== "Bash") return DEFAULT_RPC_TIMEOUT_MS;
- if (input?.timeoutMs === undefined) return DEFAULT_BASH_RPC_TIMEOUT_MS;
- // Bash keeps the arithmetic it shipped with (permission + command + slack):
- // the admission queue wait is deliberately not added to that path here, so
- // its existing deadline is unchanged by this change.
- return executionRpcTimeoutMs(input.timeoutMs, DEFAULT_BASH_RPC_TIMEOUT_MS);
-}
-
-/**
- * Permission wait + optional admission queue wait + execution timeout + slack,
- * or `fallbackMs` when the caller sent no usable timeout.
- */
-function executionRpcTimeoutMs(
- executionTimeoutMs: unknown,
- fallbackMs: number,
- queueWaitMs = 0,
-): number {
- if (
- typeof executionTimeoutMs !== "number" ||
- !Number.isFinite(executionTimeoutMs) ||
- executionTimeoutMs <= 0
- ) {
- return fallbackMs;
- }
-
- return Math.min(
- MAX_TIMER_DELAY_MS,
- PERMISSION_TIMEOUT_MS +
- queueWaitMs +
- Math.ceil(executionTimeoutMs) +
- COMMAND_RPC_BUFFER_MS,
- );
+ if (method === "tools.execute") return undefined;
+ return DEFAULT_RPC_TIMEOUT_MS;
}