Skip to content

feat(x): verify repository writers through GitHub profiles - #168071

Merged
steipete merged 1 commit into
mainfrom
steipete/x-github-writers
Oct 10, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/x-github-writers

Conversation

@steipete

@steipete steipete commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Repository collaborators currently need a separate manual X allowlist entry before they can ask the bot to do maintainer work.

User Impact

Operators can opt into channels.x.verifiedFromGitHub to verify everyone with push, maintain, or admin access to a repository through the X handle declared on their own GitHub profile. The feature is off by default and inherits per account. The X replies page shows read-only GitHub attribution and self-enablement guidance.

This implementation needs a configured GitHub token, preferably a SecretRef, with access to list the repository's collaborators. Existing managed GitHub identities do not expose a supported authenticated REST capability for these reads; the fallback uses the existing guarded fetch and channel-secret contracts without expanding the SDK.

Why This Change Was Made

A service refreshes collaborator permissions and profile declarations, resolves only new or changed X handles through the existing spend gate, and atomically replaces the derived keyed-state snapshot. Config and administrator entries remain effective. Successful removals retire the existing allowlist authorization fence; failed syncs retain the last good set and report stale status. Unchanged refreshes preserve in-flight authorization; successful paid lookup batches are checkpointed even when later batches fail. GitHub profiles use conditional ETag requests, and X lookups cost $0.01 per returned user.

The trust decision is explicit: the GitHub account already has repository write access and declares its X identity. A collaborator could declare a handle they do not own. The page exposes the originating GitHub login for every derived entry, and the next successful sync removes entries after permission or profile changes. This does not grant GitHub credentials or new host identity privileges to an X user.

The existing X secret artifact now also exports the standard registry/collector surface, so all X credential paths participate in secret configuration and audit discovery.

Evidence

  • pnpm test extensions/x --maxWorkers=1: 247 tests across 20 files passed; final wall time 62.90 s. Fetch stubs and fake clocks cover permission/pagination/profile sources, lookup caching and charging, in-flight revocation, stale-set recovery, and default-off behavior.
  • Three regression assertions fail with the original reviewed behaviors and pass with the fixes, including a 101-user import that completes across $1 daily budget windows without repeating paid lookups.
  • Managed GitHub username pagination/permission cases failed before the parser fix and passed afterward; focused reader run: 19 tests in 3.51 s.
  • X production/test scope typechecks, typed lint, oxfmt --check, and git diff --check passed.
  • Config schema, bundled-channel metadata, config-doc baseline, plugin inventory, and SecretRef inventory checks passed; the secret inventory regression passed (31.58 s wall, 1.623 s test body).
  • Read-only live GitHub reader probe passed against collaborator/profile/social-account endpoints. No paid X calls were used for verification.
  • Synthetic Control UI before/after proof exercised healthy, stale, and mobile states and built the plugin and Control UI. Baseline run: 22.25 s; after run: 22.30 s. Screenshots below contain only synthetic data.
  • Docs links, MDX, and config examples passed. Full product build is left to CI as requested.

Independent Codex autoreview is scoped-clean through P2 after resolving all three findings. Exact-head CI run 38013090418 passed all 67 jobs without failures on 25ae31e3147d9c71fd46221e6ff05997f716271b. The extension test job took 123 s; UI checks 101 s; UI E2E shards 181 s and 263 s. No reruns were needed. Both embedded screenshots were verified rendered in GitHub.

X replies before GitHub-derived verification (synthetic data)

X replies with GitHub-derived verification (synthetic data)

Review disposition and final behavior proof

The selected contract caches the resolved numeric X identity and only looks up new or changed GitHub declarations. ClawSweeper proposed periodically rebinding unchanged handles. That proposal is declined because it changes the explicit maintainer-selected lookup/cost policy: a renamed X account retains its numeric identity, while a new owner of its recycled handle must not automatically inherit the original grant. A collaborator must update/remove the GitHub declaration to change that binding; losing repository permission still removes it at the next successful sync. The cache is not a promise to continuously follow handle ownership.

A supplemental in-process smoke exercised the committed production sync, ingress, monitor, dispatch, delivery, and X API request owners with synthetic transport/runtime fixtures. Two cases passed in 38.00 s (73 ms test bodies): the derived numeric ID reached agent dispatch and one reply POST while an unverified neighboring ID was dropped; removing the collaborator while reply authorization awaited final I/O produced PlatformMessageNotDispatchedError and zero reply POSTs. This was a temporary task proof, not a live X send or additional committed CI suite.

Existing configured/admin allowlist storage shapes are unchanged. The new GitHub data uses a separate keyed-state namespace; the existing allowlist tests and explicit configured/stored-entry retention assertions pass. There is no migration of pre-existing allowlist data in this change.

Add opt-in GitHub collaborator verification with inherited SecretRef configuration, guarded reads, paid lookup caching, and the existing allowlist revocation fence. Preserve last-good access during failures and show GitHub attribution in X replies.
@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: x size: XL labels Oct 10, 2026
@steipete
steipete marked this pull request as ready for review October 10, 2026 01:24
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 10, 2026
@clawsweeper

clawsweeper Bot commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR optionally derives X maintainer access from repository collaborators’ GitHub profile declarations and displays their attribution.

Example: GitHub collaborator @Example-dev declares X handle @example, resolving to user ID 123.

  • Before: An administrator must separately add X user 123 to the allowlist.
  • After: With verifiedFromGitHub.repo configured, synchronization grants user 123 maintainer access and displays its GitHub source.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) Relevant UI and integration-test evidence exists, but a source-reproducible authority defect and incomplete final-effect and upgrade proof block readiness.
Proof confidence 🦪 silver shellfish (2/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦪 silver shellfish (2/6) Security review found an item that needs attention.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: Repository collaborators need a separate manual X allowlist entry to request maintainer work.
Reason: The recorded feature-owner direction supports this optional capability and its declaration-based trust tradeoff; the remaining blocker is implementation correctness.

Merge readiness

⛔ Blocked before merge - 5 items remain

Keep this PR open: it adds useful, owner-backed functionality, but permanent handle caching can retain maintainer access for the wrong X account.

Priority: P2
Reviewed head: 25ae31e3147d9c71fd46221e6ff05997f716271b

Before merge

  • Add real behavior proof - Authority-chain proof required: inspected synthetic screenshots establish the attribution UI, and the body reports a live GitHub reader probe, but supplied fetch-stub tests stop short of proving derived-user agent dispatch and reply POSTs. Show an allowed user and the nearest forbidden or reassigned user through the production owners, including revocation during awaited work before final I/O; redact credentials and non-public endpoints. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Revalidate successful handle mappings before renewing derived grants (P1) - Once alice resolves to X user 101, this code retains that persisted mapping for as long as any eligible collaborator declares alice. If user 101 renames away and alice is reassigned to user 102, subsequent healthy syncs never query X again: they regenerate a fresh grant for 101, deny 102, and leave the old authorization fence valid because the ID set is unchanged. Restarting preserves the error through lookupResults. This grants maintainer tools to an account that no longer matches the declared identity, beyond the documented failed-sync retention tradeoff. Bound successful-cache freshness and retire changed mappings through the existing fence; cover reassignment and persisted-state restart.
  • Resolve security concern: Historical identity survives successful synchronization - The existing final-effect guards consult the derived numeric-ID set, so they cannot reject an obsolete identity while synchronization continues publishing that ID as current.
  • Resolve merge risk - Before merge, prevent historical handle mappings from retaining another X account’s maintainer authority.
  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

  • [P1] Revalidate successful handle mappings before renewing derived grants — extensions/x/src/verified-github.ts:60-63
  • [high] Historical identity survives successful synchronization — extensions/x/src/verified-github.ts:60

Tests

  • Missing end-to-end proof: Supply a production-path trace for derived-user dispatch and replies, including handle reassignment and revocation before final I/O.
Agent review details

How this fits together

The X plugin reads GitHub collaborator permissions and profile declarations, resolves handles through its budgeted X client, and publishes persisted grants to the existing ingress and reply authorization owner.

flowchart LR
  A[GitHub collaborators and profiles] --> B[Verification service]
  B --> C[Budgeted X identity lookup]
  C --> D[Persisted derived grants]
  D --> E[Allowlist authorization fence]
  E --> F[Agent dispatch and public replies]
  D --> G[X replies settings page]
Loading

Technical review

Best possible solution:

Keep the plugin-owned synchronization and existing authorization fence, while bounding identity-cache freshness and revoking mappings when revalidation changes the numeric X ID.

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

Source shows that a persisted alice→101 mapping survives every healthy sync while alice remains declared, even if a new X lookup would return 102; no target code was executed.

Is this the best way to solve the issue?

The existing plugin service, budgeted client, and authorization fence are appropriate owners, but the persisted identity cache needs an invalidation lifecycle before it can safely supply current grants.

Full review comments:

  • [P1] Revalidate successful handle mappings before renewing derived grants — extensions/x/src/verified-github.ts:60-63
    Once alice resolves to X user 101, this code retains that persisted mapping for as long as any eligible collaborator declares alice. If user 101 renames away and alice is reassigned to user 102, subsequent healthy syncs never query X again: they regenerate a fresh grant for 101, deny 102, and leave the old authorization fence valid because the ID set is unchanged. Restarting preserves the error through lookupResults. This grants maintainer tools to an account that no longer matches the declared identity, beyond the documented failed-sync retention tradeoff. Bound successful-cache freshness and retire changed mappings through the existing fence; cover reassignment and persisted-state restart.
    Confidence: 0.95

Overall correctness: patch is incorrect
Overall confidence: 0.94

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 1f307d61d0f7.

Merge-risk options

Maintainer options:

  1. Bound cached identity authority (recommended)
    Revalidate successful handle mappings, retire changed IDs through the existing fence, and cover reassignment across persisted-state restart.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Repair successful handle-cache invalidation in the X verification owner; preserve spend gating, paid-batch checkpoints, manual grants, and the recorded failed-sync policy.

Provenance checked

  • X sender authorization and allowlist revocation keeps the original intent (b878998: Invalidate in-flight grants after allowlist changes and recheck before dispatch and reply POSTs.)
  • Maintainer and guest tier selection changes intended behavior with a stated reason (dce3f8b: Give unallowlisted senders restricted repository-question access without maintainer tools or sessions.)
  • Paid X identity reads keeps the original intent (a9f4779: Reserve paid requests before dispatch and settle against returned resources.)

Testing

Proof path: in-process harness.

Security

Needs attention: Persisted handle mappings can outlive the identity relationship that granted maintainer access.

Evidence

Security concerns:

  • [high] Historical identity survives successful synchronization — extensions/x/src/verified-github.ts:60
    The existing final-effect guards consult the derived numeric-ID set, so they cannot reject an obsolete identity while synchronization continues publishing that ID as current.
    Confidence: 0.95

What I checked:

PR surface

Source +856, Tests +764, Docs +179, Generated 0. Total +1799 across 31 files. Added test files: 2.

View PR surface stats
Area Files Added Removed Net
Source 19 877 21 +856
Tests 6 794 30 +764
Docs 3 183 4 +179
Config 0 0 0 0
Generated 3 5 5 0
Other 0 0 0 0
Total 31 1859 60 +1799

Review metrics

Metric Value Why it matters
New configuration surface 4 optional settings Adds repo, minPermission, refreshMinutes, and token under verifiedFromGitHub at channel and inherited account scope; the feature remains off by default.

Labels

Label changes:

  • add P2: This is an unreleased, optional X integration improvement with a blocking authorization defect.
  • add merge-risk: 🚨 security-boundary: A persisted historical handle lookup can grant maintainer tools to an X ID that no longer owns the collaborator-declared handle.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦪 silver shellfish.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Label justifications:

  • P2: This is an unreleased, optional X integration improvement with a blocking authorization defect.
  • merge-risk: 🚨 security-boundary: A persisted historical handle lookup can grant maintainer tools to an X ID that no longer owns the collaborator-declared handle.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

Reviewed October 9, 2026, 9:31 PM ET / October 10, 2026, 01:31 UTC.

@steipete
steipete merged commit af6e7d0 into main Oct 10, 2026
210 of 211 checks passed
@steipete
steipete deleted the steipete/x-github-writers branch October 10, 2026 01:44
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 10, 2026
…168071)

Add opt-in GitHub collaborator verification with inherited SecretRef configuration, guarded reads, paid lookup caching, and the existing allowlist revocation fence. Preserve last-good access during failures and show GitHub attribution in X replies.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: x docs Improvements or additions to documentation merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant