Repository navigation
fix(cron): infer agentId from workspace when adding jobs - #54307
velamints2 wants to merge 1 commit into
Conversation
|
Closing this as implemented after Codex automated review. Current main already handles the routed-session leakage described by the PR: agent-created cron jobs inherit the active session agentId when the job omits agentId, cron storage persists it, and isolated cron execution uses that agentId for the cron session key and workspace. The draft PR's CWD-based CLI inference is no longer needed for the routed agent/session context bug it describes. Best possible solution: Close this draft PR as already implemented for the routed agent/session context bug. Keep the current session-derived agentId behavior for agent-created cron jobs and the explicit --agent CLI path; if maintainers want shell CWD-based CLI inference later, track it as a separate CLI UX request. What I checked:
So I’m closing this as already implemented rather than keeping a duplicate issue open. Codex Review notes: model gpt-5.5, reasoning high; reviewed against 06d409dc2738; fix evidence: release v2026.4.24, commit cbcfdf62c729. |
PR Draft: fix(cron): inherit current agentId when creating jobs from routed agent context
Summary
Fixes a multi-agent isolation bug where cron jobs created without explicit
--agentcan be persisted with noagentId, then executed under default agent (main).In routed environments (e.g., Feishu group ->
sales), this causes cross-agent leakage: job outputs appear in sales channel while execution context ismain.Behavior before
agentId = nullmain)agent:main:cron:<id>:run:<sessionId>Behavior after
--agentis absent:job.agentId = currentAgentIdcron listandcron runsshow explicitagentIdProposed code touch points (indicative)
src/cron/add.ts(or equivalent add command handler)agentIdfrom invocation context when omittedsrc/cron/store.tsagentIdpersisted and typedsrc/cron/scheduler.tsjob.agentIdand avoid silent fallback when in multi-agent modesrc/cron/runs.tsagentIdfield in run entries/output for observabilitysalescontext + no--agent-> persistedagentId=salesAcceptance criteria
salesrouted context without--agentyieldsAgent ID = salessessionKeywithagent:sales:cron:...--agentunchangedNotes
Current user-level workaround: