Skip to content

fix(automations): allow explicit native CLI account adoption - #190904

Merged
vincentkoc merged 4 commits into
mainfrom
fix/cron-explicit-native-account-20261102
Nov 2, 2026
Merged

vincentkoc merged 4 commits into
mainfrom
fix/cron-explicit-native-account-20261102

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Closes #190902

What Problem This Solves

Fixes automation edits rejecting an explicitly selected native Claude CLI login when the job already records a stored inference account.

User Impact

An authorized operator can select anthropic/<model>@anthropic:claude-cli in place, preserving the automation ID, history, owner and tool cap. Ordinary model/default changes keep the stored account. Incompatible recorded or carried runtimes still reject the change.

The CLI remains responsible for its own login. This does not forward stored credentials, change defaults, or preserve requester grants invalidated by an operator model edit.

Why This Change Was Made

The shared CLI selector collapsed recognized native login and missing account into the same empty result. Preserve that distinction at selection, validate the runtime the job will actually use after clearing its binding, and carry an explicit private clear through the existing Gateway and SQLite mutation flow. Declarative re-registration cannot clear an existing account.

Scheduled-run preparation also sent native login IDs through stored-account validation. Preserve recognized native choices using the prepared runtime's canonical CLI policy, then let CLI dispatch consume them. Ordinary stored-account resolution, including session-pin precedence, remains with its existing owner.

Also clarify that an explicit automation model takes precedence over a carried session preference without deleting that preference.

Evidence

  • Gateway regression exercises real cron.add / cron.update, SQLite close/reopen, run history, the account-scoped tool ceiling, and the original stored credential remaining usable.
  • Rejection cases cover missing/foreign profiles, incompatible recorded runtime, and current/session targets whose post-clear runtime conflicts with the native choice.
  • Existing isolated-runner coverage now checks stored-to-native adoption reaches Claude CLI with native-only authentication, no forwarded profile and the same tool cap. Runtime resolution is real; generic auth resolution is real if reached. A separate real-resolver case preserves session-account precedence over an unavailable configured stored profile. No real Claude process is launched.
  • Targeted formatting, normal commit hooks and git diff --check pass. Focused Testbox capacity queued and was stopped before tests ran; local dependencies were not qualified.
  • Initial CI at 4e475d7f3d8 completed 40 successful jobs. The new native scheduled-run test failed and blocked the gate, exposing the preparation gap above, repaired in 202175a2cf2.
  • CI at 202175a2cf2 completed 40 successful jobs. The scheduled-agent group passed 87 tests in eight files (113.32 seconds), including native-only execution and stored session-pin precedence. Test typing failed because the new fixture used an incomplete, loosely typed harness helper. Adding its missing fields in 7b120ff7015 exposed the helper's skillsSnapshot: unknown type; 857a59afef7 replaces both loose helpers with concrete session fixtures. Production code and assertions are unchanged. Scoped autoreview is clean.
  • Current-head CI at 857a59afef7 completed successfully: 44 successful jobs, 27 skipped, zero failed. The scheduled-agent job passed 87 tests in eight files (117.42 seconds), including native-only adoption (907 ms) and stored session-pin precedence (441 ms). The corrected core test-type job passed too. Native landing retains the separate OpenGrep scan and other required checks.
  • Independent source review identified the post-clear runtime issue and an overly broad account probe; both are repaired. Full local autoreview of the corrected candidate (P0–P2 against 953e7a8403981c5b4f210eb8e89db885146695b6) found no additional working-tree defects. Its sole INDEX-only finding was the unstaged correction; the exact reviewed files were then staged and committed.
  • Production delta: +60 lines, for explicit native-account transition, runtime ownership checks and scheduled selection handoff. Regression/test support delta: +252 lines with a task-specific test budget record. No schema or configuration changes.

Live authentication and channel delivery are not claimed by this PR.

Follow-up audit: explicit non-native profile selection on the empty-auth-store fast path in resolveCronAuthSelection. This PR covers native adoption; the separate fast-path case still needs runtime reproduction.

@vincentkoc vincentkoc self-assigned this Nov 2, 2026
@clawsweeper

clawsweeper Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review in progress

ClawSweeper is reviewing this revision. This supersedes any previous blocked status.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime commands Command implementations agents Agent runtime and tooling size: M labels Nov 2, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review November 2, 2026 06:03
@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 857a59afef7caa05e8041641789b27025cee7a71
  • Maintainer: @vincentkoc
  • Repository role: admin

These security sensitive changes were made:

  • src/agents/cli-execution-auth.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/model-auth-availability.cli-runtime.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.

Carefully review these changes before merging.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 2, 2026
@vincentkoc
vincentkoc merged commit f691027 into main Nov 2, 2026
146 checks passed
@vincentkoc
vincentkoc deleted the fix/cron-explicit-native-account-20261102 branch November 2, 2026 06:50
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 3, 2026
…w#190904)

* fix(automations): allow explicit native CLI account adoption

* fix(automations): preserve native account through run preparation

* test(automations): complete pinned session fixture

* test(automations): use concrete session fixture types
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime security-sensitive-changed size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(automations): explicit native CLI account selection cannot replace a stored account

1 participant