Repository navigation
fix(meta): Muse subscription sign-in cannot be finished from chat and turns are rejected after sign-in - #180831
ivankuznetsov wants to merge 9 commits into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: ready, awaiting a maintainer decision. What this changesThis PR enables Muse device-code sign-in from private chat, persists agent-scoped runtime routing, and fixes blank endpoint facts that reject Muse turns. Example: An owner sends /login meta in a Telegram private chat, then selects meta/muse-spark-1.3.
Review scores
ProductKind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Complete Merge readiness⏳ Ready, awaiting maintainer decision Keep this PR open: it addresses real Muse routing failures, the previous findings are resolved, and no new correctness defect was found; the expanded chat-login contract still needs its feature owner's decision. Priority: P1 Decision needed
Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherProvider metadata selects the login flow; shared authentication persists its routing result, and harness selection uses endpoint facts to admit subsequent model turns. flowchart LR
A[Private chat login] --> B[Provider choice metadata]
B --> C[Meta device authorization]
C --> D[Shared auth persistence]
D --> E[Agent runtime policy]
E --> F[Harness support decision]
F --> G[Muse model turn]
Technical reviewBest possible solution: Obtain the provider-auth owner's decision on scoped native chat sign-in, then land the supported routing and endpoint repair once required CI passes. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the setup-only chat projection and blank-endpoint rejection path; the contributor supplies before/after observations, but this read-only review ran no target code. Is this the best way to solve the issue? The patch repairs the existing projection, persistence, completion, and support owners without adding a separate runtime manager; enabling profileless chat activation is an explicit product extension rather than an established credential-only contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 6587c9fd2125. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +210, Tests +359, Docs +8, Other +7. Total +584 across 18 files. Added test files: 1. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (5 earlier review cycles)
Reviewed November 23, 2026, 9:27 AM ET / 14:27 UTC (Revision 6). |
a604582 to
1754e1c
Compare
The Muse subscription sign-in could only be activated through Control UI guided setup: the muse-code choice was not opted into chat, the channel projection treated every non-credential-only login as setup-only, and credential-only login persistence dropped the result's declared agentRuntimeId, so a completed sign-in kept resolving to the default API runtime. Opt muse-code into channel login, honor explicit channelLogin declarations for harness-owned sign-ins, stage the declared runtime as per-agent model policy like guided setup does, and stop blank prepared native baseUrls from masking the configured endpoint in harness support facts (which made the Muse harness reject every turn).
1754e1c to
8ca4dff
Compare
|
@clawsweeper re-review Updates since the last review:
|
|
🦞👀 Re-review progress:
|
Conflicts: src/commands/models/auth.ts, auth.test.ts and src/plugin-sdk/provider-auth-login-flow-runtime.ts. Upstream openclaw#190019 replaced the post-login model-access consent with allowLoginProviderModels; a harness sign-in that stages its runtime policy now takes that path too, and the login result carries both modelAccess and stagedRuntimePolicy. The consent regression is ported to assert the provider wildcard instead. Upstream folded auth-authority.test-support into auth.test.ts, so that import is dropped; auth.test.ts gets a max-lines override for the staging tests that share its fixture. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…runtime On a non-credential-only login, spreading the staged runtime patch over the provider's agents.entries replaced the whole agent entry, so a provider's own model settings (alias, params, sibling models) never reached persistence. Staging now merges the runtime into the provider's model entry instead. Regression "keeps the provider's own agent model settings when the CLI path stages its runtime": fails before (only agentRuntime survives), passes after. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@clawsweeper re-review Changes on head
|
|
🦞👀 Re-review progress:
|
Telegram's native /login treated every result without a credential profile as a failed account switch, so a successful Muse sign-in said "This chat kept its previous account". Harness-owned sign-ins save no profile and stage runtime routing instead; there is no account switch to fail. Match the chat /login handler: only a profiled result without a matching profile is a failed switch, and a profileless result that staged nothing hands off to setup instead of reporting success. Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # src/commands/models/auth.ts # src/plugin-sdk/provider-auth-login-flow-runtime.ts
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
# Conflicts: # docs/plugins/manifest/setup-and-auth.md
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
What Problem This Solves
Fixes:
/login metain chat can never start the Muse device-code subscription sign-in (it always hands off to Control UI guided setup), and even after a successful sign-in every turn onmeta/muse-spark-1.3fails — first with missing-auth errors on the wrong runtime, then withRequested agent harness "muse" does not support meta/muse-spark-1.3.User Impact
User impact: users can add and authorize Meta Muse models end-to-end in Telegram (device-code in the browser, no API key or secret handling in chat), and signed-in models actually run. Control UI guided setup behavior is unchanged. Security boundaries are preserved: nothing starts in chat without the plugin's explicit
channelLoginopt-in (the same mechanism GitHub Copilot, xAI, MiniMax, and Codex device-code already use), API-key entry still hands off to secure setup, and no credentials pass through chat.Why This Change Was Made
Four stacked gaps, each fixed at its layer:
muse-codechoice never declaredchannelLogin, so chat could not start it.projectChannelChoiceonly computed a login kind forcredentialOnlychoices; harness-owned sign-ins (no credential profile saved — the credential lives in the Muse CLI) always projected to setup-only even with an explicit chat opt-in.agentRuntimeId, so the model kept resolving to the default API runtime. It now stages the same per-agent model runtime policy guided setup writes (prepareSetupModelRuntime), scoped to the signing-in agent and the login's own default model, ignored for the defaultopenclawruntime. The persistence owner (runProviderAuthMethod) reports the staging outcome (stagedRuntimePolicy) itself, so chat completion and model-access consent do not reconstruct it from result metadata that the credential-only path drops. Runtime-plugin repair after the write receives the login's agent and authority: before each package, marker, or install-record effect, it reruns the caller'sbeforePersistentEffectandassertCurrent.baseUrl, which masked the configured official Meta endpoint in harness support facts whileendpointOverrideswas derived from that same config — the Muse harness therefore rejected every turn. Blank prepared baseUrls now fall back to the configured endpoint (live diagnostic before the fix:rt=muse provider=meta transport=none endpoint=present baseUrl= api=openai-responses).Evidence
Resolved head
6892508c688(2026-11-23).af7f1a5026cmerges currentmain(38f4f8fe018). Its one conflict was the manifest field table indocs/plugins/manifest/setup-and-auth.md. It keeps main's newchoiceLabelandappGuidedActionLabelwording and this PR'scredentialOnlyandchannelLoginrows.6892508c688folds one test callback onto a single line, soauth.test.tsstays under its 1016-line cap after main's edits to that file. Checks on this head: the five test files this PR touches (bot-native-command-login,commands-login,auth.test.ts,provider-login-options,harness/selection) all pass, 190 tests.tsgo:coreandtsgo:extensionspass, and oxlint, oxfmt andgit diff --checkare clean on the changed files.Previous head
a65800e4a42, which merges currentmain(8ab24647379, version 2026.11.6). There were two conflicts:auth.ts: upstream dropped an OpenAI tip and reformatted the call. Kept upstream's call and this PR'sstagedRuntimePolicy.provider-auth-login-flow-runtime.ts: upstream removedparseModelsAuthLoginFlowResultand now returns the typed result directly. Removed it here too;stagedRuntimePolicyflows through the typedModelsAuthLoginFlowResult.[P3] Profileless harness sign-in in Telegram's native adapter (
45d76dd0ef1). A Muse sign-in saves no credential profile, so there is no account switch that can fail. The adapter now applies the same rule as the chat/loginhandler:Tests "reports a harness-owned sign-in that saves no credential profile as complete" and "hands a profileless sign-in that saved nothing usable to setup" fail on the previous head and pass on this one. Live check: (C4) below.
Tests on this head: the Telegram
bot-native-command-login,commands-loginandprovider-auth-login-flow-runtimesuites, 46 tests, all passing. With #202564 and #180830 combined: 131 tests, all passing.tsgocore and extensions are clean.[P2] Keep the provider's agent model settings when staging its runtime (
de2e57b6a04).auth-runtime-staging.tsmerges the stagedagentRuntimeinto the provider's own model entry instead of replacing the agent entry. Regression "keeps the provider's own agent model settings when the CLI path stages its runtime": before the fix onlyagentRuntimesurvived; after it, the alias and params are kept.[medium] Chat-owner authority through final effects. Upstream already proves both halves with real effects: the doctor repair stops before the npm install, the marker and the install record when the hook refuses, and the ids-based repair fences real index writes on revocation. This PR's test shows the login passes its hook into that repair. A single unit test from login through a real npm install would need a registry-served
@openclaw/musepackage. Live owner revocation is shown below (C3).Earlier fixes, still on this head:
ClawSweeper findings fixed on this head (
src/commands/models/auth.test.ts):runProviderAuthMethodnow returnsstagedRuntimePolicyonce the staged policy is persisted (or already present).runModelsAuthLoginFlowpasses it through instead of re-deriving it fromresult.agentRuntimeId, which credential-only results drop. Regression "reports the persisted runtime staging to chat for credential-only harness sign-ins": without the fix,expected undefined to be true; with the fix it passes. (Red runs used this head's tests with only the fix reverted, before the module extraction, which is behavior-preserving.) The cross-provider test now also asserts that nothing is reported staged.repairModelSelectionRuntimePluginsacceptsbeforePersistentEffect, and its internal repair chain already forwards that hook to its dependency-marker, payload-retirement, and install-record effects. The login passes a hook that reruns its ownbeforePersistentEffectandassertCurrent, plus the login'sagentId, so the agent-scoped staged policy is the one the repair evaluates. Regression "rechecks login authority before runtime-plugin repair effects" revokes authority while repair is pending. Without the fix, the login resolves and the repair effect runs; with the fix, the login rejects with "Login authority ended." and no effect runs.Data-model compatibility. New test "keeps an existing stored config intact and valid when a chat harness sign-in stages its runtime". It starts from a config shaped like those earlier releases persisted: an authored
agents.entries.mainwithworkspaceand per-modelalias/params, anagents.defaults.model.primary, and an unrelated enabled plugin. The test checks that config validates, runs a chat (credential-only) harness sign-in, then asserts:agentRuntimeis added to the signed-in model's existing entry;validateConfigObject.No schema or migration changes. Session rows and auth-profile stores are not touched by this PR. The test passes both before and after the finding fixes; it proves preservation and is not a regression for a bug.
Focused suites (
node scripts/test-projects.mts <files> --maxWorkers=1), all passing. After the merge: 6 files, 209 tests. On this headauth.test.tsis 48/48. The combined proof branch ran all three PRs' focused suites: 21 files, 598 tests, 0 failed.src/commands/models/auth.test.tssrc/auto-reply/reply/commands-login.test.tssrc/plugins/provider-login-options.test.tssrc/agents/harness/selection.test.tssrc/plugin-sdk/provider-auth-login-flow-runtime.test.tssrc/commands/promos/claim.test.ts(the otherrepairModelSelectionRuntimePluginscaller)tsgocore and thecommandstest project are clean.oxlint,oxfmt, and the pre-commit line-cap ratchet pass. To stay within the line caps, the PR's runtime-staging computation moved unchanged fromauth.tsintosrc/commands/models/auth-runtime-staging.ts, and its tests moved intoauth-runtime-staging.test-support.ts, whichauth.test.tsregisters.Live verification on a real Telegram + gateway install, before/after on the same account:
/login metaanswered "Meta API key needs provider setup. Open Control UI…". After an out-of-band sign-in, turns failed with missing-auth on the API route, then withRequested agent harness "muse" does not support meta/muse-spark-1.3.Live proof
Real Telegram private chat with a live Gateway on 2026-11-20. The Gateway ran upstream
main8479dacd2e1merged with #180828, #180830 and #180831 (combined build28efb83; the three PRs were merged together because the author runs them together). Telegram IDs and device codes are redacted. Screenshots are hosted at ivankuznetsov/openclaw@224a663.C1: owner sign-in from a private chat. Selecting a Muse model that isn't signed in offers Sign in (#180828). The device code appears in chat, and after approval the chat says
Meta login complete./model meta/muse-spark-1.3then repliesRuntime set to muse, and a turn reaches Meta through the Muse runtime. Meta answered429 … Subscription quota exhausted, which shows the signed-in account works. A completed reply is in C5. No consent prompt appears, because upstream #190019 now allowlists the provider's models at sign-in.museFinding outside this PR: after
). The config had a credential-less
). Tracked in #201818..
Meta login complete, the models still showedSign-in needed(models.providers.metaAPI route, andmodel-catalog-view.tsreturns the host evaluation whenever a provider has an authored host binding, so Muse readiness is never consulted. With that entry removed, the models are available immediately (C3: owner revoked while a sign-in is pending. The owner sent
/login meta, thencommands.ownerAllowFromwas replaced with a different owner while the code was pending, and the code was then approved. Results:commands.ownerAllowFromedit made by the tester.One caveat: the config reload restarted the Telegram channel, which ended the pending chat sign-in silently, before the authority recheck ran. The user got no message that the sign-in was cancelled. That is worth a follow-up, but no effect occurs either way.
C4: Muse re-login no longer says "kept its previous account" (2026-11-21). Two
/login metaruns on the live build endedMeta login complete.After #202564's follow-up, a chat on another model now readsThis chat still uses ….C5: Sign-in and a completed Muse reply on upgraded real data (2026-11-23). The copy of the operator's state was written by a 2026.10.10 main build and upgraded twice, to this head (combined build
e8ec8a4, 2026.11.6). It ran in an isolated Gateway with the live state read-only.Requested agent harness "muse" does not support meta/muse-spark-1.3.models.providers.metahost route (the Muse models stay "Sign-in needed" after a successful sign-in when models.providers.meta has no API key #201818 fix), both Muse models were available.meta/muse-spark-1.3(runtimemuse) repliedOK — Muse Code powered by Meta Muse Spark.Native-runtime consent was granted for the test copy. Trace.
Upgrade traces (TRACES-20261123.md):
Not covered live: C2, a non-owner
/login meta, because no second Telegram account was available. It stays covered by thecommands-logintests.Needs a maintainer decision (ClawSweeper "Decision needed"): should explicitly opted-in (
channelLogin) profileless native sign-ins run from private chat and persist agent-scoped runtime routing without guided setup activation? This PR keeps runtime installation, native-permission consent, and current-authority checks in place for that path.🤖 Generated with Claude Code