Skip to content

Commit 0768036

Browse files
committed
Revert "refactor(agents): propagate exact attribution across runtimes"
This reverts commit df31882.
1 parent 54ea39d commit 0768036

50 files changed

Lines changed: 91 additions & 1477 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎docs/.generated/plugin-sdk-api-baseline.sha256‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ aa8a411ad37c1d1143b67376bf2d20255b9eedff61d80815f42e4f8ed7bd8e58 module/secret-
122122
57dcb1462d4c4f9a98d934c4ca975b163d704758af9821a64001ff3ac05637c3 module/secret-input-runtime
123123
dc0ee07d392a85c218939000b28c0138f139215da00f5592b34a68ba8e29a25d module/secret-ref-runtime
124124
f97549081955e412d8eb64070c64bb5921bb1324744d824db05767d3adcce403 module/security-runtime
125-
4bfa843c91a04a4cff0496ed89d9b9481c07b8dbdce6de784e2743f4f66afc1d module/session-catalog
125+
5b1e30fe228e0d8c74c11d6ad2d9aed3df80cd3ea4ba2dd63c30cc5f084e93c9 module/session-catalog
126126
50f5e344f98c27570b7a30e32a906b612e2383d21f102e88cd93e1d5425a6de9 module/session-discussion
127127
f112bdabc51ba8659b37d0a6f6a32a2b1d471e5b49b56e108bf750ec55a7ea71 module/session-store-runtime
128128
36affbe151431a6141664b6838e20f2d121ff210d57a3c1b4b41a8818b5c81d8 module/setup

‎src/agents/agent-command-execution-identity.test.ts‎

Lines changed: 0 additions & 161 deletions
This file was deleted.

‎src/agents/agent-command-execution-identity.ts‎

Lines changed: 1 addition & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ import {
44
type ExecutionIdentityAdmissionFacts,
55
} from "../audit/execution-identity-admission.js";
66
import type { OpenClawConfig } from "../config/types.openclaw.js";
7-
import { captureAgentRunLifecycleGeneration } from "../infra/agent-events.js";
8-
import { createAgentExecutionAttribution } from "./agent-execution-attribution.js";
9-
import type { AgentCommandGatewayIngressOpts, AgentCommandOpts } from "./command/types.js";
7+
import type { AgentCommandOpts } from "./command/types.js";
108

119
type AgentCommandAdmissionIngress = ExecutionIdentityAdmissionFacts["ingress"];
1210

@@ -55,74 +53,8 @@ function recordAgentCommandExecutionIdentity(params: {
5553
);
5654
}
5755

58-
function resolveAgentCommandExecutionAttribution(
59-
opts: AgentCommandOpts,
60-
params: {
61-
runId: string;
62-
sessionKey?: string;
63-
sessionId?: string;
64-
sessionAgentId?: string;
65-
},
66-
): {
67-
attribution: NonNullable<AgentCommandOpts["executionAttribution"]>;
68-
lifecycleGeneration: string;
69-
} {
70-
if (opts.executionAttribution && opts.executionAttribution.runId !== params.runId) {
71-
throw new Error("Agent command execution attribution runId does not match the command runId.");
72-
}
73-
const lifecycleGeneration =
74-
opts.executionAttribution?.lifecycleGeneration ??
75-
opts.lifecycleGeneration ??
76-
captureAgentRunLifecycleGeneration(params.runId);
77-
return {
78-
attribution:
79-
opts.executionAttribution ??
80-
createAgentExecutionAttribution({
81-
runId: params.runId,
82-
lifecycleGeneration,
83-
sessionKey: params.sessionKey,
84-
sessionId: params.sessionId,
85-
agentId: params.sessionAgentId,
86-
}),
87-
lifecycleGeneration,
88-
};
89-
}
90-
91-
function replaceAgentCommandExecutionAttribution(
92-
opts: AgentCommandOpts,
93-
attribution: AgentCommandOpts["executionAttribution"],
94-
): AgentCommandOpts {
95-
return attribution === opts.executionAttribution
96-
? opts
97-
: { ...opts, executionAttribution: attribution };
98-
}
99-
100-
function prepareAgentCommandIngress(
101-
opts: AgentCommandGatewayIngressOpts,
102-
trustedAttribution: boolean,
103-
): {
104-
lifecycleGeneration: string;
105-
opts: AgentCommandGatewayIngressOpts;
106-
} {
107-
const internalOpts: AgentCommandGatewayIngressOpts = trustedAttribution
108-
? opts
109-
: { ...opts, executionAttribution: undefined };
110-
if (typeof internalOpts.allowModelOverride !== "boolean") {
111-
throw new Error("allowModelOverride must be explicitly set for ingress agent runs.");
112-
}
113-
return {
114-
lifecycleGeneration:
115-
internalOpts.lifecycleGeneration ??
116-
captureAgentRunLifecycleGeneration(internalOpts.runId ?? ""),
117-
opts: internalOpts,
118-
};
119-
}
120-
12156
export const executionIdentity = {
12257
localIngress: LOCAL_CLI_ADMISSION_INGRESS,
123-
prepareIngress: prepareAgentCommandIngress,
12458
record: recordAgentCommandExecutionIdentity,
125-
replaceAttribution: replaceAgentCommandExecutionAttribution,
126-
resolveAttribution: resolveAgentCommandExecutionAttribution,
12759
systemIngress,
12860
};

0 commit comments

Comments
 (0)