Repository navigation
Conversation
A create without agentId stored the calling agent even when sessionTarget named another agent's session, so the run later failed with 'SQLite session store path belongs to agent ...' and a one-shot was auto-disabled. Resolve the agent from the job's own session target before the caller/default, in both the create default and the effective-owner resolver.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs real behavior proof before merge. What this changesDerive a cron job's execution agent from its qualified session target before falling back to the caller or configured default. Example: A main-agent caller schedules a job targeting session:agent:worker:dashboard:probe without agentId.
Review scores
ProductKind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Partial Merge readiness⛔ Blocked before merge - 8 items remain Keep open: this PR addresses a concrete scheduling bug, but target-agent inference does not reach the admission and execution boundaries consistently. Priority: P2 Decision needed
Before merge
Findings
Tests
Agent review detailsHow this fits togetherGateway cron creation validates requests and records creator ownership; the cron service later admits scheduled occurrences and dispatches work into agent-owned sessions. flowchart TD
A[Cron creation request] --> B[Caller scope and execution agent]
B --> C[Creation authorization]
C --> D[Stored cron job]
D --> E[Scheduled occurrence admission]
E --> F[Agent session execution]
Technical reviewBest possible solution: Choose one execution-agent policy at creation, preserve creator ownership separately, and use the resulting agent consistently through authorization, inference capture, persistence, and occurrence admission. Do we have a high-confidence way to reproduce the issue? Source establishes contradictory creation and execution identities, and the linked report supplies an affected release and failure trace; no target code was executed during this read-only review. Is this the best way to solve the issue? A shared parser is appropriate, but changing the resolver alone leaves competing agent-selection paths; early consistency validation is the smaller repair unless an owner approves broader inference. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 3e253689582b. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: unit tests only. SecurityNeeds attention: No authorization bypass is established, but inferred execution ownership must remain consistent with creator and inference authority. EvidenceSecurity concerns:
What I checked:
Likely related people:
PR surfaceSource +17, Tests +38. Total +55 across 5 files. Added test files: 0. View PR surface stats
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 1, 2026, 2:56 AM ET / 07:56 UTC. |
|
Closing this PR: the review shows the change needs a maintainer decision and a complete cutover, not a helper-level patch. What the review established (verified in source):
The right fix is a single cutover across the creation-authorization owner, the occurrence-admission owner, and the CLI surface, and it requires a maintainer call on whether a Closing — not abandoning the report. If maintainers confirm the intended policy (cross-agent |
Fixes #190123
What Problem This Solves
An agent that scheduled a cron job for another agent's conversation ended up with a job that could never run: it was bound to the calling agent, failed at the due time with "SQLite session store path belongs to agent …", and a one-shot job was then disabled as a permanent error.
cron.addwithoutagentIdfilled the job's agent with the caller (applyCronCreateCallerScopeDefault), and the effective-owner resolver (tryResolveCronJobEffectiveAgentId) only consulted the explicit id, the job's own session key, then the configured default — never the agent named bysessionTarget: "session:agent:<other>:…". The run itself resolves its session fromsessionTargetfirst, so the stored owner and the run target disagreed.sessionTarget(via the existingresolveCronSessionTargetSessionKey+parseAgentSessionKey) and put it ahead of the caller/default in both places; the caller remains the job's owner.src/cron/agent-id.ts(newresolveCronSessionTargetAgentId, resolver order),src/cron/types-shared.ts(CronAgentScopegains the job'ssessionTarget),src/gateway/server-methods/cron-caller-scope.ts(create default), plus regressions insrc/cron/agent-id.test.tsandsrc/gateway/server-methods/cron-caller-scope.test.ts.agentIdstill wins, detached targets (isolated/current/main) still fall back to the caller, the owner fields (owner.agentId,owner.sessionKey) are untouched, and no delivery/schedule semantics moved.Why This Change Was Made
The job's own target is the most specific statement about where it runs, so it must rank above an ambient caller default; the caller still owns what it created. Both call sites already exist and the session-target parser is shared, so this is one resolution rule, not a new contract.
cron.addonly — rejected; the resolver would still mis-answer for jobs created through other paths (Doctor, internal probes).cron.updatethat changessessionTargeton an existing job keeps its stored explicitagentId; that is unchanged here and noted as a follow-up.User Impact
A job scheduled for another agent's conversation now runs there instead of failing at its first tick, and one-shot jobs are no longer auto-disabled. Jobs that target the caller still bind to the caller.
Evidence
Red on the base, green with the fix — both regressions fail on the current
main(18516599b) and pass here:Resolution order exercised by the new cases: explicit
agentId→ agent named bysessionTarget→ jobsessionKey→ configured default; detached targets keep the caller, andowner.agentIdstays the caller.Focused cron coverage on the same head (the full
src/cronsweep exceeds the local runner budget):oxlint(0 warnings / 0 errors) andrun-format --checkpass on the changed files.What was not tested: a live Gateway run of the failing one-shot (the regression drives the create default and the resolver directly), and
cron.updatechangingsessionTarget(documented non-goal above).AI Assistance
This PR is AI-assisted. Used source tracing across the cron create path, the effective-owner resolver, and the session-target parser, plus red/green regressions on the real helpers. The implementer understands the code: the job's own target is more specific than the ambient caller, while ownership stays with the caller. All evidence above is from real local runtime execution.