Skip to content

fix(cron): a job targeting another agent's session never runs - #190362

Open
LiuwqGit wants to merge 4 commits into
openclaw:mainfrom
LiuwqGit:feat/issue-190123-cron-session-ref-agent
Open

LiuwqGit wants to merge 4 commits into
openclaw:mainfrom
LiuwqGit:feat/issue-190123-cron-session-ref-agent

Conversation

@LiuwqGit

@LiuwqGit LiuwqGit commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

AI-assisted: yes

Closes #190123

What Problem This Solves

  • Fixes an issue where a user on a multi-agent gateway who scheduled work into another agent's
    conversation with openclaw cron add --session session:agent:<other>:… and no --agent got a job
    that could never run. The create was admitted for one agent while the job's own session belonged
    to another, so the due run failed in milliseconds (cron job agent is unavailable: worker, or on
    the reporter's install SQLite session store path belongs to agent main; requested agent worker.)
    and the one-shot (at) job was then auto-disabled as a permanent error: the payload never ran and
    nothing told the creator why. On today's main the same command in a two-agent roster does not
    even reach that point — it is refused with invalid cron.add params: Multiple agents are configured, but this operation has no explicit owner. Either way the scheduled work is silently
    lost.
  • The CLI made this worse by naming the wrong owner: it printed No --agent specified; the job will run with the configured default agent. for a job whose session already named one.
  • Related: [Bug]: cron.add without agentId binds the caller's agent even when sessionTarget names another agent's session; the run fails 'SQLite session store path belongs to agent …' and the one-shot is disabled #190123 (reporter's source trace names the create default and the owner resolver);
    fix(cron): bind a caller-less job to its session target's agent #190156 (earlier attempt at this report, withdrawn by its author before merge — it changed the
    global owner-resolution precedence and left the due-run leg on job.agentId untouched). This PR
    takes the narrower route: name the execution agent once at cron.add admission, and leave global
    attribution precedence alone. Fix signal labels: clawsweeper:queueable-fix,
    clawsweeper:fix-shape-clear, clawsweeper:source-repro.

Why This Change Was Made

  • Intended outcome: one execution agent is named before any cron.add admission step reads it,
    so caller-scope matching, creator-session and inference capture, declaration matching, and the
    persisted row all agree on the same owner. bindCronCreateExecutionAgent
    (src/gateway/server-methods/cron-caller-scope.ts) resolves it — an explicit agentId wins,
    otherwise the job's own session reference decides (sessionTarget session:<key> first, the same
    precedence the run uses through resolveCronSessionTargetSessionKey, then the legacy scoped
    sessionKey) — and cronAddHandler applies it to the request before it builds anything else.
    That one resolved jobCreate then flows unchanged into cronCreateMatchesCallerScope,
    captureCronCreatorSession, the matchesExisting declaration matcher, and context.cron.add.
  • This re-points the earlier revision of this PR, which bound the agent inside CronService.add.
    That happened after two gateway consumers had already read the unresolved input, leaving two
    real inconsistencies (both raised in review):
    • cronAddHandler handed matchesExisting the unresolved jobCreate, so
      cronJobMatchesDeclarationScope compared the configured default (main) against the stored
      owner (worker) and excluded the row it should have converged onto — repeating a declaration
      would have created a second job instead of preserving the first one's id and history;
    • captureCronCreatorSession ran before that binding, so it loaded the execution session and
      captured inference for the configured default agent while the job was stored for another.
      src/cron/service/ops-mutations.ts is therefore back to main: the service no longer re-resolves
      ownership, and there is exactly one binding point.
  • Also removed: the previous revision's manageAll exception in cronCreateMatchesCallerScope. It
    was unreachable — CRON_MANAGEMENT_METHODS (src/gateway/cron-creator-authority-grant.ts) lists
    cron.list/get/update/run/remove/bind and excludes cron.add, mintCronCreatorAuthorityGrant
    throws for a management method outside that list, getCronManagementAuthority only returns inside
    a redeemed method-bound management context, and the one other caller (cron.update) passes a
    creatorScope built with manageAll: undefined. Its test fabricated the capability with
    vi.fn() instead of reaching it through admission. Creation authority is unchanged from main:
    an agent turn still cannot create a job that another agent would execute, and a scoped caller
    targeting a foreign session is refused exactly as before (cronPatchSessionRefsMatchCaller already
    refused it on main).
  • Deliberately not changed: tryResolveCronJobEffectiveAgentId's precedence (explicit id →
    scoped sessionKey → configured default), so visibility, scheduling, run receipts, and the Doctor
    heartbeat cutover keep their existing attribution semantics; already-stored jobs are never
    reinterpreted or migrated. Detached targets (isolated / current / main) name no agent and
    still fall back to the caller scope or configured default, and a malformed session: target names
    no owner instead of throwing out of a pure resolver.
  • Out of scope: no change to run-time session resolution, delivery, the one-shot disable policy,
    the SQLite scope check, or existing stored jobs; no config surface added; no other create path
    (plugin service-cron, templates-add) is re-pointed; no refactor of the caller-scope module.
  • Highest-risk area: cron.add admission — a job that used to be stored without an agentId now
    stores the session's agent, which is visible to declaration convergence, agent-filtered listings,
    and inference capture.
  • How is that risk mitigated? The value is written only when the input carries no agentId and
    its own session reference names one, and every consumer downstream reads that same value.
    Regression tests run through the real admission boundary (handleGatewayRequest +
    cronHandlers["cron.add"] + a real CronService on an on-disk store) and cover the persisted
    owner, repeated-declaration convergence, agent-filtered listing, both caller-scope outcomes, an
    ownerless row stored by an older build, the declaration matcher's input contract, and the CLI
    warning.

User Impact

  • Success criteria: on a gateway with per-agent session stores, openclaw cron add --name probe --at <t> --session session:agent:worker:dashboard:<uuid> --message ping (no --agent) warns
    No --agent specified; the job will run with agent worker, named by its session., stores the job
    with agentId: "worker", reports worker in cron list, and the due run really executes a turn
    in agent:worker:dashboard:<uuid> under agentId=worker instead of dying against main. An
    identical repeated --declaration-key converges onto the same job id. An agent turn still cannot
    create a job for another agent, and a job stored by an older build still loads and lists unchanged.
  • What should reviewers focus on? src/gateway/server-methods/cron-caller-scope.ts
    (bindCronCreateExecutionAgent, plus the reverted cronCreateMatchesCallerScope /
    applyCronCreateCallerScopeDefault), src/gateway/server-methods/cron-add.ts (the single binding
    point), src/cron/agent-id.ts (resolveCronJobSessionRefAgentId),
    src/cli/cron-cli/register.cron-add.ts (warning text), and the regressions in
    src/gateway/server-methods/cron.gateway-policy.integration.test.ts (Gateway automation execution agent), src/gateway/server-cron.session-target.test.ts,
    src/gateway/server-methods/cron-caller-scope.test.ts (create-time execution agent), and
    src/cli/cron-cli.test.ts. Also docs/cli/cron.md: the create-time precedence this introduces
    (explicit --agent → the job's own agent-qualified session reference → configured default) is now
    documented separately from stored-job ownership, which is unchanged.

Evidence

  • Real environment tested: yes — a real openclaw gateway process and the real openclaw CLI,
    both run from this branch's source (node --import ./scripts/tsx.mjs src/entry.ts …, self-reported
    OpenClaw 2026.10.9), against an isolated state dir with per-agent SQLite session stores
    (session.store: "<state>/sessions/{agentId}.sqlite"), token auth, and a local
    OpenAI-compatible endpoint on 127.0.0.1 standing in for the model provider so a due turn can
    complete offline. Worktree aispace/worktrees/issue-190123, head c9b5ca8e25d, base
    origin/main 36ddf502c84, Node v26.12.1. The before legs restore origin/main copies of the
    four touched source files and re-run the identical commands against an identically configured
    gateway.
  • Distinct accounts, final effect (added in this revision): the run above was repeated against a
    second isolated state dir whose two agents own separate provider credentials — main resolves
    localmain/proof-model-main (key tail 1111), worker resolves localworker/proof-model-worker
    (key tail 2222), both served by one local endpoint that logs the Authorization header it
    receives. This is the leg that shows target-derived agent selection picking the account, at the
    last observable effect (the provider HTTP call), rather than only in the stored row.
  • Agent-turn authority chain, allowed and nearest-forbidden, at the provider HTTP boundary
    (head acd435275ff):
    the same two-account gateway was reconfigured with
    tools.gatewayPolicy.automations.scope: "caller" so a model turn — not the operator CLI — is
    the automation caller, and the drives below replay the authority chain end to end through a real
    openclaw agent turn (real gateway process, real signed agent-runtime identity, production
    cron.add admission), with the synthetic endpoint logging which account served every request.
    Three cases, one gateway run, head acd435275ff (this head; the touched source files are
    unchanged since the traces above):
    # CASE A (allowed): a real chat turn for main creates a job for MAIN's own session
    $ openclaw agent --agent main --session-key agent:main:proof-chat-allowed \
        --message "R5_ALLOWED_MAIN: create the automation now" --json
    { "runId": "2c8a73c1-…", "status": "ok", "summary": "completed",
      "agentMeta": { "sessionFile": "agent:main:proof-chat-allowed",
                     "provider": "localmain", "model": "proof-model-main" } }
    
    [gateway] cron: job added                            # admission accepted the bound create
    $ openclaw cron list --all --json
    { "id": "a8f948ad-df46-4a2f-8691-dc5eede99c61", "name": "r5-allowed-main",
      "agentId": "main", "enabled": true,
      "sessionTarget": "session:agent:main:proof:due",
      "schedule": { "kind": "at", … } }
    
    # the due run, after the creating turn had long completed — served by main's account
    [fake-openai] chat/completions #3 model=proof-model-main keyTail=1111 route=text tools=[]
    $ openclaw cron runs a8f948ad-… --json
    { "action": "finished", "status": "ok", "completionStatus": "succeeded",
      "runAtMs": 1794199443284, "durationMs": 6218,
      "model": "proof-model-main", "provider": "localmain", "summary": "r5 done" }
    
    # CASE B (nearest-forbidden): the same turn shape targets WORKER's session
    $ openclaw agent --agent main --session-key agent:main:proof-chat-forbidden \
        --message "R5_FORBIDDEN_WORKER: create the automation now" --json
    [gateway] [tools] dispatch_action failed: GatewayClientRequestError:
      invalid cron.add params: job agentId outside caller scope | INVALID_REQUEST
    { "runId": "e8d70282-…", "status": "ok", "summary": "completed" }   # turn completed with the rejection
    $ openclaw cron list --all --json          → { "jobs": [], "total": 0 }
    $ grep -c "keyTail=2222" <endpoint log>   → 0        # worker's account NEVER used
    $ ls <state>/sessions/                        → main.sqlite … (no worker.sqlite, ever)
    
    # CASE C (revoked mid-create): the same allowed create, turn aborted while the create is in flight
    # driver: sessions.abort fired 10ms after the scripted tool-call stream was served
    transcript: seq 4 user message; seq 7 assistant toolCall dispatch_action (automations add)
    12:56:32.781  endpoint served the tool-call stream (main's account, keyTail=1111)
    12:56:32.791  tool call dispatched (transcript seq 7)
    12:56:32.797  sessions.abort fired
    12:56:32.985  [gateway] sessions.abort requested … session=agent:main:proof-chat-revoked-1
    12:56:33.162  lane task error: agent run aborted, sessionKey=agent:main:proof-chat-revoked-1
    → no tool result event recorded; no continuation model request reached the endpoint
    $ openclaw cron list --all --json          → { "jobs": [], "total": 0 }
    $ grep -c "due-revoked\|keyTail=2222" <endpoint log> → 0
    
    What the three cases establish together, all observed at the provider HTTP endpoint:
    A — an agent-turn create for the turn's own session persists with agentId: main and its due
    run (after the creating turn completed normally) is served by main's credentials — a normally
    completed creator turn keeps its captured persistent authority, and that authority reaches the
    provider. B — the same agent-turn caller naming another agent's session is rejected at the
    production cron.add admission (job agentId outside caller scope), nothing persists, and
    worker's provider account is never touched (zero keyTail=2222 requests for the whole run; the
    only session store ever opened is main.sqlite). C — the identical allowed create with the
    creator authority revoked mid-flight (turn aborted while the create was in progress: the tool
    call is recorded at :32.791, the abort lands at :32.985, no tool result is ever recorded)
    persists nothing and issues no provider request for the job.
  • Exact steps or commands run after this patch:
    # 1. local OpenAI-compatible endpoint (canned streaming chat completion) on 127.0.0.1:18099
    node <proof-dir>/fake-openai.mjs
    
    # 2. real gateway from this branch's source: two agents (main, worker), per-agent SQLite stores
    OPENCLAW_STATE_DIR=<proof>/state OPENCLAW_SKIP_CHANNELS=1 \
      node --import ./scripts/tsx.mjs src/entry.ts gateway --port 18790
    
    # 3. real CLI create in the reporter's shape: no --agent, session belongs to another agent
    OPENCLAW_STATE_DIR=<proof>/state node --import ./scripts/tsx.mjs src/entry.ts cron add \
      --name probe --at 45s --session session:agent:worker:dashboard:2b6f1c9a --message ping \
      --no-deliver --url ws://127.0.0.1:18790 --token <redacted>
    
    # 4. repeated identical declaration (convergence), listing, then wait out the due time
    … cron add --name declared --declaration-key daily-probe --at 30m --session <same> --message ping \
        --no-deliver --disabled            # run twice, identical payload
    … cron list --all --json
    sleep 75 && … cron list --all --json && ls <state>/sessions/
    
    # before legs (identical commands, gateway restarted on main's sources):
    #   git checkout origin/main -- src/cron/agent-id.ts src/cli/cron-cli/register.cron-add.ts \
    #     src/gateway/server-methods/cron-add.ts src/gateway/server-methods/cron-caller-scope.ts
    
    # regression tests: RED on origin/main sources, GREEN on head
    OPENCLAW_VITEST_MAX_WORKERS=2 node scripts/run-vitest.mjs run \
      src/gateway/server-methods/cron.gateway-policy.integration.test.ts \
      src/gateway/server-methods/cron-caller-scope.test.ts \
      src/gateway/server-cron.session-target.test.ts
    OPENCLAW_VITEST_MAX_WORKERS=2 node scripts/run-vitest.mjs run src/cli/cron-cli.test.ts
    
    # format + lint + related suites + tsgo:core
    bash skills/fix-pr/scripts/validate.sh <the eight changed files>
  • Evidence after fix: real gateway log and CLI output from that run (token and host paths
    redacted):
    $ openclaw cron add --name probe --at 45s --session session:agent:worker:dashboard:2b6f1c9a \
        --message ping --no-deliver                       # NOTE: no --agent
    No --agent specified; the job will run with agent worker, named by its session. Specify --agent to choose a specific agent.
    { "id": "08f3fffb-664c-4c4e-aab8-df0f99502fea", "agentId": "worker", "name": "probe",
      "sessionTarget": "session:agent:worker:dashboard:2b6f1c9a",
      "schedule": { "kind": "at", "at": "2026-11-01T15:56:35.608Z" }, "enabled": true, … }
    
    # an identical repeated declaration converges instead of duplicating
    1st: { "created": true,  "job": { "id": "e7c47cde-0e5e-493b-8f9e-acd1fb977a01",
           "declarationKey": "daily-probe", "agentId": "worker", … } }
    2nd: { "created": false, "updated": true,
           "job": { "id": "e7c47cde-0e5e-493b-8f9e-acd1fb977a01", … } }   # same id
    
    # gateway log: the due run really executed a turn as worker, in worker's session
    [gateway] cron: job added
    [auto-reply/reply-resolver-timing] … sessionKey=agent:worker:dashboard:2b6f1c9a agentId=worker
      … reply.resolve_default_model … reply.init_session_state … reason=before_run_prepared_reply
    [event-loop] main-thread stall: task="reply.run_agent_turn" …
    [local-provider] POST /v1/chat/completions #1 model=proof-model stream=true
    
    $ ls <state>/sessions/
    worker.sqlite  worker.sqlite-shm  worker.sqlite-wal        # main.sqlite was never opened
    
  • Observed result after fix: the job created without --agent is stored with
    agentId: "worker"; the CLI names worker instead of promising the configured default; an
    identical repeated declaration converges onto the same job id (created: false, updated: true)
    rather than adding a second job; and the due run completes a real agent turn under
    agentId=worker in agent:worker:dashboard:<uuid> — it reaches the model provider, and the only
    session store created is worker.sqlite, so neither the store-scope guard nor the
    agent-availability guard that killed the run on main fires. An agent-turn caller is still
    refused a job another agent would execute (job agentId outside caller scope), and a job stored
    by an older build with no owner still loads, is served by cron.get / cron.list, and is not
    rewritten.
  • Evidence after fix (distinct accounts): two jobs created with no --agent, one per agent's
    session, on the two-account gateway (head c9b5ca8e25d; token redacted):
    $ openclaw cron add --name probe-worker --at 45s \
        --session session:agent:worker:dashboard:7c1a9f02 --message ping --no-deliver   # no --agent
    No --agent specified; the job will run with agent worker, named by its session. …
    { "id": "3b5a8a91-…", "agentId": "worker",
      "sessionTarget": "session:agent:worker:dashboard:7c1a9f02", … }
    
    $ openclaw cron add --name probe-main --at 45s \
        --session session:agent:main:dashboard:3d8b2c11 --message ping --no-deliver     # no --agent
    No --agent specified; the job will run with agent main, named by its session. …
    { "id": "efb39461-…", "agentId": "main",
      "sessionTarget": "session:agent:main:dashboard:3d8b2c11", … }
    
    # provider endpoint log — the account that actually served each dispatch
    [fake-openai] chat/completions #1 account=worker-account keyTail=2222 model=proof-model-worker stream=true
    [fake-openai] chat/completions #2 account=main-account  keyTail=1111 model=proof-model-main  stream=true
    
    # gateway log — each due run resolved its own agent inside its own session
    [auto-reply/reply-resolver-timing] … sessionKey=agent:worker:dashboard:7c1a9f02 agentId=worker totalMs=18600 …
    [auto-reply/reply-resolver-timing] … sessionKey=agent:main:dashboard:3d8b2c11   agentId=main   totalMs=19937 …
    
    $ ls <state>/sessions/
    main.sqlite main.sqlite-shm main.sqlite-wal worker.sqlite worker.sqlite-shm worker.sqlite-wal
    $ openclaw cron list --all --json     # after both due times
    { "jobs": [], "total": 0 }            # both one-shots ran and were deleted (deleteAfterRun)
    $ grep -c "agent is unavailable\|autoDisabled\|SQLite session store path belongs" gateway.log
    0
    
    Each dispatch was paid for by the account that owns the session the job targeted: the
    worker-session job created with no --agent reached the provider under worker-account /
    proof-model-worker, the main-session job under main-account / proof-model-main. Selection is
    per target, not sticky — two jobs created seconds apart in the same gateway bound two different
    accounts, both runs completed, both one-shots were deleted after running, and neither the
    agent-availability guard nor the session-store scope guard fired.
  • Before evidence (distinct accounts): the identical two creates against a gateway on
    origin/main sources with the same two-account config:
    $ openclaw cron add --name probe-worker --at 45s \
        --session session:agent:worker:dashboard:7c1a9f02 --message ping --no-deliver
    No --agent specified; the job will run with the configured default agent. …
    { "ok": false, "error": { "message": "invalid cron.add params: Multiple agents are configured,
      but this operation has no explicit owner. …" } }
    exit=1                      # leg B (main's own session) refused identically
    $ openclaw cron list --all --json → { "jobs": [], "total": 0 }
    $ ls <state>/sessions/            → (empty — no session store was ever opened)
    # provider endpoint log: zero chat/completions requests — no account was selected at all
    [fake-openai] listening on http://127.0.0.1:18098/v1
    
  • Before evidence: the identical commands against a gateway on origin/main, same config shape,
    same state layout.
    Two-agent roster — the create never lands, so the work is lost at admission:
    $ openclaw cron add --name probe --at 45s --session session:agent:worker:dashboard:2b6f1c9a \
        --message ping --no-deliver
    No --agent specified; the job will run with the configured default agent. Specify --agent to choose a specific agent, or set agents.defaults.systemAgent.agentId.
    { "ok": false, "error": { "type": "cli_error", "message": "invalid cron.add params: Multiple agents
      are configured, but this operation has no explicit owner. Select an agent explicitly; CLI callers
      can pass --agent <id>, channels can add a binding, and ambient services can set their agentId
      target." } }
    exit=1
    $ openclaw cron list --all --json → { "jobs": [], "total": 0 }
    
    Single-agent roster (main only, so a default resolves and the create is admitted) — the
    reporter's failure leg, including the auto-disable:
    $ openclaw cron add --name probe --at 45s --session session:agent:worker:dashboard:2b6f1c9a \
        --message ping --no-deliver
    No --agent specified; the job will run with the configured default agent. …
    { "id": "3eb6aa59-d83d-49d2-adaf-2eef5436a1d3", "name": "probe",     # NOTE: no "agentId" at all
      "sessionTarget": "session:agent:worker:dashboard:2b6f1c9a",
      "schedule": { "kind": "at", "at": "2026-11-02T02:02:22.527Z" }, … }
    
    $ openclaw cron list --all --json          # after the due time
    { "id": "3eb6aa59-…", "name": "probe", "enabled": false,
      "state": { "lastRunStatus": "error", "lastDurationMs": 17,
                 "lastError": "cron job agent is unavailable: worker",
                 "consecutiveErrors": 1,
                 "autoDisabled": { "reason": "consecutive-failures", "consecutiveErrors": 1 } },
      "effectiveAgentId": "main", "status": "disabled" }
    
    $ ls <state>/sessions/
    main.sqlite  main.sqlite.seal               # worker's store was never opened
    
    The stored owner (effectiveAgentId: "main") contradicts the job's own session
    (agent:worker:…), the run dies in 17 ms, and the one-shot is disabled — the reported outcome.
    The new regression tests fail on those same origin/main sources:
    # origin/main 4b35c8fbe0b sources, head's tests — gateway shard
    × cron.gateway-policy.integration.test.ts > Gateway automation execution agent >
      stores the session's agent and converges a repeated declaration onto that job
      → expected 'invalid cron.add params: Multiple age…' to be true
    × cron.gateway-policy.integration.test.ts > Gateway automation execution agent >
      reports the session's agent to operator listings and keeps it out of the default agent
      → expected 'invalid cron.add params: Multiple age…' to be true
    × cron-caller-scope.test.ts > create-time execution agent > names the agent that owns the
      session the due run opens                                        → bindCronCreateExecutionAgent is not a function
    × cron-caller-scope.test.ts > create-time execution agent > keeps an explicit agent and names
      no owner for a detached or malformed target                      → bindCronCreateExecutionAgent is not a function
    × cron-caller-scope.test.ts > create-time execution agent > matches a repeated declaration
      only against the bound create input                              → bindCronCreateExecutionAgent is not a function
    × cron-caller-scope.test.ts > create-time execution agent > keeps creation restricted to the
      caller's own agent                                               → bindCronCreateExecutionAgent is not a function
    × server-cron.session-target.test.ts > runs an operator-created job under the agent its
      session target names
      → cron.add was refused: invalid cron.add params: Multiple agents are configured, but this
        operation has no explicit owner.
    Test Files  3 failed (3)   Tests  7 failed | 40 passed (47)
    
    # cli shard
    × cron-cli.test.ts > names the session's agent in the missing --agent warning
      → expected 'No --agent specified; the job will ru…' to contain 'agent worker, named by its session'
    Test Files  1 failed (1)   Tests  1 failed | 64 passed (65)
    
    # head (same tests, same shards): all green
    [validate] 1/4 oxfmt ✅  2/4 oxlint ✅  3/4 vitest — passed 3 Vitest shards  4/4 tsgo:core ✅
    [validate] 全部通过
    
  • Upgrade compatibility (head acd435275ff, real store seeded by the pre-change build): a
    gateway running origin/main copies of the four touched files created two recurring jobs on the
    two-account config and ran them for real; the gateway was then stopped and restarted on this
    branch's sources against the same state dir — no migration step, no store edit, no re-create:
    # phase 1 — origin/main sources
    $ openclaw cron add --name nightly-worker --agent worker --cron "*/5 * * * *" \
        --session session:agent:worker:dashboard:7c1a9f02 --message ping --no-deliver
    $ openclaw cron add --name heartbeat-main --agent main --cron "* * * * *" \
        --session session:agent:main:dashboard:3d8b2c11 --message ping --no-deliver
    # 95 s later, real run history recorded
    $ openclaw cron runs be00bb1d-… --json → 1 entry:  runAtMs=1793597640021 status=ok provider=localmain
    $ openclaw cron runs d5a69190-… --json → 0 entries (not due yet)
    
    # phase 2 — same state dir, this branch's sources; listed BEFORE any new run
    { "id": "be00bb1d-a65a-4c18-9a60-41db35cf0fb6", "name": "heartbeat-main", "agentId": "main",
      "enabled": true, "schedule": { "kind": "cron", "expr": "* * * * *" },
      "sessionTarget": "session:agent:main:dashboard:3d8b2c11",
      "state": { "lastRunStatus": "ok", "lastRunAtMs": 1793597760008 } }   # phase-1 history, intact
    { "id": "d5a69190-0a29-4aba-9a14-47c4df1efefb", "name": "nightly-worker", "agentId": "worker",
      "enabled": true, "schedule": { "kind": "cron", "expr": "*/5 * * * *" },
      "state": { "lastRunStatus": "ok", "lastRunAtMs": 1793597700018 } }
    
    # 95 s later — the upgraded build ran the stored schedules itself
    $ openclaw cron runs be00bb1d-… --json → runAtMs=1793597820004 status=ok provider=localmain
                                             runAtMs=1793597880005 status=ok provider=localmain
                                             model=proof-model-main sessionKey=agent:main:dashboard:3d8b2c11
    $ openclaw cron runs d5a69190-… --json → runAtMs=1793597700018 status=ok provider=localworker
                                             model=proof-model-worker     # phase-1 entry preserved
    
    # one endpoint, two accounts, across both phases
    [fake-openai] chat/completions #1 account=main-account   keyTail=1111 model=proof-model-main
    [fake-openai] chat/completions #3 account=worker-account keyTail=2222 model=proof-model-worker
    … 6 completions total, 0 errors
    
    config sha256 before upgrade: 93b6cb2ec899a6efc61182258e94bc1e5570d7b09cb80227b720c9249afc55ed
    config sha256 after  upgrade: 93b6cb2ec899a6efc61182258e94bc1e5570d7b09cb80227b720c9249afc55ed
    job ids identical across the two builds: true   (agentId, schedule, enabled, sessionTarget too)
    
    Settings, schedules, ownership and run history all survived the swap, and the upgraded build kept
    executing the stored schedules under each job's own account. No job was restamped: both were
    created with an explicit --agent, and both kept exactly that agentId.
  • Upgrade from the released v2026.10.9 package (head acd435275ff): the store above was seeded
    by a source build, so the leg was repeated against the npm-released package — [email protected]
    fetched from the registry tarball (openclaw-2026.10.9.tgz, 103 MB, dist/ + production deps
    installed), self-reporting OpenClaw 2026.10.9 (8b18b55). Its gateway created and ran two
    recurring jobs on the two-account config; the gateway was then stopped and this branch's sources
    were started against the same state dir — no migration, no store edit, no re-create:
    # phase 1 — RELEASED openclaw 2026.10.9 (8b18b55)
    $ openclaw cron add --name nightly-worker --agent worker --cron "*/5 * * * *" \
        --session session:agent:worker:dashboard:7c1a9f02 --message ping --no-deliver
    → { "id": "97943cac-bd90-430c-833a-4911d2d1b483", "agentId": "worker", … }
    $ openclaw cron add --name heartbeat-main --agent main --cron "* * * * *" \
        --session session:agent:main:dashboard:3d8b2c11 --message ping --no-deliver
    → { "id": "d62487d1-669d-4b5e-aa0e-1556cb705fcc", "agentId": "main", … }
    # run history the released build recorded
    $ openclaw cron runs d62487d1-… --json → 2 entries runAtMs=[1793599440052, 1793599500049]
                                             status=[ok, ok] provider=[localmain, localmain]
    $ openclaw cron runs 97943cac-… --json → 1 entry  runAtMs=1793599500026 status=ok
                                             provider=localworker model=proof-model-worker
    
    # phase 2 — this branch's sources (acd435275ff), same state dir, listed BEFORE any new run
    { "id": "d62487d1-669d-4b5e-aa0e-1556cb705fcc", "agentId": "main",   "enabled": true,
      "schedule": { "expr": "* * * * *" },   "state": { "lastRunStatus": "ok",
      "lastRunAtMs": 1793599500049 } }                       # the released build's history, intact
    { "id": "97943cac-bd90-430c-833a-4911d2d1b483", "agentId": "worker", "enabled": true,
      "schedule": { "expr": "*/5 * * * *" }, "state": { "lastRunStatus": "ok",
      "lastRunAtMs": 1793599500026 } }
    { "id": "e8e6bebb-85e2-40ae-893b-8e90c839d965", "agentId": "main",
      "sessionTarget": "main", "enabled": true }             # gateway-created heartbeat job, also intact
    
    # 100 s later — the branch build ran the released build's stored schedules itself
    $ openclaw cron runs d62487d1-… --json → 4 entries
        runAtMs=[1793599620033, 1793599560025, 1793599500049, 1793599440052]   # 2 new + 2 preserved
        status=[ok, ok, ok, ok] provider=[localmain ×4] model=[proof-model-main ×4]
        sessionKey=[agent:main:dashboard:3d8b2c11 ×4]
    $ openclaw cron runs 97943cac-… --json → 1 entry runAtMs=1793599500026 provider=localworker
                                             (released build's entry, byte-identical, not rewritten)
    
    ids identical across the two builds:            true
    createdAtMs identical:                          true
    agentId identical (no restamping):              true
    schedules identical:                            true
    config sha256 released build: 1487b18e4a2e4c2ad632039e53749c19c7a9c2818440cff5b7a73067a1762486
    config sha256 branch build:   1487b18e4a2e4c2ad632039e53749c19c7a9c2818440cff5b7a73067a1762486
    gateway log matches for "agent is unavailable" / "autoDisabled" /
      "SQLite session store path belongs" / "lastError", both phases: 0
    
    Settings, schedules, ownership, the gateway's own heartbeat job and every pre-existing run-history
    entry survived the released→branch handover, and the branch build kept executing those stored
    schedules under each job's own provider account. The per-run provider / model fields above are
    the gateway's own recorded attribution for this leg (the endpoint-side log for this run was lost to
    a port conflict with a leftover process from an aborted first attempt, so it is not cited).
  • What was not tested: no gateway installed from npm with systemd units was used (this branch's
    source was run directly), and no real model provider was called — a local OpenAI-compatible
    endpoint returned a canned streaming completion. Provider-side behaviour that only a live
    commercial provider has (profile availability, authorization identity, recorded-route checks, real
    credential validation) was not exercised. The agent-turn create leg, the foreign-agent-caller
    rejection at provider I/O, and creator-authority revocation mid-create are now replayed live
    against a real gateway (the three cases above, head acd435275ff); what stays un-replayed is
    reassigned authority (rotated lifecycle generation — an in-process gateway restart, which
    trivially kills in-flight work) and queued-execution revocation (an occurrence waiting for exec
    approval whose creator authority is revoked), both of which remain covered by the admission-boundary
    and creator-revocation commit-guard tests. Shared-store (session.store without {agentId})
    multi-agent setups were not exercised. Jobs created before this change were verified to load,
    list, stay unrewritten, and keep running: a store seeded by the npm-released [email protected]
    package (8b18b55) — two recurring jobs, real run history, both agent accounts, plus the
    gateway's own heartbeat job — was carried over to this branch's build unchanged, and a second leg
    did the same from a store seeded by origin/main sources (both above). Neither store was
    long-lived (both were seeded minutes before the handover), and the released package was run from an
    extracted tarball with its production deps installed rather than through a system-wide install with
    systemd units, so an in-place npm i -g upgrade path was not exercised.
  • Proof tier: L2 — real gateway process, real CLI, real cron store, real scheduler-driven due
    turn, two agents on distinct provider credentials; synthetic model provider. The agent-turn
    authority-chain leg is the same tier: real gateway, real openclaw agent turns, real signed
    agent-runtime identity, real cron.add admission, synthetic provider endpoint.
  • Proof limitations: the model provider is a local synthetic endpoint, so account selection is
    proven at the provider HTTP boundary but not against a live provider's credential validation. The
    negative paths (a foreign agent request, or authority revoked mid-create, producing no provider
    HTTP request) are replayed live above at the synthetic endpoint — what they show is that no request
    reaches the account at all, which a synthetic endpoint observes exactly as a live one would, but a
    live provider's own-side records were not consulted. Both upgrade legs reused stores seeded minutes
    earlier rather than long-lived production stores.
  • Docs and test-dedup follow-up (head acd435275ff, after the runs above): docs/cli/cron.md
    now states the create-time precedence and the warning it produces, separately from stored-job
    ownership (ClawSweeper's P3 documentation finding). The two helper cases it flagged as duplicated
    by the admission regressions are gone — the declaration-matcher case (a pure-function outcome that
    cannot detect admission forgetting to call the binder) and the caller-restriction case (both scope
    outcomes are driven through handleGatewayRequest + a real CronService in
    cron.gateway-policy.integration.test.ts). Retained, narrowed to what nothing else in the repo
    pins: the creating caller stays the recorded owner while execution routing follows the session's
    agent. The explicit-agent, legacy-session-key and malformed-target contracts are unchanged, and
    those commits are docs/test-only — no runtime behaviour moved, so the traces above still describe
    this head.
  • Review state: Awaiting the maintainer decision on the owner question ClawSweeper raised (infer
    the execution agent from a qualified session target vs. reject the combination). CI green on
    acd435275ff — check-test-types-core-2 and checks-fast-baseline-ratchets, the two failures
    this revision started from, both report SUCCESS, and the full check suite passes on this head. The
    agent-turn authority-chain leg above was added after the last review: no runtime files changed
    (evidence only), so the CI result and every earlier trace still describe this head.

@clawsweeper

clawsweeper Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime cli CLI command changes size: M labels Nov 1, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Nov 1, 2026
@clawsweeper

clawsweeper Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for the contribution. ClawSweeper is trimming this lowest-signal PR because the author is over the repository's open-PR budget.

@LiuwqGit currently has 17 open PRs in this repository, above the budget of 15. ClawSweeper is closing this PR as one of the author's lowest-signal submissions under that budget: its overall rating is C and its real behavior proof is insufficient. Closing or finishing other PRs frees review budget, and this PR can be reopened once the author is under budget or when real proof is added.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #190123
Summary: The linked issue owns the session-target ownership defect; this PR is its open fixing candidate and an earlier alternative closed unmerged.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Closing or finishing other open PRs frees review budget. This PR can be reopened once the author is under budget, or sooner when real behavior proof is added.

Review details

Best possible solution:

Close this lowest-signal PR for now. Finish or close other open PRs to free review budget, then reopen this PR once the author is under budget; adding real behavior proof also makes it eligible for reconsideration.

Do we have a high-confidence way to reproduce the issue?

Current-main source establishes the missing sessionTarget binding, and supplied before/after Gateway logs demonstrate admission failure and successful target-specific execution; this review ran no reproduction.

Is this the best way to solve the issue?

The single Gateway binding is the smallest coherent inference fix and avoids reinterpreting stored jobs, while explicit-agent rejection remains a valid owner-selected alternative.

Security review:

Security review needs attention: No concrete authorization bypass was found, but the supplied abort trace does not establish revocation after cron authority capture.

AGENTS.md: found and applied where relevant.

What I checked:

  • live author budget: @LiuwqGit has 17 open PRs in this repository; the configured budget is 15.
  • lowest-signal classification: overall PR rating is C and real behavior proof is insufficient.
  • inactivity floor: the PR and its current-head commit, status, and check-run activity are all older than 7 days.

Codex review notes: model internal, reasoning medium; reviewed against 70e2761fccfc.

@LiuwqGit
LiuwqGit force-pushed the feat/issue-190123-cron-session-ref-agent branch from 46588c2 to 176dc7e Compare November 2, 2026 02:20
@LiuwqGit

LiuwqGit commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

Reworked the patch and replaced the in-process probe with a real Gateway run. Head is now 176dc7e516a (base origin/main 4b35c8fbe0b). Taking the review's eight items in order:

1. Real behavior proof (create → due turn). A real openclaw gateway process and the real openclaw CLI, both run from this branch's source (node --import ./scripts/tsx.mjs src/entry.ts …), against an isolated state dir with per-agent SQLite session stores (session.store: "<state>/sessions/{agentId}.sqlite") and a local OpenAI-compatible endpoint on 127.0.0.1 so a due turn can complete offline. Same commands, same config shape, gateway restarted on origin/main sources for the before legs:

# AFTER (head)
$ openclaw cron add --name probe --at 45s --session session:agent:worker:dashboard:2b6f1c9a \
    --message ping --no-deliver                     # no --agent
No --agent specified; the job will run with agent worker, named by its session. …
{ "id": "08f3fffb-…", "agentId": "worker", "sessionTarget": "session:agent:worker:dashboard:2b6f1c9a", … }

[gateway] cron: job added
[auto-reply/reply-resolver-timing] … sessionKey=agent:worker:dashboard:2b6f1c9a agentId=worker … reason=before_run_prepared_reply
[event-loop] main-thread stall: task="reply.run_agent_turn" …
[local-provider] POST /v1/chat/completions #1 model=proof-model stream=true
$ ls <state>/sessions/   → worker.sqlite worker.sqlite-shm worker.sqlite-wal    # main.sqlite never opened

# BEFORE (origin/main, single configured agent so a default resolves — the reporter's leg)
No --agent specified; the job will run with the configured default agent. …
{ "id": "3eb6aa59-…", "name": "probe", … }                                     # no "agentId" at all
$ openclaw cron list --all --json   # after the due time
{ "enabled": false, "state": { "lastRunStatus": "error", "lastDurationMs": 17,
  "lastError": "cron job agent is unavailable: worker", "consecutiveErrors": 1,
  "autoDisabled": { "reason": "consecutive-failures" } },
  "effectiveAgentId": "main", "status": "disabled" }
$ ls <state>/sessions/   → main.sqlite main.sqlite.seal                         # worker's store never opened

# BEFORE (origin/main, two-agent roster) — the create never lands
{ "ok": false, "error": { "message": "invalid cron.add params: Multiple agents are configured, but
  this operation has no explicit owner. …" } }   exit=1

Not covered by the live run, stated plainly in the body: the provider is synthetic, so two agents with separate stored credentials were not exercised against a live provider, and creator-grant revocation mid-create was not replayed against the live gateway.

2. P1 — resolve the agent before declaration scope matching. Fixed at the root: the binding moved out of CronService.add and into cron.add admission, so matchesExisting now receives the same resolved input that gets persisted. src/cron/service/ops-mutations.ts is back to main — there is exactly one binding point. Verified live: an identical repeated --declaration-key daily-probe returns created: false, updated: true with the same job id (e7c47cde-…), no second row. cronJobMatchesDeclarationScope's input contract is pinned by a unit case, and the convergence is asserted through the real admission boundary.

3. P1 — select the execution agent before capturing inference. bindCronCreateExecutionAgent runs before prepareCronCreatorSession, captureCronCreatorSession, harness validation, caller-scope matching, declaration matching, and persistence, so inference capture and the stored owner share one agent. That leg is visible in the live run: with the patch the due turn resolves agentId=worker and only worker.sqlite is created; on main the run resolves effectiveAgentId: "main" against a worker session and dies in 17 ms.

4. P2 — unsupported management-create exception. Removed, together with the vi.fn()-fabricated manageAll test. Confirmed unreachable as described: CRON_MANAGEMENT_METHODS excludes cron.add, mintCronCreatorAuthorityGrant throws for a management method outside that list, getCronManagementAuthority only returns inside a redeemed method-bound management context, and the one other caller of cronCreateMatchesCallerScope (cron.update) passes a creatorScope built with manageAll: undefined. cronCreateMatchesCallerScope and applyCronCreateCallerScopeDefault are byte-identical to main now — creation restrictions are retained unchanged, and a scoped caller targeting a foreign session is still refused by cronPatchSessionRefsMatchCaller exactly as before.

5. Cross-agent authority at the final effect. The unauthorized-caller leg now runs through the supported admission boundary instead of a fabricated capability: handleGatewayRequest + cronHandlers["cron.add"] + a real CronService on an on-disk store, with a signed agent-runtime identity from the existing withModelTurn fixture. A main turn creating a job for worker's session is refused (job agentId outside caller scope) and nothing is stored; the same caller creating a job for its own session is accepted and stored under main. Revocation before provider I/O is still only covered by the existing commit-guard tests, not replayed live — flagged in "What was not tested".

6. Merge risk (credential / stale creator authority carried into the provider call). The mechanism that could carry it is gone: inference capture no longer resolves a different agent from the one that executes, because both read the same value bound once at admission. owner attribution is untouched — applyCronCreateCallerScopeDefault still records the creating caller as owner.agentId — and no run-time resolution, SQLite scope check, or delivery path changed. What I cannot claim from a synthetic provider is the account-mismatch behaviour between two agents with separate stored credentials; that is called out in the body rather than asserted.

7. Maintainer decision. This PR implements the review's recommended option 1 — infer the execution agent from a qualified session target at Gateway admission, before all execution preparation, while retaining existing agent-runtime creation restrictions. If the owner prefers option 2 (reject a contradictory agent/session combination and keep today's defaults), that is a small change to the same single call site: replace the binding with a refusal naming both agents and --agent. Happy to switch; the direction is the owner's call, not mine.

8. Data-model compatibility. Added: a row written by an older build (no agentId, session reference naming another agent) is loaded into the store, served by cron.get and cron.list, and is not rewritten — the blank owner survives unchanged. No migration, no reinterpretation of stored jobs.

Test-quality items. The fabricated manageAll case is gone (replaced by the admission-boundary coverage above). src/cron/agent-id.test.ts is reverted to main — the unchanged-precedence group is dropped and the helper-only cases are consolidated into the creation-boundary regressions (create-time execution agent in cron-caller-scope.test.ts). src/cron/service.session-ref-owner.test.ts is deleted; its coverage moved to the admission boundary.

RED/GREEN on the final base. Against origin/main 4b35c8fbe0b sources with this head's tests: gateway shard 7 failed | 40 passed, cli shard 1 failed | 64 passed. On head: validate.sh green end to end — oxfmt, oxlint, 3 vitest shards, tsgo:core. Full CI lanes are pending on this push.

Diff is now 8 files, +369/−6; the four source files account for +57/−3 (cron-caller-scope.ts +16/−0, agent-id.ts +21/−0, register.cron-add.ts +12/−2, cron-add.ts +8/−1) and the rest is tests.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Nov 2, 2026
A cron job created without --agent but with sessionTarget
"session:agent:<other>:..." was bound to the creating caller's agent (or left
to the configured default), while the due run resolves its session from
sessionTarget. With per-agent SQLite session stores the run then failed in
~0.1s with "SQLite session store path belongs to agent main; requested agent
worker." and a one-shot job was disabled as a permanent error.

Name the execution agent once at cron.add admission, before caller scope
matching, creator session and inference capture, declaration matching, and
persistence each read it, so a job is never prepared for one agent and stored
for another. An explicit --agent still wins, detached targets still fall back
to the caller or configured default, and an agent turn still cannot create a
job that another agent would execute. The CLI warning stops promising the
configured default agent when the job's own session names one.

Fixes openclaw#190123
- keep the `// SAFETY:` comment on the line directly above the
  `candidate as CronJobCreate` assertion in cron.add; the ratchet only
  recognises a standalone SAFETY comment on the preceding line, and the
  explanatory comment inserted between them made the existing exemption
  invisible (checks-fast-baseline-ratchets).
- pin the malformed-session-target loop in cron-caller-scope.test.ts to a
  const tuple so the literals keep their `CronSessionTarget` types instead
  of widening to `string` (check-test-types-core-2, TS2322).

No behaviour change.
@LiuwqGit
LiuwqGit force-pushed the feat/issue-190123-cron-session-ref-agent branch from 176dc7e to c9b5ca8 Compare November 2, 2026 04:35
@LiuwqGit

LiuwqGit commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

Two follow-ups on this head: the two CI failures were mine and are fixed, and the account leg the security note asked for is now proven against a real gateway.

1. CI — both failures were introduced by this PR, both fixed in c9b5ca8e25d

checks-fast-baseline-ratchets → assertion-safety: src/gateway/server-methods/cron-add.ts: 1 > 0.
The rework inserted an explanatory comment between the pre-existing // SAFETY: line and the candidate as CronJobCreate assertion. The ratchet only recognises a standalone SAFETY comment on the line immediately above the assertion operator, so an already-documented assertion started counting as a new uncommented one. Moved the SAFETY comment back onto the line directly above the assertion; the explanation now sits above it. No behaviour change.

check-test-types-core-2 → TS2322 at cron-caller-scope.test.ts(187,62).
The malformed-target loop iterated a plain array literal, so its elements widened to string and no longer satisfied CronSessionTarget. Pinned to a const tuple. Test behaviour unchanged.

Local verification — each failure reproduced first, then cleared:

# exact CI error, reproduced by reverting only the const tuple (shard: gateway-methods)
src/gateway/server-methods/cron-caller-scope.test.ts(187,62): error TS2322: Type 'string' is not assignable to type 'CronSessionTarget | undefined'.
exit=2

# same shard, cold tsbuildinfo, with the fix
node scripts/run-tsgo.mts -b test/tsconfig/tsconfig.core.test.gateway-methods.json --builders 1
exit=0

# assertion ratchet
node --import ./scripts/tsx.mjs scripts/check-assertion-safety-ratchet.mts --base origin/main
assertion SAFETY ratchet OK: 2381 files, 5412 grandfathered assertions.

# validate.sh over all eight changed files
[validate] 1/4 oxfmt ✅  2/4 oxlint ✅  3/4 vitest — passed 3 Vitest shards (65 CLI + gateway/cron suites)  4/4 tsgo:core ✅
[validate] 全部通过

Also rebased onto origin/main 36ddf502c84 (31 commits; upstream only touched the cron-cli.test.ts import block, no overlap with this diff). On the new head both check-test-types-core-2 and checks-fast-baseline-ratchets report SUCCESS.

2. Proof — distinct accounts at the final effect

The security note asked for target-derived account selection to be shown at its final effect, with two distinct accounts. New run, head c9b5ca8e25d, real openclaw gateway + real openclaw CLI from this branch's source, isolated state dir, per-agent SQLite stores, and a config where the two agents own separate provider credentials (main → localmain/proof-model-main, key tail 1111; worker → localworker/proof-model-worker, key tail 2222) served by one local endpoint that logs the Authorization header it receives:

$ openclaw cron add --name probe-worker --at 45s \
    --session session:agent:worker:dashboard:7c1a9f02 --message ping --no-deliver   # no --agent
No --agent specified; the job will run with agent worker, named by its session. …
{ "id": "3b5a8a91-…", "agentId": "worker", "sessionTarget": "session:agent:worker:dashboard:7c1a9f02", … }

$ openclaw cron add --name probe-main --at 45s \
    --session session:agent:main:dashboard:3d8b2c11 --message ping --no-deliver     # no --agent
No --agent specified; the job will run with agent main, named by its session. …
{ "id": "efb39461-…", "agentId": "main", "sessionTarget": "session:agent:main:dashboard:3d8b2c11", … }

# provider endpoint log — the account that actually served each dispatch
[fake-openai] chat/completions #1 account=worker-account keyTail=2222 model=proof-model-worker stream=true
[fake-openai] chat/completions #2 account=main-account  keyTail=1111 model=proof-model-main  stream=true

# gateway log — each due run resolved its own agent inside its own session
[auto-reply/reply-resolver-timing] … sessionKey=agent:worker:dashboard:7c1a9f02 agentId=worker totalMs=18600 …
[auto-reply/reply-resolver-timing] … sessionKey=agent:main:dashboard:3d8b2c11   agentId=main   totalMs=19937 …

$ ls <state>/sessions/
main.sqlite main.sqlite-shm main.sqlite-wal worker.sqlite worker.sqlite-shm worker.sqlite-wal
$ openclaw cron list --all --json    # after both due times
{ "jobs": [], "total": 0 }           # both one-shots ran and were deleted (deleteAfterRun)
$ grep -c "agent is unavailable\|autoDisabled\|SQLite session store path belongs" gateway.log
0

Each dispatch was served by the account owning the session the job targeted, and selection is per target rather than sticky: two jobs created 13 s apart in the same gateway bound two different accounts, both due runs completed, both one-shots were deleted after running, and neither the agent-availability guard nor the session-store scope guard fired.

Same two-account config, origin/main copies of the four touched source files, identical commands:

$ openclaw cron add --name probe-worker --at 45s \
    --session session:agent:worker:dashboard:7c1a9f02 --message ping --no-deliver
No --agent specified; the job will run with the configured default agent. …
{ "ok": false, "error": { "message": "invalid cron.add params: Multiple agents are configured,
  but this operation has no explicit owner. …" } }
exit=1                     # leg B (main's own session) refused identically
$ openclaw cron list --all --json → { "jobs": [], "total": 0 }
$ ls <state>/sessions/            → (empty — no session store was ever opened)
# provider endpoint log: zero chat/completions requests — no account was selected at all
[fake-openai] listening on http://127.0.0.1:18098/v1

So on main no account is reached because the work never lands; with the patch the account follows the target session.

Still not proven live, unchanged and stated in the body: the provider is synthetic, so a live provider's credential validation / profile availability / recorded-route checks were not exercised; and creator-grant revocation before provider I/O plus the agent-turn create leg are not reachable from the shipped CLI (they need a live model turn holding cron management authority), so they stay covered by the admission-boundary regressions rather than a live replay.

3. On the optional "remove duplicated helper-level tests" note

Kept deliberately. The create-time execution agent cases for "session:" and "session:\u0000" pin that resolveCronJobSessionRefAgentId names no owner instead of throwing out of a pure resolver. Those inputs can never reach the binder through admission — assertSafeCronSessionTargetId (src/cron/session-target.ts) rejects an empty or NUL-bearing session id during normalization — so the integration boundary structurally cannot cover that catch. The declaration-matcher case likewise pins the input contract of cronJobMatchesDeclarationScope (it receives the bound create), which is the exact defect the previous revision had; the integration test shows the outcome, the unit case shows the contract that produces it. Happy to drop them if the owner reads the duplication differently.

The owner question from the review (infer the execution agent from a qualified session target vs. reject the combination and keep today's defaults) is still the maintainer's call — this PR implements the recommended option 1, and switching to option 2 is a small change at the same single call site.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. label Nov 2, 2026
`automations add` now names the execution agent from the job's own
agent-qualified session reference before falling back to the configured
default, but the CLI guide still documented explicit `--agent`, then
`--session-key`, then default. Users scheduling into another agent's
conversation were given the wrong account-selection contract.

Spell out the create-time precedence, the warning it produces, and that
detached targets still fall through to the default — separately from
stored-job ownership, which resolves as before and is never reinterpreted.
The declaration-matcher case asserted a pure-function outcome that cannot
detect admission forgetting to call the binder, and the caller-restriction
case re-asserted both scope outcomes that the admission-boundary regression
already drives through `handleGatewayRequest` + a real `CronService`.
Repeated-declaration convergence and the foreign-agent refusal are covered
there.

Kept, narrowed to what nothing else pins: the creating caller stays the
recorded `owner` while execution routing follows the session's agent. The
explicit-agent, legacy-session-key and malformed-target contracts are
unchanged — a malformed `session:` target is rejected by normalization
before it can reach admission, so that catch is only reachable here.
@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Nov 2, 2026
@LiuwqGit

LiuwqGit commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up round on acd435275ff — the two items from the latest review that were mine to close. Docs and tests only; no runtime behaviour moved, so the gateway traces in the previous comment and in the body still describe this head.

P3 documentation finding — create-time ownership precedence. docs/cli/cron.md said automations add resolves ownership from an explicit --agent, then an agent-qualified --session-key, then the configured default, which is now the wrong account-selection contract for a create that names another agent's session. It states the create-time precedence separately from stored-job ownership:

At create time the execution agent resolves from an explicit --agent, then the job's own agent-qualified session reference — --session session:agent:<id>:… first, then an agent-qualified --session-key — then the configured default agent. A new job that names another agent's session therefore runs as that agent, and the warning names it instead of promising the default: No --agent specified; the job will run with agent <id>, named by its session. Detached targets (isolated, current, main) name no agent, so they still fall through to the caller scope or the configured default. … This create-time binding only names the agent a new job is stored with; ownership of an already-stored job keeps resolving as described for automations list above, and stored jobs are never reinterpreted or migrated.

The automations list ownership paragraph is deliberately untouched — stored-job resolution did not change. pnpm format:docs:check → Docs formatting clean (1412 files).

Low-value test note — removed the two duplicated helper cases, kept the one contract nothing else pins.

  • Gone: matches a repeated declaration only against the bound create input. As the review says, it asserts a pure-function outcome and cannot detect admission forgetting to call the binder; convergence onto the same job id is driven through the real admission boundary in cron.gateway-policy.integration.test.ts (stores the session's agent and converges a repeated declaration onto that job).
  • Gone: the cronCreateMatchesCallerScope true/false pair from keeps creation restricted to the caller's own agent — both outcomes are covered by still refuses an agent caller a job that another agent would execute, which goes through handleGatewayRequest + cronHandlers["cron.add"] + a real CronService on an on-disk store.
  • Kept, narrowed and renamed to keeps the creating caller as the recorded owner while execution follows the session: the owner.agentId: "main" / agentId: "worker" attribution assertion. I checked before keeping it — applyCronCreateCallerScopeDefault has no other test in the repo (rg -l applyCronCreateCallerScopeDefault src test returns only its definition, its one caller, and this file), and origin/main's copy of cron-caller-scope.test.ts has zero owner assertions. Creator attribution staying separate from execution routing is the property the compatibility merge-risk note turns on, so dropping it would leave that contract untested rather than covered elsewhere. Say the word if the owner reads it differently and I will drop it too.
  • Retained as the review asked: the explicit-agent, legacy-sessionKey, and malformed-target contracts. The malformed cases ("session:", "session:\u0000") are only reachable at this level — assertSafeCronSessionTargetId rejects an empty or NUL-bearing session id during normalization, so admission never sees them; what they pin is that resolveCronJobSessionRefAgentId names no owner instead of throwing out of a pure resolver.

Verification on this head:

validate.sh src/gateway/server-methods/cron-caller-scope.test.ts
[validate] 1/4 oxfmt ✅  2/4 oxlint ✅  3/4 vitest — passed 1 Vitest shard (10 tests)  4/4 tsgo:core ✅  → 全部通过
node scripts/run-tsgo.mts -b test/tsconfig/tsconfig.core.test.gateway-methods.json --builders 1   exit=0
node --import ./scripts/tsx.mjs scripts/format-docs.mts --check   → Docs formatting clean (1412 files).

Still open, and not mine to close: the owner decision on target-derived creation binding (this PR implements the review's recommended option 1; option 2 is a small change at the same single call site), the revoked/reassigned-authority final-effect leg (needs a live model turn holding cron management authority — not reachable from the shipped CLI, so it stays on the admission-boundary regressions and is stated in the body), and a v2026.10.9 upgrade against a store with real schedules and run history (this environment has no npm-installed gateway I can safely upgrade; the legacy-row fixture proves read-without-rewrite only for that fixture, as the body says).

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@LiuwqGit

LiuwqGit commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

Third round on acd435275ff: the data-model compatibility ask, answered with a real store instead of a read fixture. CI is green on this head.

Upgrade leg — store seeded by the pre-change build, carried over to this one

A gateway running origin/main copies of the four touched files created two recurring jobs on the two-account config and ran them for real. The gateway was then stopped and restarted on this branch's sources against the same state dir — no migration step, no store edit, no re-create:

# phase 1 — origin/main sources (bindCronCreateExecutionAgent absent: 0 occurrences)
$ openclaw cron add --name nightly-worker --agent worker --cron "*/5 * * * *" \
    --session session:agent:worker:dashboard:7c1a9f02 --message ping --no-deliver
$ openclaw cron add --name heartbeat-main --agent main --cron "* * * * *" \
    --session session:agent:main:dashboard:3d8b2c11 --message ping --no-deliver
# 95 s later, real run history recorded
$ openclaw cron runs be00bb1d-… --json → 1 entry: runAtMs=1793597640021 status=ok provider=localmain
$ openclaw cron runs d5a69190-… --json → 0 entries (not due yet)

# phase 2 — same state dir, this branch's sources; listed BEFORE any new run had a chance to happen
{ "id": "be00bb1d-a65a-4c18-9a60-41db35cf0fb6", "name": "heartbeat-main", "agentId": "main",
  "enabled": true, "schedule": { "kind": "cron", "expr": "* * * * *" },
  "sessionTarget": "session:agent:main:dashboard:3d8b2c11",
  "state": { "lastRunStatus": "ok", "lastRunAtMs": 1793597760008 } }   # phase-1 history, intact
{ "id": "d5a69190-0a29-4aba-9a14-47c4df1efefb", "name": "nightly-worker", "agentId": "worker",
  "enabled": true, "schedule": { "kind": "cron", "expr": "*/5 * * * *" },
  "state": { "lastRunStatus": "ok", "lastRunAtMs": 1793597700018 } }

# 95 s later — the upgraded build ran the stored schedules itself
$ openclaw cron runs be00bb1d-… --json → runAtMs=1793597820004 status=ok provider=localmain
                                         runAtMs=1793597880005 status=ok provider=localmain
                                         model=proof-model-main sessionKey=agent:main:dashboard:3d8b2c11
$ openclaw cron runs d5a69190-… --json → runAtMs=1793597700018 status=ok provider=localworker
                                         model=proof-model-worker    # phase-1 entry preserved

# one endpoint, two accounts, across both phases — 6 completions, 0 errors
[fake-openai] chat/completions #1 account=main-account   keyTail=1111 model=proof-model-main
[fake-openai] chat/completions #3 account=worker-account keyTail=2222 model=proof-model-worker

config sha256 before upgrade: 93b6cb2ec899a6efc61182258e94bc1e5570d7b09cb80227b720c9249afc55ed
config sha256 after  upgrade: 93b6cb2ec899a6efc61182258e94bc1e5570d7b09cb80227b720c9249afc55ed
job ids identical across the two builds: true   (agentId, schedule, enabled, sessionTarget too)

Settings, schedules, ownership and run history all survived the swap, and the upgraded build kept executing the stored schedules under each job's own account. Nothing was restamped: both jobs were created with an explicit --agent and both kept exactly that agentId.

Limits of this leg, stated plainly: the store was seeded minutes before the swap by a gateway built from origin/main sources, not by an npm-installed 2026.10.9 package upgraded in place, and it is not a long-lived production store with months of history. Both builds are 2026.10.9 (package.json on origin/main and on this branch alike), so the store format is the one a 2026.10.9 user has. This environment has no npm-installed gateway I can safely upgrade (the desktop ships a openclaw-gateway.service whose state dir I am not going to touch), so an in-place package upgrade was not performed.

CI on this head

Both failures this revision started from are green, and so is the aggregate:

pass | check-test-types-core-2
pass | checks-fast-baseline-ratchets
pass | PR context and evidence
pass | openclaw/ci-gate
60 pass / 0 fail / 0 pending   (the one CANCELLED entry is the `auto-response` bot workflow,
                                superseded by these body/comment edits — not a code gate)

What is still open, and why it is not mine to close

  • Revoked / reassigned authority producing no provider HTTP request. This needs a live model turn holding cron management authority, with the grant revoked or replaced mid-create or while the occurrence is queued. The shipped CLI cannot mint, revoke or reassign that grant — cron add over token auth arrives as an operator, not as an agent runtime — so there is no CLI-reachable sequence that exercises it. What exists is the admission-boundary regression (still refuses an agent caller a job that another agent would execute, driven through handleGatewayRequest + cronHandlers["cron.add"] + a real CronService on an on-disk store, asserting nothing is persisted) plus the pre-existing creator-revocation commit-guard tests. If the owner wants the negative path at provider I/O, that needs a harness that can drive a real agent turn with cron authority — happy to build it if that is the preferred route, but it is a test-infrastructure change well past this fix's scope, so I am flagging it rather than sneaking it in.
  • The ownership-precedence decision. Still the area owner's call: infer the execution agent from a qualified session target (this PR, the review's recommended option 1) or reject the combination and keep today's defaults (option 2, a small change at the same single call site). Nothing I can add settles that.

Body updated with the upgrade leg, its limits, and the current CI state.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@LiuwqGit

LiuwqGit commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

Round four on acd435275ff (no new commits — this is evidence only). The review's objection to the previous upgrade leg was fair: "does not upgrade from released v2026.10.9; equal package version strings do not establish equivalent release contents." So the leg was redone against the actual released package.

Upgrade from the npm-released [email protected]

The registry tarball (openclaw-2026.10.9.tgz, 103 MB, dist/ + production deps installed with scripts disabled) self-reports OpenClaw 2026.10.9 (8b18b55) — a release build, not this branch. Its gateway seeded a real store on the two-account config; the gateway was then stopped and this branch's sources started against the same state dir, with no migration step, no store edit and no re-create:

# phase 1 — RELEASED openclaw 2026.10.9 (8b18b55)
$ openclaw cron add --name nightly-worker --agent worker --cron "*/5 * * * *" \
    --session session:agent:worker:dashboard:7c1a9f02 --message ping --no-deliver
→ { "id": "97943cac-bd90-430c-833a-4911d2d1b483", "agentId": "worker", … }
$ openclaw cron add --name heartbeat-main --agent main --cron "* * * * *" \
    --session session:agent:main:dashboard:3d8b2c11 --message ping --no-deliver
→ { "id": "d62487d1-669d-4b5e-aa0e-1556cb705fcc", "agentId": "main", … }
# run history the released build recorded itself
$ openclaw cron runs d62487d1-… --json → 2 entries runAtMs=[1793599440052, 1793599500049]
                                         status=[ok, ok] provider=[localmain, localmain]
$ openclaw cron runs 97943cac-… --json → 1 entry  runAtMs=1793599500026 status=ok
                                         provider=localworker model=proof-model-worker

# phase 2 — this branch's sources (acd435275ff), same state dir, listed BEFORE any new run
{ "id": "d62487d1-…", "agentId": "main",   "enabled": true, "schedule": { "expr": "* * * * *" },
  "state": { "lastRunStatus": "ok", "lastRunAtMs": 1793599500049 } }   # released history intact
{ "id": "97943cac-…", "agentId": "worker", "enabled": true, "schedule": { "expr": "*/5 * * * *" },
  "state": { "lastRunStatus": "ok", "lastRunAtMs": 1793599500026 } }
{ "id": "e8e6bebb-85e2-40ae-893b-8e90c839d965", "agentId": "main", "sessionTarget": "main",
  "enabled": true }        # the gateway's own heartbeat job, created by the released build, intact

# 100 s later — the branch build ran the released build's stored schedules itself
$ openclaw cron runs d62487d1-… --json → 4 entries
    runAtMs=[1793599620033, 1793599560025, 1793599500049, 1793599440052]   # 2 new + 2 preserved
    status=[ok, ok, ok, ok]  provider=[localmain ×4]  model=[proof-model-main ×4]
    sessionKey=[agent:main:dashboard:3d8b2c11 ×4]
$ openclaw cron runs 97943cac-… --json → 1 entry runAtMs=1793599500026 provider=localworker
                                         (the released build's entry, unchanged, not rewritten)

ids identical across the two builds:   true      createdAtMs identical: true
agentId identical (no restamping):     true      schedules identical:   true
config sha256 released build: 1487b18e4a2e4c2ad632039e53749c19c7a9c2818440cff5b7a73067a1762486
config sha256 branch build:   1487b18e4a2e4c2ad632039e53749c19c7a9c2818440cff5b7a73067a1762486
gateway-log matches for "agent is unavailable" / "autoDisabled" /
  "SQLite session store path belongs" / "lastError", both phases: 0

Settings, schedules, ownership, the gateway's own heartbeat job and every pre-existing run-history entry survived the released→branch handover, and the branch build kept executing those stored schedules under each job's own provider account.

Two honesty notes on this leg. The per-run provider / model fields quoted above are the gateway's own recorded attribution; the endpoint-side account log for this run was lost to a port conflict with a leftover process from an aborted first attempt, so I am not citing it (the earlier two-account leg in the previous comment has the endpoint-side log). And the released package was run from an extracted tarball with its production deps installed, not through a system-wide install with systemd units, so an in-place npm i -g upgrade path was not exercised; both stores were also seeded minutes before the handover rather than being long-lived.

Where this leaves the five items

  • Data-model compatibility — now demonstrated from a released 2026.10.9 store rather than a read fixture or a source-build store.
  • Authority negative path at provider I/O (the security concern and the merge-risk item) — still not closable from here, for the reason given last round: it needs a live model turn holding cron management authority whose grant is revoked or replaced mid-create or while the occurrence is queued. cron add over token auth arrives as an operator, so the shipped CLI cannot mint, revoke or reassign that grant, and no sequence of CLI calls reaches the path. What exists is the admission-boundary regression (foreign-agent caller refused, nothing persisted, driven through handleGatewayRequest + cronHandlers["cron.add"] + a real CronService on an on-disk store) plus the pre-existing creator-revocation commit-guard tests. Building a harness that drives a real agent turn with cron authority is test-infrastructure work well past this fix's scope, so I am flagging it rather than improvising something that looks like proof and is not.
  • Maintainer decision on target-derived creation binding — the owner's call; this PR implements the review's recommended option 1, and option 2 is a small change at the same single call site.

CI on this head is green: 61 pass / 0 fail / 0 pending, including check-test-types-core-2, checks-fast-baseline-ratchets, PR context and evidence and openclaw/ci-gate. Body updated with this leg and its limits.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@LiuwqGit

LiuwqGit commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

Round five on acd435275ff — evidence only, no new commits: the touched source files are unchanged since the last review, so CI and every earlier trace still describe this head. This round replays the authority chain the review asked for — allowed and nearest-forbidden cases with provider-request observations, through the production owners, against a synthetic HTTP endpoint — using a real agent turn as the automation caller instead of the operator CLI.

Setup

Real gateway from this branch's source, isolated state dir, two agents owning separate provider credentials (main → key tail 1111, worker → key tail 2222), both served by one local OpenAI-compatible endpoint that logs the Authorization header it receives. New in this round: tools.gatewayPolicy.automations.scope: "caller", so a real openclaw agent --agent main model turn — with its signed agent-runtime identity — is the automation caller, and the endpoint serves a scripted automations add tool call so the create travels the production path (model stream → tool dispatch → in-process cron.add admission → persistence → scheduled occurrence → provider HTTP).

Case A — allowed: the turn creates a job for its own agent's session

$ openclaw agent --agent main --session-key agent:main:proof-chat-allowed \
    --message "R5_ALLOWED_MAIN: create the automation now" --json
{ "runId": "2c8a73c1-…", "status": "ok", "summary": "completed",
  "agentMeta": { "sessionFile": "agent:main:proof-chat-allowed",
                 "provider": "localmain", "model": "proof-model-main" } }

[gateway] cron: job added                       # production admission accepted the bound create
$ openclaw cron list --all --json
{ "id": "a8f948ad-df46-4a2f-8691-dc5eede99c61", "name": "r5-allowed-main",
  "agentId": "main", "enabled": true,
  "sessionTarget": "session:agent:main:proof:due", "schedule": { "kind": "at", … } }

# the due run — served by main's account, keyTail=1111
[fake-openai] chat/completions #3 model=proof-model-main keyTail=1111 route=text tools=[]
$ openclaw cron runs a8f948ad-… --json
{ "action": "finished", "status": "ok", "completionStatus": "succeeded",
  "durationMs": 6218, "model": "proof-model-main", "provider": "localmain" }

The due run fired after the creating turn had completed normally — a normally completed creator turn keeps its legitimately captured persistent authority, and that authority reaches the provider. That is the exact distinction the review drew ("normal creator-turn completion must not be treated as revocation"), shown positively.

Case B — nearest-forbidden: the same turn targets worker's session

$ openclaw agent --agent main --session-key agent:main:proof-chat-forbidden \
    --message "R5_FORBIDDEN_WORKER: create the automation now" --json
[gateway] [tools] dispatch_action failed: GatewayClientRequestError:
  invalid cron.add params: job agentId outside caller scope | INVALID_REQUEST
{ "runId": "e8d70282-…", "status": "ok", "summary": "completed" }   # the turn completed with the rejection
$ openclaw cron list --all --json              → { "jobs": [], "total": 0 }
$ grep -c "keyTail=2222" <endpoint log>        → 0     # worker's account was NEVER used
$ ls <state>/sessions/                          → main.sqlite …   (no worker.sqlite, ever)

The create reached the production cron.add admission and was refused there (job agentId outside caller scope — the gateway log line, not a test assertion), nothing persisted, and the endpoint observed zero requests under worker's credentials for the entire run; the only session store ever opened is main.sqlite. This is the final-effect negative proof for the changed account-selection boundary: a caller that would have made another agent's account pay never gets a provider request.

Case C — revoked mid-create: the identical allowed create, aborted while in flight

# driver: sessions.abort fired 10ms after the endpoint finished serving the tool-call stream
12:56:32.781  [endpoint] chat/completions #6 model=proof-model-main keyTail=1111 route=revoked  (stream done)
12:56:32.791  transcript seq 7: assistant toolCall dispatch_action → automations add (recorded, dispatched)
12:56:32.797  driver fires sessions.abort
12:56:32.985  [gateway] sessions.abort requested … session=agent:main:proof-chat-revoked-1
12:56:33.162  [diagnostic] lane task error: agent run aborted … sessionKey=agent:main:proof-chat-revoked-1
              → no tool result event in the transcript; no continuation request ever reached the endpoint
$ openclaw cron list --all --json              → { "jobs": [], "total": 0 }
$ grep -c "due-revoked\|keyTail=2222" <endpoint log> → 0

The same create shape that persisted in Case A, with the creator authority revoked while the create was in flight (tool call recorded at :32.791, abort processed at :32.985, no tool result ever recorded): nothing persisted and no provider request was issued for the job. The transcript shows the tool call was dispatched and never returned — the revocation landed inside the create, before commit.

Still not replayed live, stated plainly

  • Reassigned authority (rotated lifecycle generation): that rotation happens at an in-process gateway restart, which kills in-flight work by process death; not meaningfully replayable from outside.
  • Queued-execution revocation (an occurrence waiting for exec approval whose creator authority is revoked): the mid-create replay above plus the existing admission-boundary and creator-revocation commit-guard tests are what cover it; no live replay of the queued window was attempted.
  • The provider is synthetic, so these observations show that no request reaches the account at all; a live provider's own-side records were not consulted.

The PR body's Evidence section now carries this round (three cases, one gateway run, timestamps and log lines as above), and the "What was not tested" / "Proof limitations" entries were updated to say the agent-turn create leg, the foreign-agent rejection at provider I/O, and mid-create revocation are now replayed live — reassigned and queued-execution revocation are the honest remainder. The maintainer decision on target-derived creation binding is unchanged and still the owner's call; this PR implements the review's recommended option 1.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

1 participant