Repository navigation
fix(gateway): make scope errors machine-readable across clients - #111013
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 18, 2026, 8:09 PM ET / July 19, 2026, 00:09 UTC. Summary PR surface: Source +134, Tests +299, Docs +16, Config +8, Generated 0, Other +269. Total +726 across 54 files. Reproducibility: yes. from source: seed an answered, cancelled, or expired Android question card, then make Review metrics: 2 noteworthy metrics.
Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Preserve terminal Android question cards when list access is unavailable, then add a redacted real gateway run that exercises both structured missing-scope handling and the legacy-message fallback before merge. Do we have a high-confidence way to reproduce the issue? Yes, from source: seed an answered, cancelled, or expired Android question card, then make Is this the best way to solve the issue? No. The shared protocol reader and central policy direction are sound, but clearing every question card is broader than necessary; retain terminal cards and remove only still-actionable prompts when access is unavailable. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b550c2cf9a8a. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +134, Tests +299, Docs +16, Config +8, Generated 0, Other +269. Total +726 across 54 files. View PR surface stats
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (1 earlier review cycle)
|
e83dced to
4010203
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4010203d68
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (_questions.value.isNotEmpty()) { | ||
| _questions.value = emptyList() | ||
| questionStateRevision += 1 |
There was a problem hiding this comment.
Preserve terminal question cards when list access is unavailable
When question.list is unavailable after a scope change or connection to an older gateway, this clears answered, cancelled, and expired cards along with pending ones. The normal reconciliation path deliberately retains non-pending cards in apps/android/app/src/main/java/ai/openclaw/app/chat/ChatController.kt:2299-2310, and the Apple sibling clears only pending/submitting cards, so Android users can lose a just-recorded terminal outcome prematurely. Filter out only actionable pending/submitting prompts here instead of replacing the entire list.
Useful? React with 👍 / 👎.
|
Merged via squash.
|
…claw#111013) * fix(gateway): consume structured scope errors * docs(gateway): clarify tools error boundary * refactor(gateway): unify node admin policy
PR openclaw#111013 added missingScopeErrorShape but the agent-reset-phase admin-scope and talk secrets-scope checks still used the legacy errorShape without structured details. Switch them to emit machine- readable MISSING_SCOPE details so clients can programmatically identify these scope failures.
…claw#111013) * fix(gateway): consume structured scope errors * docs(gateway): clarify tools error boundary * refactor(gateway): unify node admin policy
Follow-up to #110925
What Problem This Solves
Fixes an issue where gateway clients could receive machine-readable missing-scope details from the server but still had to parse the human message, or misclassified a permanent authorization failure as bad parameters or a transient error. Parameter-dependent methods also duplicated scope policy between dispatch and handlers, which made regressions easy: reset-style agent requests, privileged node invokes, and unredacted talk configuration did not share one authorization owner.
Why This Change Was Made
This adds a browser-safe protocol reader that prefers
details.code = MISSING_SCOPEwhile retaining the existing message and legacy fallback, then migrates the CLI, probe/status paths, Control UI, Android, and Apple clients to it. Dynamic method scope requirements now live in the pre-dispatch method policy and are reused by handler defenses; direct invocation and pairing share one admin-only node-command classifier, while the persistent browser mutation guard remains fail-closed at its more precise handler boundary.The Android error model now preserves generic gateway details instead of naming connect-only details, and both mobile clients clear stale operator-question state when
operator.questionsis unavailable. The protocol and operator-scope docs cover the additive contract and parameter-dependent scopes.User Impact
Third-party and first-party clients can give actionable missing-permission guidance without regexing
missing scope: .... Existing clients keep working because the message string and legacy parsing fallback remain intact. Operators also get consistentFORBIDDENsemantics for parameter-dependent scope failures instead of ambiguousINVALID_REQUESThandling.Release-note context: gateway clients can now consume structured missing-scope details across method-level authorization failures, with legacy message compatibility retained.
Evidence
pnpm check:changedpassed on Blacksmith Testbox, including generated protocol/API baselines, all TypeScript typechecks, full core/package lint, import-cycle and boundary guards, and macOS packaging tests.Before the final main rebase, 273 focused gateway/protocol/UI/CLI tests passed;
@openclaw/gateway-protocoland@openclaw/gateway-clientpackage builds passed.Before the final main rebase, Android
ktlintCheckand targetedGatewayErrorDetailsTest,ChatQuestionTest, andGatewaySessionReconnectTestpassed./toolsownership-boundary follow-up: 31commands-infotests passed.Current exact head passed
native:i18n:check, the changed node-pairing test (15 assertions), all test typechecks, production/full-tree/script dead-code export scans, script-declaration validation, and targeted formatting.Real provider proof: OpenAI Responses streaming test passed with the Molty-managed
OPENAI_API_KEYon direct AWS Crabbox runrun_90c1f5464f1c(cbx_63d01e15905d); the lease was stopped and the key was not printed.Exact-head hosted CI run
29665168399passed, including native i18n, Android builds/tests, iOS build, macOS Node, and the full 1,395-test macOS Swift suite. First-attempt Blacksmith macOS capacity was unavailable; attempt 2 exposed unrelated process/onboarding test flakiness, and the unchanged native job passed on attempt 3.Multi-pass autoreview found and drove the node-pairing policy unification, then finished clean against current
mainwith no accepted/actionable findings (0.90 confidence).AI-assisted
I understand the change and verified the affected ownership boundaries.