Skip to content

Commit 80ed553

Browse files
committed
fix(tasks): restore owner-key task scope
1 parent 5fdde9b commit 80ed553

6 files changed

Lines changed: 290 additions & 148 deletions

File tree

src/acp/control-plane/manager.core.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1887,7 +1887,8 @@ export class AcpSessionManager {
18871887
createRunningTaskRun({
18881888
runtime: "acp",
18891889
sourceId: context.runId,
1890-
requesterSessionKey: context.requesterSessionKey,
1890+
ownerKey: context.requesterSessionKey,
1891+
scopeKind: "session",
18911892
requesterOrigin: context.requesterOrigin,
18921893
childSessionKey: context.childSessionKey,
18931894
runId: context.runId,

src/cron/service/ops.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,8 @@ function tryCreateManualTaskRun(params: {
400400
createRunningTaskRun({
401401
runtime: "cron",
402402
sourceId: params.job.id,
403-
requesterSessionKey: "",
403+
ownerKey: "",
404+
scopeKind: "system",
404405
childSessionKey: params.job.sessionKey,
405406
agentId: params.job.agentId,
406407
runId,

src/cron/service/timer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ function tryCreateCronTaskRun(params: {
138138
createRunningTaskRun({
139139
runtime: "cron",
140140
sourceId: params.job.id,
141-
requesterSessionKey: "",
141+
ownerKey: "",
142+
scopeKind: "system",
142143
childSessionKey: params.job.sessionKey,
143144
agentId: params.job.agentId,
144145
runId,

src/tasks/task-executor.test.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ describe("task-executor", () => {
6767
await withTaskExecutorStateDir(async () => {
6868
const created = createQueuedTaskRun({
6969
runtime: "acp",
70-
requesterSessionKey: "agent:main:main",
70+
ownerKey: "agent:main:main",
71+
scopeKind: "session",
7172
childSessionKey: "agent:codex:acp:child",
7273
runId: "run-executor-queued",
7374
task: "Investigate issue",
@@ -103,7 +104,8 @@ describe("task-executor", () => {
103104
await withTaskExecutorStateDir(async () => {
104105
const created = createRunningTaskRun({
105106
runtime: "subagent",
106-
requesterSessionKey: "agent:main:main",
107+
ownerKey: "agent:main:main",
108+
scopeKind: "session",
107109
childSessionKey: "agent:codex:subagent:child",
108110
runId: "run-executor-fail",
109111
task: "Write summary",
@@ -143,7 +145,8 @@ describe("task-executor", () => {
143145
await withTaskExecutorStateDir(async () => {
144146
const created = createRunningTaskRun({
145147
runtime: "acp",
146-
requesterSessionKey: "agent:main:main",
148+
ownerKey: "agent:main:main",
149+
scopeKind: "session",
147150
requesterOrigin: {
148151
channel: "telegram",
149152
to: "telegram:123",
@@ -179,7 +182,8 @@ describe("task-executor", () => {
179182

180183
const child = createRunningTaskRun({
181184
runtime: "acp",
182-
requesterSessionKey: "agent:main:main",
185+
ownerKey: "agent:main:main",
186+
scopeKind: "session",
183187
childSessionKey: "agent:codex:acp:child",
184188
runId: "run-linear-cancel",
185189
task: "Inspect a PR",
@@ -217,7 +221,8 @@ describe("task-executor", () => {
217221

218222
const child = createRunningTaskRun({
219223
runtime: "subagent",
220-
requesterSessionKey: "agent:main:main",
224+
ownerKey: "agent:main:main",
225+
scopeKind: "session",
221226
childSessionKey: "agent:codex:subagent:child",
222227
runId: "run-subagent-cancel",
223228
task: "Inspect a PR",
@@ -249,15 +254,17 @@ describe("task-executor", () => {
249254
await withTaskExecutorStateDir(async () => {
250255
const victim = createRunningTaskRun({
251256
runtime: "acp",
252-
requesterSessionKey: "agent:victim:main",
257+
ownerKey: "agent:victim:main",
258+
scopeKind: "session",
253259
childSessionKey: "agent:victim:acp:child",
254260
runId: "run-shared-executor-scope",
255261
task: "Victim ACP task",
256262
deliveryStatus: "pending",
257263
});
258264
const attacker = createRunningTaskRun({
259265
runtime: "cli",
260-
requesterSessionKey: "agent:attacker:main",
266+
ownerKey: "agent:attacker:main",
267+
scopeKind: "session",
261268
childSessionKey: "agent:attacker:main",
262269
runId: "run-shared-executor-scope",
263270
task: "Attacker CLI task",

0 commit comments

Comments
 (0)