Skip to content

test: expect current run-close and restart-admission refusal text - #204110

Merged
obviyus merged 1 commit into
mainfrom
fix/aclass-round3
Nov 23, 2026
Merged

obviyus merged 1 commit into
mainfrom
fix/aclass-round3

Conversation

@obviyus

@obviyus obviyus commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Scheduled main CI run 45194414616 (head 6587c9f) is red in four tests. Each one still expects the old refusal text. #204037 reworded two messages:

  • released execution (run close): "operator … authority is no longer active" → "Operator execution ended. Reconnect to the Gateway, then resend your message."
  • restart-recovery start refusal: "Restart recovery operator authority changed…" → "Restart recovery could not admit this input. Start a new user turn."

The refusals still happen. This PR updates only the expected text. Tests only.

Why This Change Was Made

File Action Why
src/gateway/openai-compatible-agent-run.test.ts kept, text updated after the run closes, its authority refuses (run close).
src/gateway/tools-invoke-http.abort.test.ts kept, text updated after the admission closes, the admitted work's authority refuses (run close); the next start is still refused.
src/auto-reply/reply/commands-plugin.scheduled-turns-restart.test.ts kept, text updated replayed scheduled work re-checks its requester at start (AGENTS.md); a demoted or removed requester is still refused before the command runs (executionStarted: false, handler not called).
src/gateway/server-methods/users-personal-file.test.ts kept, text updated the owner reads and writes only their own USER.md; after the run releases its authority, the next tool call is refused. The owner boundary and the non-owner cases are unchanged and pass.

No cases deleted. No production change.

User Impact

None. Test-only.

Evidence

  • Red on main: scheduled run 45194414616 (the 4 files, 7 cases).
  • Head: vitest-source, the 4 files pass (94/94). PR CI on this branch.
  • oxfmt clean.

#204037 reworded the released-execution refusal to 'Operator execution ended...' and the restart-recovery start refusal to 'Restart recovery could not admit this input...'. Four tests still matched the old text. The refusals themselves are unchanged and stay asserted.

Co-authored-by: obviyus <[email protected]>
@clawsweeper

clawsweeper Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: XS labels Nov 23, 2026
@obviyus
obviyus merged commit 380031e into main Nov 23, 2026
105 checks passed
@obviyus

obviyus commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator Author

Landed. 4 files were red on main (scheduled run 45194414616) and pass in PR CI run 45206352714. Local review clean.

@obviyus
obviyus deleted the fix/aclass-round3 branch November 23, 2026 15:42
obviyus added a commit that referenced this pull request Nov 23, 2026
…ugin/MCP App paths, skill library, reclaim and channel reads (R6d part 3) (#204134)

## Problem

OpenClaw checks authority once, when work starts (AGENTS.md "Choose good compromises"). Gateway operator, approval, plugin and MCP App paths, the skill library, worker reclaim and channel message reads still re-read a permission, role, scope, trust or config mid-request and refused started work with "authority changed" / "authority is no longer active/current". Other checks in the same files are valid Stop, run-close or data fences whose text claimed authority.

## Change

R6d part 3, first half (split rule). Each check was classified with one test: can it fire when only a permission, approval or config changes while nothing about the run or data changes?

- Yes → deleted, with its plumbing.
- No (Stop, run close, disconnect, data fence) → kept, reworded to say what ended and the next step.
- Start-time checks (admission, made before work begins) stay.

| Site | Old message | Kind | Action |
|---|---|---|---|
| `skills/library/store-access.ts` `assertCurrent` | Skill library authority changed | mixed: config roles, role subject and scopes re-read + `authority.assertCurrent()` (run close, claim loss, disconnect) | role/scope/config compares deleted; Stop (`authority.assertCurrent`) and the database admission fence kept |
| `skills/library/store-access.ts` `read` | Profile authority changed during library access / Skill library profile authority changed | profile-row change (includes role) after admission | refusals deleted; a profile change now only keeps the reply out of the read cache (no stale cached role) |
| `server-worker-placement-reclaim.ts` | grant callback refusal (`assertWorkerGrant`) | grant re-check during reclaim preparation | deleted; lifetime + target-generation fences kept |
| `worker-environments/placement-dispatch.ts` `reclaimOnce` | Gateway recovery disabled by required worker profile | config re-read inside the repeated source check | checked once at entry; `reclaimSource`/preparation get the existing `assertWorkerLifetime` branch |
| `channels/plugins/message-action-dispatch.ts` | Plugin X read/alias authority is no longer active | registration lifetime + `trustedOfficialInstall` downgrade | trust term moved to capture time in `plugins/registry-registrars-network.ts` (admission); registration fence kept: "…was reloaded during the read. Retry the action." |
| `shared/channel-read-authority.ts` | Channel read authority is no longer active. | Stop (closed read scope) | reworded: "Channel read ended. Retry the action." |
| `agent-runtime-identity-token.ts` | agent runtime approval authority is no longer active | run/claim fence | reworded |
| `device-revocation.ts` | Gateway caller authority is no longer active. | mixed | permission callback re-check deleted; closed-owner / released-lifetime fences kept |
| `exec-approval-authority.ts` + `exec-approval-manager.ts` | approval resolver authority is no longer active | mixed | repeated caller assertion and its plumbing deleted; store/binding fences kept, reworded |
| `exec-approval-resolution-authority.ts` | approval standing grant authority is no longer active | Stop (run abort) + tool-owner data | reworded |
| `operator-approval-session-events.ts` | Operator approval replay authority is no longer current | mixed | reviewer-permission and scope re-reads deleted; runtime, connection and device fences kept, reworded |
| `operator-invocation-authority.ts` | Gateway caller authority is no longer active. | mixed | caller-permission re-checks deleted; signals and context identity kept |
| `operator-role-policy.ts` | OpenClaw ID membership authority changed | authority | membership re-reads for admitted runs deleted; admission checks kept, reworded |
| `operator-run-authority.ts` `prepareGatewayOperatorRunAuthority` | Gateway caller authority is no longer active. | admission (before the run starts) | kept: "Gateway request could not start. Reconnect and try again." |
| `question-manager.ts` | the question's resolution authority is no longer active | Stop / question lifecycle | reworded |
| `openclaw-id/node-pairing.ts` | OpenClaw ID node authority changed | mixed | membership check moved to admission; connect-policy callback kept (opaque, mixes lifecycle), reworded |
| `openclaw-id/tunnel-principal.ts` | OpenClaw ID membership authority changed | admission / recovery | reworded |
| `server-plugin-github-account.ts`, `server-plugin-user-profile.ts`, `server-plugin-session-facts.ts` (`callerAuthorityError`) | … caller authority is no longer active | request lifetime | reworded (helper has callers outside this PR) |
| `server-plugin-session-facts.ts` `assertAuthority` | Session read authority changed; retry the request | mixed | caller/config/policy/access/profile re-checks deleted; projection replacement fence kept, reworded |
| `server-plugin-in-process-session-read.ts` | Session read authority changed before inference. | mixed | repeated visibility authorization deleted; projection/session/store/generation fences kept, reworded |
| `server-plugin-in-process-authority.ts` | Gateway continuation authority is no longer active | Stop (release, cancellation, Gateway lifetime) | reworded |
| `server-plugins-node-runtime.ts` | Plugin Gateway runtime authority is no longer current. | mixed | plugin permission/config reader deleted; lifecycle signal, binding and run/claim checks kept, reworded |
| `mcp-app-form-resources.ts` | Form upload workspace authority changed; MCP App runtime is unavailable | data fence; config (apps disabled) mid-operation | workspace/session fence reworded; mid-operation enabled/upload-policy re-checks deleted (upload admission kept) |
| `mcp-app-host-files.ts` | App file workspace authority changed; 3 subscription "authority changed" closes | mixed | permission/config/grant re-checks and revocation-retention plumbing deleted; connection, requester, view, session, workspace fences kept, reworded |
| `mcp-app-tool-approval.ts` | MCP App tool approval authority changed | authority (post-consumption re-check) | deleted; admission, decision and allow-once consumption kept |

Deleted tests (they asserted a mid-request permission refusal): skill library role change after preparation (`skill-library-authoring`, `selection-authority`), reclaim "caller changes at transaction/commit completion admission", message-action registry `trust-downgrade` row, form upload "upload policy"/"apps disabled", host-file synchronous grant revocation, fork "session visibility", linked-owner membership revocation for an admitted run, replay waiting-client scope revocation and revoked-requester variant, device-retention permission revocation. Stop and data-fence tests keep their conditions; only their expected text changed. The 21 channel read assertions that matched the generic "no longer active" text were first split so each matches its own producer.

Lifetime-check ratchet: 0 counted strings in every touched production file. `config/session-identity-allowlist.txt` pruned.

Accepted edge cases:
- A started skill-library read or prepared selection keeps its result if the profile role changes; the next request admits the new role. The worker-side publication check is unchanged.
- A started reclaim finishes even if the caller's grant is revoked; Stop and session lifetime still end it.
- A channel read that started keeps going if the plugin install trust drops; the next read is admitted with the new trust.

## Not in this PR (part 4)

- Remaining `src/gateway/**` string files: `agent-turn/agent-run-user-turn.ts`, `channel-avatar-http.ts`, `cron-creator-authority-grant.ts`, `cron-stream-sandbox-authority.ts`, `desktop/observe-bridge.ts`, `factory-github-proof.ts`, `http-auth-user-profile.ts`, `human-mention-policy.ts`, `managed-image-session-read.ts`, `mention-inbox.ts`, `node-claude-skill-runtime.ts`, `node-mcp-elicitation.ts`, `openai-compatible-agent-run.ts`, `remote-control-ui-ingress.ts`, `repository-dispatch.ts`, `repository-integration-identity.ts`, `server-node-event-source.ts`, `server/ws-connection/authenticated-request-dispatch.ts`, `server/ws-connection/connect-publication-transport.ts`, `server/ws-origin-policy.ts`, `session-sharing-read.ts`, `skill-library-session.ts`, `talk/client-run-authority.ts`.
- Reclaim: `sessions.reclaim` passes the unsplit `SessionMutationAuthorization.assertCurrent` (grant + session lifetime) and Move's composed callback reads config policy + signal. Removing the grant there needs the producer to expose its lifetime part (R6z type change).
- Approval replay visibility (`canAccessInvitedApprovalSession`) mixes session-sharing data with role/scope reads; node-pairing's connect-policy callback mixes lifecycle and policy. Both kept.

## User impact

A started read, reclaim, approval replay, plugin or MCP App request is no longer refused because a role, scope, trust or config changed mid-request; the change applies to the next request. Stop, disconnect, plugin reload and data changes still end work, with messages that say what ended and what to do next.

## Evidence

- `pnpm tsgo:core`, `pnpm tsgo:test`: pass. oxfmt and oxlint on changed files: clean. Lifetime-check ratchet: 0 counted strings in changed production files; session-identity ratchet OK after prune (6257 → 6239 pins).
- `ocx test` (continue-on-failure) on 204 files: every touched test file, every test importing a changed source or test-support file except the 3 widest modules (`operator-role-policy`, `operator-run-authority`, `tunnel-principal`: 200 importers; CI runs them), plus every test pinning a changed message. OURS reds fixed and rerun. Remaining local reds are not ours: `mcp-http.async-scope`, `agent.test` (2), `question.communication`, `question.recovery` (base-red, see earlier R6 PRs), `server.sessions.create.lifecycle` requester row + `server.sessions.create.durability` (rewritten on main by #203560), `users-personal-file` text (open #204110).
- Production vs `main`: 27 files, +120/−228.
- CI round 1: OURS = 6 text/permission test pins (message-action registry + alias, Telegram history plugin row, skill-library role/alias seed rows, runtime-llm replaced caller), fixed in `8519761ded`. Round 2: only not-ours reds (see the Maintainer override comment).
- Local ClawSweeper review: round 1 `6db0ccd7d01d` and round 2 `8519761ded13` both "patch is correct", no findings.
- One-admission E2E on `6db0ccd7d01d` (production is the same at `8519761ded13`; that diff is test-only): verdict pass; R.running-turn-finishes, Q.queued-input-refused-visibly and S.stop-cancels all pass. `verdict.json` and `results.jsonl` are kept in the proof directory.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 24, 2026
…enclaw#204110)

openclaw#204037 reworded the released-execution refusal and the restart-recovery start refusal. Four tests still matched the old text; the refusals stay asserted. Tests only.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 24, 2026
…ugin/MCP App paths, skill library, reclaim and channel reads (R6d part 3) (openclaw#204134)

## Problem

OpenClaw checks authority once, when work starts (AGENTS.md "Choose good compromises"). Gateway operator, approval, plugin and MCP App paths, the skill library, worker reclaim and channel message reads still re-read a permission, role, scope, trust or config mid-request and refused started work with "authority changed" / "authority is no longer active/current". Other checks in the same files are valid Stop, run-close or data fences whose text claimed authority.

## Change

R6d part 3, first half (split rule). Each check was classified with one test: can it fire when only a permission, approval or config changes while nothing about the run or data changes?

- Yes → deleted, with its plumbing.
- No (Stop, run close, disconnect, data fence) → kept, reworded to say what ended and the next step.
- Start-time checks (admission, made before work begins) stay.

| Site | Old message | Kind | Action |
|---|---|---|---|
| `skills/library/store-access.ts` `assertCurrent` | Skill library authority changed | mixed: config roles, role subject and scopes re-read + `authority.assertCurrent()` (run close, claim loss, disconnect) | role/scope/config compares deleted; Stop (`authority.assertCurrent`) and the database admission fence kept |
| `skills/library/store-access.ts` `read` | Profile authority changed during library access / Skill library profile authority changed | profile-row change (includes role) after admission | refusals deleted; a profile change now only keeps the reply out of the read cache (no stale cached role) |
| `server-worker-placement-reclaim.ts` | grant callback refusal (`assertWorkerGrant`) | grant re-check during reclaim preparation | deleted; lifetime + target-generation fences kept |
| `worker-environments/placement-dispatch.ts` `reclaimOnce` | Gateway recovery disabled by required worker profile | config re-read inside the repeated source check | checked once at entry; `reclaimSource`/preparation get the existing `assertWorkerLifetime` branch |
| `channels/plugins/message-action-dispatch.ts` | Plugin X read/alias authority is no longer active | registration lifetime + `trustedOfficialInstall` downgrade | trust term moved to capture time in `plugins/registry-registrars-network.ts` (admission); registration fence kept: "…was reloaded during the read. Retry the action." |
| `shared/channel-read-authority.ts` | Channel read authority is no longer active. | Stop (closed read scope) | reworded: "Channel read ended. Retry the action." |
| `agent-runtime-identity-token.ts` | agent runtime approval authority is no longer active | run/claim fence | reworded |
| `device-revocation.ts` | Gateway caller authority is no longer active. | mixed | permission callback re-check deleted; closed-owner / released-lifetime fences kept |
| `exec-approval-authority.ts` + `exec-approval-manager.ts` | approval resolver authority is no longer active | mixed | repeated caller assertion and its plumbing deleted; store/binding fences kept, reworded |
| `exec-approval-resolution-authority.ts` | approval standing grant authority is no longer active | Stop (run abort) + tool-owner data | reworded |
| `operator-approval-session-events.ts` | Operator approval replay authority is no longer current | mixed | reviewer-permission and scope re-reads deleted; runtime, connection and device fences kept, reworded |
| `operator-invocation-authority.ts` | Gateway caller authority is no longer active. | mixed | caller-permission re-checks deleted; signals and context identity kept |
| `operator-role-policy.ts` | OpenClaw ID membership authority changed | authority | membership re-reads for admitted runs deleted; admission checks kept, reworded |
| `operator-run-authority.ts` `prepareGatewayOperatorRunAuthority` | Gateway caller authority is no longer active. | admission (before the run starts) | kept: "Gateway request could not start. Reconnect and try again." |
| `question-manager.ts` | the question's resolution authority is no longer active | Stop / question lifecycle | reworded |
| `openclaw-id/node-pairing.ts` | OpenClaw ID node authority changed | mixed | membership check moved to admission; connect-policy callback kept (opaque, mixes lifecycle), reworded |
| `openclaw-id/tunnel-principal.ts` | OpenClaw ID membership authority changed | admission / recovery | reworded |
| `server-plugin-github-account.ts`, `server-plugin-user-profile.ts`, `server-plugin-session-facts.ts` (`callerAuthorityError`) | … caller authority is no longer active | request lifetime | reworded (helper has callers outside this PR) |
| `server-plugin-session-facts.ts` `assertAuthority` | Session read authority changed; retry the request | mixed | caller/config/policy/access/profile re-checks deleted; projection replacement fence kept, reworded |
| `server-plugin-in-process-session-read.ts` | Session read authority changed before inference. | mixed | repeated visibility authorization deleted; projection/session/store/generation fences kept, reworded |
| `server-plugin-in-process-authority.ts` | Gateway continuation authority is no longer active | Stop (release, cancellation, Gateway lifetime) | reworded |
| `server-plugins-node-runtime.ts` | Plugin Gateway runtime authority is no longer current. | mixed | plugin permission/config reader deleted; lifecycle signal, binding and run/claim checks kept, reworded |
| `mcp-app-form-resources.ts` | Form upload workspace authority changed; MCP App runtime is unavailable | data fence; config (apps disabled) mid-operation | workspace/session fence reworded; mid-operation enabled/upload-policy re-checks deleted (upload admission kept) |
| `mcp-app-host-files.ts` | App file workspace authority changed; 3 subscription "authority changed" closes | mixed | permission/config/grant re-checks and revocation-retention plumbing deleted; connection, requester, view, session, workspace fences kept, reworded |
| `mcp-app-tool-approval.ts` | MCP App tool approval authority changed | authority (post-consumption re-check) | deleted; admission, decision and allow-once consumption kept |

Deleted tests (they asserted a mid-request permission refusal): skill library role change after preparation (`skill-library-authoring`, `selection-authority`), reclaim "caller changes at transaction/commit completion admission", message-action registry `trust-downgrade` row, form upload "upload policy"/"apps disabled", host-file synchronous grant revocation, fork "session visibility", linked-owner membership revocation for an admitted run, replay waiting-client scope revocation and revoked-requester variant, device-retention permission revocation. Stop and data-fence tests keep their conditions; only their expected text changed. The 21 channel read assertions that matched the generic "no longer active" text were first split so each matches its own producer.

Lifetime-check ratchet: 0 counted strings in every touched production file. `config/session-identity-allowlist.txt` pruned.

Accepted edge cases:
- A started skill-library read or prepared selection keeps its result if the profile role changes; the next request admits the new role. The worker-side publication check is unchanged.
- A started reclaim finishes even if the caller's grant is revoked; Stop and session lifetime still end it.
- A channel read that started keeps going if the plugin install trust drops; the next read is admitted with the new trust.

## Not in this PR (part 4)

- Remaining `src/gateway/**` string files: `agent-turn/agent-run-user-turn.ts`, `channel-avatar-http.ts`, `cron-creator-authority-grant.ts`, `cron-stream-sandbox-authority.ts`, `desktop/observe-bridge.ts`, `factory-github-proof.ts`, `http-auth-user-profile.ts`, `human-mention-policy.ts`, `managed-image-session-read.ts`, `mention-inbox.ts`, `node-claude-skill-runtime.ts`, `node-mcp-elicitation.ts`, `openai-compatible-agent-run.ts`, `remote-control-ui-ingress.ts`, `repository-dispatch.ts`, `repository-integration-identity.ts`, `server-node-event-source.ts`, `server/ws-connection/authenticated-request-dispatch.ts`, `server/ws-connection/connect-publication-transport.ts`, `server/ws-origin-policy.ts`, `session-sharing-read.ts`, `skill-library-session.ts`, `talk/client-run-authority.ts`.
- Reclaim: `sessions.reclaim` passes the unsplit `SessionMutationAuthorization.assertCurrent` (grant + session lifetime) and Move's composed callback reads config policy + signal. Removing the grant there needs the producer to expose its lifetime part (R6z type change).
- Approval replay visibility (`canAccessInvitedApprovalSession`) mixes session-sharing data with role/scope reads; node-pairing's connect-policy callback mixes lifecycle and policy. Both kept.

## User impact

A started read, reclaim, approval replay, plugin or MCP App request is no longer refused because a role, scope, trust or config changed mid-request; the change applies to the next request. Stop, disconnect, plugin reload and data changes still end work, with messages that say what ended and what to do next.

## Evidence

- `pnpm tsgo:core`, `pnpm tsgo:test`: pass. oxfmt and oxlint on changed files: clean. Lifetime-check ratchet: 0 counted strings in changed production files; session-identity ratchet OK after prune (6257 → 6239 pins).
- `ocx test` (continue-on-failure) on 204 files: every touched test file, every test importing a changed source or test-support file except the 3 widest modules (`operator-role-policy`, `operator-run-authority`, `tunnel-principal`: 200 importers; CI runs them), plus every test pinning a changed message. OURS reds fixed and rerun. Remaining local reds are not ours: `mcp-http.async-scope`, `agent.test` (2), `question.communication`, `question.recovery` (base-red, see earlier R6 PRs), `server.sessions.create.lifecycle` requester row + `server.sessions.create.durability` (rewritten on main by openclaw#203560), `users-personal-file` text (open openclaw#204110).
- Production vs `main`: 27 files, +120/−228.
- CI round 1: OURS = 6 text/permission test pins (message-action registry + alias, Telegram history plugin row, skill-library role/alias seed rows, runtime-llm replaced caller), fixed in `8519761ded`. Round 2: only not-ours reds (see the Maintainer override comment).
- Local ClawSweeper review: round 1 `6db0ccd7d01d` and round 2 `8519761ded13` both "patch is correct", no findings.
- One-admission E2E on `6db0ccd7d01d` (production is the same at `8519761ded13`; that diff is test-only): verdict pass; R.running-turn-finishes, Q.queued-input-refused-visibly and S.stop-cancels all pass. `verdict.json` and `results.jsonl` are kept in the proof directory.

Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant