refactor: remove permission timeout logic and rely on abort handler (#62)
This commit is contained in:
@@ -601,10 +601,8 @@ type SubAgentActionCandidate = {
|
|||||||
input: unknown;
|
input: unknown;
|
||||||
};
|
};
|
||||||
|
|
||||||
const DEFAULT_PERMISSION_TIMEOUT_MS = 120_000;
|
|
||||||
const MAX_SUB_AGENT_LOG_ENTRIES = 200;
|
const MAX_SUB_AGENT_LOG_ENTRIES = 200;
|
||||||
const MAX_SUB_AGENT_SUMMARY_CHARS = 160;
|
const MAX_SUB_AGENT_SUMMARY_CHARS = 160;
|
||||||
|
|
||||||
function isMetadata(value: unknown): value is AgentMetadata {
|
function isMetadata(value: unknown): value is AgentMetadata {
|
||||||
return typeof value === "object" && value !== null;
|
return typeof value === "object" && value !== null;
|
||||||
}
|
}
|
||||||
@@ -1670,6 +1668,7 @@ class ClaudeAgentSession implements AgentSession {
|
|||||||
if (this.cancelCurrentTurn === requestCancel) {
|
if (this.cancelCurrentTurn === requestCancel) {
|
||||||
this.cancelCurrentTurn = null;
|
this.cancelCurrentTurn = null;
|
||||||
}
|
}
|
||||||
|
this.rejectAllPendingPermissions(new Error("Permission request aborted"));
|
||||||
this.cancelRun(run, {
|
this.cancelRun(run, {
|
||||||
type: "turn_canceled",
|
type: "turn_canceled",
|
||||||
provider: "claude",
|
provider: "claude",
|
||||||
@@ -3612,19 +3611,6 @@ class ClaudeAgentSession implements AgentSession {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const timeout = setTimeout(() => {
|
|
||||||
this.pendingPermissions.delete(requestId);
|
|
||||||
cleanup();
|
|
||||||
const error = new Error("Permission request timed out");
|
|
||||||
this.pushEvent({
|
|
||||||
type: "permission_resolved",
|
|
||||||
provider: "claude",
|
|
||||||
requestId,
|
|
||||||
resolution: { behavior: "deny", message: "timeout" },
|
|
||||||
});
|
|
||||||
reject(error);
|
|
||||||
}, DEFAULT_PERMISSION_TIMEOUT_MS);
|
|
||||||
cleanupFns.push(() => clearTimeout(timeout));
|
|
||||||
|
|
||||||
const abortHandler = () => {
|
const abortHandler = () => {
|
||||||
this.pendingPermissions.delete(requestId);
|
this.pendingPermissions.delete(requestId);
|
||||||
|
|||||||
Reference in New Issue
Block a user