Skip to content

docs: add AGENTS.md for secrets and pairing high-privilege zones#71156

Open
davidangularme wants to merge 3 commits intoopenclaw:mainfrom
davidangularme:docs/secrets-pairing-agents-md
Open

docs: add AGENTS.md for secrets and pairing high-privilege zones#71156
davidangularme wants to merge 3 commits intoopenclaw:mainfrom
davidangularme:docs/secrets-pairing-agents-md

Conversation

@davidangularme
Copy link
Copy Markdown
Contributor

@davidangularme davidangularme commented Apr 24, 2026

Two ghost-hotspot zones surfaced repeatedly in today's architectural analysis as the highest-severity undocumented coupling points in the repo: src/gateway/server-methods/secrets.ts (coherence 0.14, severity 0.94, 347 co-modification neighbors) and src/channels/plugins/pairing.ts (severity 0.94, 348 neighbors). Both are thin RPC/registry shells that gate privilege escalation and whose contracts are not written down.

Extend the existing src/gateway/server-methods/AGENTS.md with a Secrets surface section covering: threat model (operator.admin + shared-secret owner semantics vs device-token), invariants that must hold (errorShape, payload schema gating, no silent respond(true) in catch), and three concrete incidents from this week's PRs as examples of the silent- failure shape to watch for.

Create src/channels/plugins/AGENTS.md (+ CLAUDE.md symlink per repo convention) covering: pairing-code single-use guarantee anchored in pairing-store.ts:668-672, the 1+2+3 approve-allowlist-credential chain that is not globally atomic, the shared-auth vs device-token per-RPC asymmetry that the device-token PR closed, and explicit 'must never happen' list.

Scoped to documentation only. No code changes. Targets the two zones identified as highest ROI in architecture-review issue #71116.

Summary

  • Problem: The two highest-severity undocumented coupling points in the repo — secrets.ts (coherence 0.14, severity 0.94, 347 co-modification neighbors) and pairing.ts (severity 0.94, 348 neighbors) — have no in-tree contributor guidance covering their threat models, invariants, or known failure shapes.
  • Why it matters: Both are thin RPC/registry shells that gate privilege escalation. Without scoped AGENTS.md guidance, contributors working near these surfaces have to reverse-engineer the contracts from code, increasing the risk of silent-failure bugs in catch paths.
  • What changed: Extended src/gateway/server-methods/AGENTS.md with a Secrets surface section (threat model, invariants, related incidents). Created src/channels/plugins/AGENTS.md (+ CLAUDE.md symlink per repo convention) covering pairing-code single-use guarantee, approve-allowlist-credential chain, and shared-auth vs device-token asymmetry.
  • What did NOT change (scope boundary): No code changes. Documentation only.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

Root Cause (if applicable)

N/A — proactive documentation, not a bug fix.

Regression Test Plan (if applicable)

N/A — pure documentation, no code changes.

User-visible / Behavior Changes

None.

Diagram (if applicable)

N/A

Security Impact (required)

  • New permissions/capabilities? No
  • Secrets/tokens handling changed? No
  • New/changed network calls? No
  • Command/tool execution surface changed? No
  • Data access scope changed? No

Repro + Verification

N/A — documentation only.

Verification method: All source-code citations verified against commit 9626ef274ae2.

  • greptile reviewed: 5/5 confidence, all line-number references verified and correct
  • clawsweeper confirmed citations against 9626ef274ae2
  • Follow-up commits ac6cc2b and bef0efa addressed inline feedback (http-utils.ts:255 citation precision, device-token race wording)

Evidence

  • greptile automated review: 5/5 confidence, all citations verified
  • clawsweeper automated review: source-anchor verification against 9626ef274ae2

