clawsweeper icon indicating copy to clipboard operation
clawsweeper copied to clipboard

repair: multi-owner CLAWSWEEPER_ALLOWED_OWNER is passed to a single-owner app-token input, failing six workflows at their first step

Open yetval opened this issue 4 months ago • 1 comments

Summary

CLAWSWEEPER_ALLOWED_OWNER is defined in code as a comma or whitespace separated owner list, but six workflows pass it directly into the owner: input of actions/create-github-app-token, which accepts exactly one owner. With the variable set to two owners, that step 404s and the job dies before doing any work. Repair self-heal and spam scanning have been offline since 2026-07-21.

Environment

  • Commit: 6284161cdcd27e447ec5478c98327c5325460e43 (origin/main at time of filing)
  • Surface: repair-self-heal.yml, repair-conflict-self-heal.yml, repair-publish-results.yml, repair-finalize-open-prs.yml, repair-commit-finding-intake.yml, spam-scanner.yml

Steps to reproduce

  1. Set the repository variable CLAWSWEEPER_ALLOWED_OWNER to a two-owner policy list, for example openclaw,steipete.
  2. Trigger any of the six workflows above.
  3. Observe the Create GitHub App token step.

Expected

The token step mints a token for the owner that hosts the installation, and the multi-owner policy list continues to be enforced by the code gates that consume it.

Actual

The step interpolates the whole list into a single-owner input, requests users/openclaw%2Csteipete/installation, receives 404, and the job fails at step 1. No repair or scan work runs.

Root cause

The variable is an owner list by contract. src/repair/lib.ts:463-471:

// CLAWSWEEPER_ALLOWED_OWNER is the one authoritative repair owner policy
// (issue #604): a comma- or whitespace-separated owner list shared by intake
// and every execution gate, so eligibility cannot diverge between them.
export function allowedRepairOwners(allowedOwner?: string): string[] {
  return String(allowedOwner ?? "")
    .split(/[\s,]+/)
    .map((owner) => owner.trim().toLowerCase())
    .filter(Boolean);
}

Six workflows feed that same list into a single-owner action input:

# repair-self-heal.yml:57, repair-conflict-self-heal.yml:59,
# repair-publish-results.yml:34, repair-finalize-open-prs.yml:51,
# repair-commit-finding-intake.yml:103, spam-scanner.yml:94
          owner: ${{ vars.CLAWSWEEPER_ALLOWED_OWNER || github.repository_owner }}

The list contract was widened by PR #809 "feat(repair): one authoritative multi-owner repair policy enforced at intake" (merged 2026-07-23), which touched src/ and tests only. The workflow side was never updated, so the two consumers of the same variable now disagree on its type.

spam-comment-intake.yml:72 uses owner: ${{ github.repository_owner }} and is unaffected. It is the control case: 48 of its last 50 runs succeeded, with 2 cancelled and no failures.

Sibling surfaces

Downstream effect worth noting in the same fix: repair-publish-results.yml is one of the six. Workers run with --defer-publication, so that workflow is the only publisher of results/runs/<run_id>.json, and selectCandidates() in src/repair/self-heal-failed-runs.ts:357-364 reads candidates exclusively from those files. Self-heal will therefore still have no input for the whole outage window even after the token step is fixed.

Real behavior proof

Behavior addressed: a multi-owner policy list is passed to a single-owner token input, so six workflows fail at their first step. Real environment tested: production run logs from openclaw/clawsweeper, plus the real compiled policy function driven at commit 6284161cdcd27e447ec5478c98327c5325460e43. Exact steps or command run after this patch: inspect the Create GitHub App token step of run 30118372106, then drive the real exported parser with the same variable value using node --input-type=module -e 'import { allowedRepairOwners, isAllowedRepairOwner } from "./dist/repair/lib.js"; ...'. Evidence after fix:

# OBSERVED in production, run 30118372106, step "Create GitHub App token"
2026-07-24T18:48:57.8280059Z   owner: openclaw,steipete
2026-07-24T18:48:57.9343496Z Input 'repositories' is not set. Creating token for all repositories owned by openclaw,steipete.
2026-07-24T18:48:58.1359487Z Failed to create token for "openclaw,steipete" (attempt 1): Not Found - https://docs.github.com/rest/apps/apps#get-a-user-installation-for-the-authenticated-app
2026-07-24T18:48:58.1384098Z ##[error]Not Found - https://docs.github.com/rest/apps/apps#get-a-user-installation-for-the-authenticated-app
2026-07-24T18:48:58.1410788Z   status: 404,
2026-07-24T18:48:58.1411657Z     url: 'https://api.github.com/users/openclaw%2Csteipete/installation',

# OBSERVED, same value driven through the real policy parser at 6284161cdc
CLAWSWEEPER_ALLOWED_OWNER = "openclaw,steipete"
allowedRepairOwners -> ["openclaw","steipete"]
isAllowedRepairOwner(openclaw/clawsweeper) -> true
isAllowedRepairOwner(steipete/x) -> true

# EXPECTED: the same variable must remain a two-element policy list for the code gates,
# while the token step receives exactly one owner, as spam-comment-intake.yml:72 already does.

Observed result after fix: one repository variable is consumed as a list by the policy gates and as a scalar by the token action, and the scalar reading is what fails at 404. What was not tested: I did not mint a token with a corrected single-owner input to confirm the downstream jobs then succeed, since that requires the app credentials. I did not determine whether the intended installation owner is openclaw alone or whether a second installation exists for the other owner, so I am not proposing a specific value in this report. I did not verify whether any queued repair work was lost as opposed to merely delayed during the outage.

Additional context

Failure streaks in the last 100 runs of each workflow, as of 2026-07-24 19:30Z:

repair-self-heal.yml         44 failure, 55 cancelled, 1 success   last success 29841814620 at 2026-07-21T14:59:44Z
spam-scanner.yml             42 failure, 57 cancelled, 1 success   last success 29831521101 at 2026-07-21T12:46:34Z
repair-conflict-self-heal.yml 28 failure,  6 cancelled, 66 success  last success 30009172416 at 2026-07-23T12:58:09Z
spam-comment-intake.yml       0 failure,  2 cancelled, 48 success  (control, uses github.repository_owner)

The failing token step also produces secondary noise: spam-scanner.yml:164 is if: always(), so it runs after the token step dies without its setup step, and fails again with exit 127.

yetval avatar Jul 24 '26 19:07 yetval

Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed July 24, 2026, 3:42 PM ET / 19:42 UTC.

Summary Keep this issue open: the supplied current-main evidence identifies a concrete mismatch between a multi-owner policy parser and six single-owner GitHub App token inputs, with multiple repair and spam workflows failing before useful work begins. Likely related people: steipete (high confidence), whose merged policy work introduced the shared multi-owner contract that the workflow setup must now consume correctly.

Reproducibility: yes. at source level: set CLAWSWEEPER_ALLOWED_OWNER to two comma-separated owners and run any listed workflow; the documented parser yields a list while the token action receives that whole string as one owner. Production run evidence in the report independently shows the resulting encoded-owner 404, although the corrected credentialed path has not yet been run.

Next step The report identifies the affected scalar inputs, the existing correct control pattern, and a focused validation path, so one narrow repair PR can address the outage without changing the authorization policy.

Review details

Best possible solution:

Use the repository owner as the scalar GitHub App token owner in every affected workflow, retain the list parser solely for authorization gates, add focused regression coverage or a workflow assertion, and verify a real post-fix run plus any deferred-publication backlog.

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

Yes at source level: set CLAWSWEEPER_ALLOWED_OWNER to two comma-separated owners and run any listed workflow; the documented parser yields a list while the token action receives that whole string as one owner. Production run evidence in the report independently shows the resulting encoded-owner 404, although the corrected credentialed path has not yet been run.

Is this the best way to solve the issue?

Yes: separating the scalar token-installation owner from the list-valued repair authorization policy is the narrowest fix and matches the unaffected workflow control path. It avoids weakening the multi-owner eligibility checks introduced by https://github.com/openclaw/clawsweeper/pull/809.

AGENTS.md: found and applied where relevant.

Remaining risk / open question:

  • Changing only the six token inputs should restore startup, but the intended installation owner must remain the repository host rather than silently selecting an arbitrary member of the policy list.
  • The blocked publication workflow may have left an outage-window gap in deferred result files, so a successful post-fix run should be followed by a bounded backlog/reconciliation check.
  • The supplied evidence demonstrates the failing lookup but does not yet show a corrected token mint and downstream job completion with the production app credentials.

Codex review notes: model internal, reasoning high; reviewed against 6284161cdcd2.

Label changes

Label changes:

  • add P1: Six production repair and spam workflows reportedly fail at token setup, preventing their normal automation work from starting.
  • add impact:other: The concrete impact is an operational repair and scanning outage, which does not fit the more specific message, session, provider, data-loss, or crash labels.
  • add issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label.
  • add clawsweeper:source-repro: Current issue advisory state selects this label.
  • add clawsweeper:queueable-fix: Current issue advisory state selects this label.
  • add clawsweeper:fix-shape-clear: Current issue advisory state selects this label.

Label justifications:

  • P1: Six production repair and spam workflows reportedly fail at token setup, preventing their normal automation work from starting.
  • impact:other: The concrete impact is an operational repair and scanning outage, which does not fit the more specific message, session, provider, data-loss, or crash labels.
Evidence reviewed

Acceptance criteria:

  • pnpm run check
  • Verify all six affected workflow files pass github.repository_owner (or the established scalar equivalent) to actions/create-github-app-token rather than CLAWSWEEPER_ALLOWED_OWNER.
  • Run one affected workflow with a multi-owner allowed-owner variable and capture redacted logs showing token creation and downstream job startup.
  • Inspect deferred publication/self-heal inputs after the run to determine whether outage-window work requires reconciliation.

What I checked:

  • Current owner-policy contract: The reported current-main implementation parses CLAWSWEEPER_ALLOWED_OWNER by comma or whitespace into multiple normalized owners, so a value such as openclaw,steipete is intentionally a list for repair-policy checks. (src/repair/lib.ts:463, 6284161cdcd2)
  • Affected workflow inputs: The report identifies six workflows that pass the same list-valued variable directly to actions/create-github-app-token as its single owner input; the unaffected spam-comment-intake.yml control path instead uses github.repository_owner. (.github/workflows/repair-self-heal.yml:57, 6284161cdcd2)
  • Feature-history provenance: Merged PR https://github.com/openclaw/clawsweeper/pull/809 introduced the authoritative multi-owner repair-policy contract on July 23, 2026, but its described scope was shared repair code and tests rather than the affected workflow token inputs. (src/repair/lib.ts:463, 39cc165ba0d3)
  • Observed production failure: The issue includes production evidence from https://github.com/openclaw/clawsweeper/actions/runs/30118372106 showing owner: openclaw,steipete followed by a 404 installation lookup for the URL-encoded combined owner, which is consistent with a scalar action input receiving the policy list.
  • Operational follow-on: The report explains that repair-publish-results.yml is among the blocked workflows and is the publisher for deferred worker result files consumed by self-heal candidate selection, so restoring token creation may require checking the outage-window backlog separately. (src/repair/self-heal-failed-runs.ts:357, 6284161cdcd2)

Likely related people:

  • steipete: The merged PR https://github.com/openclaw/clawsweeper/pull/809 introduced the multi-owner parser and the stated authoritative-policy rollout that this workflow regression now needs to preserve. (role: introduced shared owner-policy behavior; confidence: high; commits: 39cc165ba0d3; files: src/repair/lib.ts, test/repair/issue-implementation-intake.test.ts)
How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

clawsweeper[bot] avatar Jul 24 '26 19:07 clawsweeper[bot]