Human Verification (required)

  • Verified scenarios: Manually compared every line-number citation in both AGENTS.md files against current main. Confirmed pairing-store.ts:668-672, message-handler.ts:1444-1458, http-utils.ts:255 resolve to the described symbols.
  • Edge cases checked: Tightened http-utils.ts:255 citation to HTTP-only per greptile feedback. Corrected device-token rotation race description from "fixed" to "open/in-flight" per chatgpt-codex-connector feedback.
  • What I did not verify: Line-number stability against future commits (anchors may drift on refactor).

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? Yes
  • Config/env changes? No
  • Migration needed? No

Risks and Mitigations

  • Risk: Line-number anchors may drift on future refactors.
    • Mitigation: Anchors cite both line numbers and symbol/function names so readers can locate the reference even after drift.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S labels Apr 24, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 24, 2026

Greptile Summary

Documentation-only PR adding a Secrets surface section to src/gateway/server-methods/AGENTS.md and a new src/channels/plugins/AGENTS.md (plus the required CLAUDE.md symlink) covering the pairing control-plane boundary. All code-level citations were verified against the actual source: pairing-store.ts:668-672, message-handler.ts:1444-1458, and the invariants described in both files match the live code. One minor precision issue exists in the gateway AGENTS.md where http-utils.ts:255 is cited as evidence for both the HTTP and WS shared-secret owner semantics, but that line resolves only to resolveOpenAiCompatibleHttpSenderIsOwner (the HTTP/OpenAI-compat path); the WS side needs its own anchor or clarified prose.

Confidence Score: 5/5

Safe to merge; documentation only, no code changes, all verified citations are accurate.

All three changed files are Markdown documentation. Every line-number reference that could be checked against source code was verified and correct. The single finding (http-utils.ts:255 citation precision) is P2 — a minor clarity improvement, not a blocker.

src/gateway/server-methods/AGENTS.md — the http-utils.ts:255 anchor could be more precise, but is not blocking.

Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/gateway/server-methods/AGENTS.md
Line: 17-19

Comment:
The line citation `http-utils.ts:255` resolves to `resolveOpenAiCompatibleHttpSenderIsOwner`, which specifically covers the OpenAI-compatible HTTP + `/tools/invoke` path. The claim that "the HTTP bearer-token surface and the WS shared-secret surface both map to `senderIsOwner: true` at … :255" is only half-supported by that citation — a reader going there won't see the WS shared-secret path. Tighten the description to match what the line actually shows, or add a second anchor for the WS side.

```suggestion
- The HTTP (OpenAI-compatible / `/tools/invoke`) bearer-token path maps to
  `senderIsOwner: true` at `src/gateway/http-utils.ts:255`
  (`resolveOpenAiCompatibleHttpSenderIsOwner`); the WS shared-secret surface
  carries the same semantics via a parallel path (documented as intentional in
  SECURITY.md). Device-token auth does _not_ get owner by
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "docs: add AGENTS.md for secrets and pair..." | Re-trigger Greptile

Comment thread src/gateway/server-methods/AGENTS.md Outdated
Comment on lines +17 to +19
- The HTTP bearer-token surface and the WS shared-secret surface both map to
`senderIsOwner: true` at `src/gateway/http-utils.ts:255` (documented as
intentional in SECURITY.md). Device-token auth does _not_ get owner by
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 The line citation http-utils.ts:255 resolves to resolveOpenAiCompatibleHttpSenderIsOwner, which specifically covers the OpenAI-compatible HTTP + /tools/invoke path. The claim that "the HTTP bearer-token surface and the WS shared-secret surface both map to senderIsOwner: true at … :255" is only half-supported by that citation — a reader going there won't see the WS shared-secret path. Tighten the description to match what the line actually shows, or add a second anchor for the WS side.

Suggested change
- The HTTP bearer-token surface and the WS shared-secret surface both map to
`senderIsOwner: true` at `src/gateway/http-utils.ts:255` (documented as
intentional in SECURITY.md). Device-token auth does _not_ get owner by
- The HTTP (OpenAI-compatible / `/tools/invoke`) bearer-token path maps to
`senderIsOwner: true` at `src/gateway/http-utils.ts:255`
(`resolveOpenAiCompatibleHttpSenderIsOwner`); the WS shared-secret surface
carries the same semantics via a parallel path (documented as intentional in
SECURITY.md). Device-token auth does _not_ get owner by
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/gateway/server-methods/AGENTS.md
Line: 17-19

Comment:
The line citation `http-utils.ts:255` resolves to `resolveOpenAiCompatibleHttpSenderIsOwner`, which specifically covers the OpenAI-compatible HTTP + `/tools/invoke` path. The claim that "the HTTP bearer-token surface and the WS shared-secret surface both map to `senderIsOwner: true` at … :255" is only half-supported by that citation — a reader going there won't see the WS shared-secret path. Tighten the description to match what the line actually shows, or add a second anchor for the WS side.

```suggestion
- The HTTP (OpenAI-compatible / `/tools/invoke`) bearer-token path maps to
  `senderIsOwner: true` at `src/gateway/http-utils.ts:255`
  (`resolveOpenAiCompatibleHttpSenderIsOwner`); the WS shared-secret surface
  carries the same semantics via a parallel path (documented as intentional in
  SECURITY.md). Device-token auth does _not_ get owner by
```

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7509ff4a5d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/gateway/server-methods/AGENTS.md Outdated
Comment on lines +72 to +76
- `fix/gateway-device-token-rpc-revalidation` — rotate/revoke responded
OK before the microtask-scheduled disconnect, and there was no per-RPC
re-check for device-token auth (only for shared-auth). Pipelined RPCs
landed with the rotated token. Fixed by a synchronous `invalidated`
flag plus a dispatcher-level guard.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Remove nonexistent device-token invalidation guarantee

This section says fix/gateway-device-token-rpc-revalidation added a synchronous invalidated flag plus dispatcher guard, but that guarantee is not present in the current code: GatewayWsClient has no invalidated field and per-RPC revalidation in message-handler.ts only covers usesSharedGatewayAuth. Documenting a non-existent security control in this high-privilege guide can cause reviewers to assume rotate/revoke is race-safe when it is not.

Useful? React with 👍 / 👎.

davidangularme added a commit to davidangularme/openclaw that referenced this pull request Apr 24, 2026
Codex review on openclaw#71156 correctly flagged that the AGENTS.md was
describing a synchronous 'invalidated' flag on GatewayWsClient plus a
per-RPC dispatch guard as already-landed guarantees, when they live in
the still-open fix/gateway-device-token-rpc-revalidation PR. On main,
GatewayWsClient has no 'invalidated' field and message-handler.ts only
re-checks usesSharedGatewayAuth. Documenting the proposed fix as a
shipped guarantee could let reviewers wave through rotate/revoke code
paths that are in fact still racy against pipelined RPCs.

Rewrite three references in the two AGENTS.md files:

- Reframe the 'Related incidents' list in server-methods/AGENTS.md
  from 'landed' to 'in-flight' and mark rotate/revoke on main as
  best-effort rather than race-safe.
- Rewrite the 'Shared-auth vs device-token' section in
  channels/plugins/AGENTS.md to describe current main (no per-RPC
  check for device-token) and position the 'invalidated' flag as a
  proposal, not a state.
- Rewrite the rotate/revoke 'must never happen' bullet from 'the
  invalidated flag must be set before respond()' to a mechanism-
  agnostic invariant ('old-token authority must end before response
  flush, whichever mechanism closes the race').

No code changes. Keeps the content honest against main until the
device-token PR lands (which this doc PR does not depend on).
@vincentkoc vincentkoc added the triage: low-signal-docs Candidate: docs-only change looks low signal; maintainer review needed. label Apr 26, 2026
@openclaw-barnacle openclaw-barnacle Bot added the triage: blank-template Candidate: PR template appears mostly untouched. label Apr 26, 2026
@clawsweeper
Copy link
Copy Markdown
Contributor

clawsweeper Bot commented Apr 27, 2026

Codex review: needs changes before merge.

Summary
The PR adds scoped AGENTS guidance for gateway secrets handlers and channel-plugin pairing/allowlist behavior, plus a CLAUDE.md symlink under src/channels/plugins.

Reproducibility: yes. for the review defects: compare the PR diff from the public GitHub diff URL with current main using nl and rg. Runtime reproduction is not applicable because this is a documentation-only PR.

Next step before merge
The remaining blockers are narrow mechanical docs corrections that an automated repair lane can safely attempt without changing runtime code.

Security
Cleared: The diff is Markdown plus a repository-local CLAUDE.md symlink and does not change executable code, dependencies, workflows, package metadata, secrets handling, or runtime permissions.

Review findings

  • [P2] Update the HTTP owner-semantics source anchor — src/gateway/server-methods/AGENTS.md:18
  • [P3] Point pairing storage at the channel helpers — src/channels/plugins/AGENTS.md:14
  • [P3] Use the exported pairing approval symbol — src/channels/plugins/AGENTS.md:36
Review details

Best possible solution:

Keep the scoped docs, but refresh them against current main by citing the real HTTP auth helper, channel pairing storage helpers, exported approval symbol, and current single-use line anchor before maintainer review.

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

Yes for the review defects: compare the PR diff from the public GitHub diff URL with current main using nl and rg. Runtime reproduction is not applicable because this is a documentation-only PR.

Is this the best way to solve the issue?

No, not as currently proposed. Scoped AGENTS guidance is the right shape, but the stale anchors and symbol names should be corrected so the docs remain maintainable in the auth and pairing control-plane paths.

Full review comments:

  • [P2] Update the HTTP owner-semantics source anchor — src/gateway/server-methods/AGENTS.md:18
    This guide still points readers to src/gateway/http-utils.ts:255, but current main's http-utils.ts ends at line 167 and the helper implementation is in src/gateway/http-auth-utils.ts:241-253. Because this is high-privilege auth guidance, cite the real helper location or an actual re-export line.
    Confidence: 0.98
  • [P3] Point pairing storage at the channel helpers — src/channels/plugins/AGENTS.md:14
    resolvePairingPaths(...) belongs to infra device/node pairing, not channel pairing. Channel pairing state is resolved by resolvePairingPath plus resolveChannelAllowFromPath in src/pairing/pairing-store.ts, so this storage pointer sends readers to the wrong contract.
    Confidence: 0.94
  • [P3] Use the exported pairing approval symbol — src/channels/plugins/AGENTS.md:36
    The transaction list names approveChannelPairingRequest, but current main exports and callers use approveChannelPairingCode. Readers following this guide will not find the named function, so the doc should use the real symbol.
    Confidence: 0.96
  • [P3] Refresh the single-use line anchor — src/channels/plugins/AGENTS.md:24
    The doc says pairing-store.ts:668-672 contains pruned.splice(idx, 1) and the write-back, but those lines now cover the no-match cleanup/return path; the splice/write-back is at 676-680. Update the anchor or remove line numbers so the invariant points at the code it describes.
    Confidence: 0.93

Overall correctness: patch is incorrect
Overall confidence: 0.94

Acceptance criteria:

  • git diff --check
  • pnpm exec oxfmt --check --threads=1 src/gateway/server-methods/AGENTS.md src/channels/plugins/AGENTS.md
  • rg -n "http-utils.ts:255|approveChannelPairingRequest|resolvePairingPaths|pairing-store.ts:668-672" src/gateway/server-methods/AGENTS.md src/channels/plugins/AGENTS.md should return no matches after the fix
  • test -L src/channels/plugins/CLAUDE.md && test "$(readlink src/channels/plugins/CLAUDE.md)" = AGENTS.md

What I checked:

  • Current PR state and surface: The public PR API still reports this PR open at head 53849c6 with three changed files: two AGENTS Markdown files and one symlink. (53849c6c993c)
  • Current main lacks equivalent scoped docs: Current main's src/gateway/server-methods/AGENTS.md only contains the Pi transcript note, and find shows no src/channels/plugins/AGENTS.md or CLAUDE.md. (src/gateway/server-methods/AGENTS.md:1, 9bedcff904dd)
  • HTTP owner anchor is stale: The PR cites src/gateway/http-utils.ts:255, but current main's http-utils.ts ends at line 167; resolveOpenAiCompatibleHttpSenderIsOwner is implemented in src/gateway/http-auth-utils.ts:241-253. (src/gateway/http-auth-utils.ts:241, 9bedcff904dd)
  • Pairing storage helper is misnamed: Channel pairing uses resolvePairingPath and resolveChannelAllowFromPath in src/pairing/pairing-store.ts; rg finds resolvePairingPaths only in infra/device pairing tests, not as the channel pairing storage resolver. (src/pairing/pairing-store.ts:61, 9bedcff904dd)
  • Pairing approval symbol differs: Current main exports and callers use approveChannelPairingCode, while rg finds no approveChannelPairingRequest symbol in the relevant paths. (src/pairing/pairing-store.ts:638, 9bedcff904dd)
  • Single-use line anchor drifted: Current main's src/pairing/pairing-store.ts:668-672 is the no-match cleanup/return path; pruned.splice(idx, 1) and the write-back are at lines 676-680. (src/pairing/pairing-store.ts:668, 9bedcff904dd)

Likely related people:

  • steipete: Local blame attributes the current secrets handler, channel pairing shim, and inspected pairing-store excerpt to Peter Steinberger's recent main commit, and the file history shows multiple adjacent pairing/secrets refactors by the same maintainer. (role: recent maintainer; confidence: high; commits: 5b063c2d8382, 01cff3a7a6, f274655f66; files: src/gateway/server-methods/secrets.ts, src/channels/plugins/pairing.ts, src/pairing/pairing-store.ts)
  • vincentkoc: Recent file history for pairing-store and channel plugin pairing includes pairing seam extraction and export work by Vincent Koc, directly adjacent to the docs corrections needed here. (role: recent pairing seam maintainer; confidence: medium; commits: cde21de82854, 7808d3f08f51, 9bc1f896c8; files: src/channels/plugins/pairing.ts, src/pairing/pairing-store.ts)
  • Josh Avant: The secrets handler history includes prior SecretRef coverage work across user-supplied credentials, which is adjacent to the gateway secrets guidance being added. (role: adjacent secrets maintainer; confidence: low; commits: 806803b7ef; files: src/gateway/server-methods/secrets.ts, src/secrets)

Remaining risk / open question:

  • If merged as-is, high-privilege contributor guidance would point future reviewers at stale or nonexistent anchors and one nonexistent pairing API name.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 9bedcff904dd.

@mayank6136
Copy link
Copy Markdown

Thanks for writing these up — the secrets RPC surface and the channel-pairing shim are exactly the two zones where I've watched our deployments hit footguns that an in-tree AGENTS.md would have caught. I read the diff against current main and verified the citations; here are a few places where I think the wording could be tightened to match the source. None of these are blockers — happy to see this land.

1. http-utils.ts:255 only anchors the HTTP path, not the WS one (also flagged by Greptile)

In src/gateway/server-methods/AGENTS.md, the threat-model bullet currently reads:

The HTTP (OpenAI-compatible / /tools/invoke) bearer-token path maps to senderIsOwner: true at src/gateway/http-utils.ts:255 (resolveOpenAiCompatibleHttpSenderIsOwner); the WS shared-secret surface carries the same semantics via a parallel path...

:255 is resolveOpenAiCompatibleHttpSenderIsOwner, which is HTTP-only (used by openai-http.ts:541, openresponses-http.ts:460, tools-invoke-http.ts:228). The WS shared-secret = owner semantic is real and intentional (SECURITY.md lines 103, 106-110) but flows through a different anchor — the shared-auth scope assignment around src/gateway/server/ws-connection/message-handler.ts:1316-1317 plus the per-RPC re-check at 1502-1513. Splitting these two anchors would make the doc match the code one-to-one.

2. Device-token "does not get owner by default" could use an anchor

Same paragraph. The asymmetry is load-bearing, as the doc rightly says — pointing at the absence of senderIsOwner in the device-token WS path (or to the relevant SECURITY.md paragraph) would help a future reader confirm it without reverse-engineering.

3. The three fix/... branch names will go stale

The "Related incidents" section explicitly hedges that some of these may not be in main yet, which I appreciate — but in six months the branch names will be unrecoverable. Consider replacing them with PR numbers / merge SHAs once they land, or marking the section "(branch names pending merge — will be replaced with refs)" so future readers know the placeholder is intentional.

4. Small attributability nits

  • (weight 24 historically) for the secrets → package co-mod edge — if that number is from the Architecture review: credential governance & undocumented coupling hotspots #71116 analysis, citing it (per #71116) would help.
  • isKnownSecretTargetId lives in target-registry-query.ts and is re-exported via target-registry.ts. Citing the barrel is fine; just flagging in case you want the deeper anchor.
  • Confirm #70239 resolves correctly when you next push.

One process suggestion

I see the PR picked up triage: blank-template and triage: low-signal-docs. The intro paragraph is genuinely substantive (the ghost-hotspot framing + tie to #71116), but the template's Summary bullets, Change Type (Docs), and Security Impact (all Nos, since this is pure docs) are still empty. Filling those in should clear both auto-labels and make the maintainer triage essentially a one-pass approve.

For what it's worth: I think this should land. The secrets/pairing zones are exactly where we've felt the lack of in-tree guidance, and the "silent failure shape" framing in particular is the kind of thing that pays for itself the next time someone is tempted to write a catch {} in a privilege-escalation path. Appreciate you doing this.

@mayank6136
Copy link
Copy Markdown

mayank6136 commented Apr 27, 2026

Mismarked my last comment — I'm not the PR author (that's @davidangularme), so I can't actually update the description from my side. Apologies for the confusion.

What I'd suggest, since the triage: low-signal-docs and triage: blank-template auto-labels look like the main thing standing in the way of human-maintainer attention:

@davidangularme — if you have a moment, filling in the PR body template (Summary bullets, Change Type = Docs, Security Impact = all No, Test Plan = N/A pure docs, Repro + Verification with the source-anchor verification done by clawsweeper) should clear both auto-labels. Happy to post a draft body you could paste in if helpful.

Substance-wise the doc itself reviews well (greptile gave 5/5, clawsweeper confirmed the citations against 9626ef274ae2); the inline review notes from greptile / chatgpt-codex-connector are mostly the http-utils.ts:255 citation precision issue (HTTP-only anchor; WS would need its own at message-handler.ts:1316-1317 and :1502-1513). Worth landing.

@davidangularme
Copy link
Copy Markdown
Contributor Author

@mayank6136 The PR body has been updated with the full template, and the inline citations (HTTP vs WS and device-token race) were fixed in the latest commits. CI is green. Let me know if you need anything else to clear the triage labels!

Two ghost-hotspot zones surfaced repeatedly in today's architectural
analysis as the highest-severity undocumented coupling points in the
repo: src/gateway/server-methods/secrets.ts (coherence 0.14, severity
0.94, 347 co-modification neighbors) and src/channels/plugins/pairing.ts
(severity 0.94, 348 neighbors). Both are thin RPC/registry shells that
gate privilege escalation and whose contracts are not written down.

Extend the existing src/gateway/server-methods/AGENTS.md with a Secrets
surface section covering: threat model (operator.admin + shared-secret
owner semantics vs device-token), invariants that must hold (errorShape,
payload schema gating, no silent respond(true) in catch), and three
concrete incidents from this week's PRs as examples of the silent-
failure shape to watch for.

Create src/channels/plugins/AGENTS.md (+ CLAUDE.md symlink per repo
convention) covering: pairing-code single-use guarantee anchored in
pairing-store.ts:668-672, the 1+2+3 approve-allowlist-credential chain
that is not globally atomic, the shared-auth vs device-token per-RPC
asymmetry that the device-token PR closed, and explicit 'must never
happen' list.

Scoped to documentation only. No code changes. Targets the two zones
identified as highest ROI in architecture-review issue openclaw#71116.
Greptile review on openclaw#71126 flagged that the 'HTTP and WS both map to
senderIsOwner: true at http-utils.ts:255' claim was only half-supported
by the citation — line 255 is specifically resolveOpenAiCompatibleHttp
SenderIsOwner, covering the OpenAI-compatible HTTP + /tools/invoke
path. Narrow the anchor to what the line actually shows, and keep the
WS shared-secret note as a parallel-path claim without pinning it to a
line that doesn't contain it.
Codex review on openclaw#71156 correctly flagged that the AGENTS.md was
describing a synchronous 'invalidated' flag on GatewayWsClient plus a
per-RPC dispatch guard as already-landed guarantees, when they live in
the still-open fix/gateway-device-token-rpc-revalidation PR. On main,
GatewayWsClient has no 'invalidated' field and message-handler.ts only
re-checks usesSharedGatewayAuth. Documenting the proposed fix as a
shipped guarantee could let reviewers wave through rotate/revoke code
paths that are in fact still racy against pipelined RPCs.

Rewrite three references in the two AGENTS.md files:

- Reframe the 'Related incidents' list in server-methods/AGENTS.md
  from 'landed' to 'in-flight' and mark rotate/revoke on main as
  best-effort rather than race-safe.
- Rewrite the 'Shared-auth vs device-token' section in
  channels/plugins/AGENTS.md to describe current main (no per-RPC
  check for device-token) and position the 'invalidated' flag as a
  proposal, not a state.
- Rewrite the rotate/revoke 'must never happen' bullet from 'the
  invalidated flag must be set before respond()' to a mechanism-
  agnostic invariant ('old-token authority must end before response
  flush, whichever mechanism closes the race').

No code changes. Keeps the content honest against main until the
device-token PR lands (which this doc PR does not depend on).
@davidangularme davidangularme force-pushed the docs/secrets-pairing-agents-md branch from bef0efa to 53849c6 Compare April 28, 2026 09:18
@davidangularme
Copy link
Copy Markdown
Contributor Author

The failing parity gate (thread-memory-isolation, scenario 8/12) is unrelated to this diff — this PR is pure Markdown + one symlink, no code changes. The same scenario fails on other PRs against main (job 73356314544). Happy to rebase once the gate is green on main, or this could be merged with a check bypass if maintainers prefer. Also: the triage: blank-template label may need a manual clear — the PR body was updated with the full template in the latest push.

@davidangularme
Copy link
Copy Markdown
Contributor Author

Hi @steipete, @vincentkoc,

The CI failure in the Opus 4.6 parity gate is specifically failing on scenario 10 (approval-turn-tool-followthrough). As this PR is strictly limited to documentation changes (Markdown files and a symlink), this failure is clearly unrelated to the current diff and appears to be an upstream/environmental flake.

All documentation-specific checks are passing. Could you please take a look or consider a bypass for the parity gate?

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

Labels

gateway Gateway runtime size: M triage: blank-template Candidate: PR template appears mostly untouched. triage: low-signal-docs Candidate: docs-only change looks low signal; maintainer review needed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants