openlibrary icon indicating copy to clipboard operation
openlibrary copied to clipboard

Issue Enrichment: allowed_non_write_users bypass not taking effect for non-write actors

Open mekarpeles opened this issue 4 months ago • 3 comments

Problem

.github/workflows/issue_enrichment.yml sets allowed_non_write_users: "*" (via #13154, merged 2026-07-15 05:03 UTC) to let claude-code-action's write-permission gate bypass for issues opened by non-write contributors — otherwise the enrichment action rejects nearly every community-filed issue. As of this writing, that bypass has not been observed to take effect for a real non-write actor.

Evidence

  1. Issue #13155 (opened by milotype, confirmed read-only collaborator permission) triggered an Issue Enrichment run at 2026-07-15T12:24:12Z — 7+ hours after #13154 merged. It failed: Actor does not have write permissions to the repository.
  2. Re-running that same job (gh run rerun 29415075400) still fails identically. The failure log shows ALLOWED_NON_WRITE_USERS: (empty) and "allowed_non_write_users": "" at runtime — the bypass value never reached the action, despite being set to "*" in the workflow file on master.
  3. Tracing the run's headSha (e3c0b6794d472dac7d0bd21978525db6136f48b4) shows it resolves to a commit from 2026-07-13, two commits behind current master and not an ancestor-inclusive of #13154's fix. The run (created 07-15 12:24 UTC, well after the 05:03 UTC merge) was resolved against a stale snapshot of the workflow file.
  4. The two success runs seen today were both for issues opened by mekarpeles (staff, pre-existing write access) — they never exercised the bypass gate at all, so they aren't evidence the fix works.

Hypothesis

This looks like GitHub Actions' known lag in resolving the workflow-file version for events not tied to a git ref (issues, issue_comment, etc.) — the default-branch snapshot used to resolve the workflow can trail real pushes by an unpredictable window, unlike push/pull_request runs which pin to an explicit commit. Re-running an old run reuses its original (stale) resolution rather than picking up the current file.

Next steps

  • Confirm with a genuinely new issues: opened event (not a rerun) from a non-write, non-staff account once enough time has passed since #13154 merged.
  • If it still fails on a fresh event, the bug is elsewhere (e.g. a mismatch between the pinned anthropics/claude-code-action@v1 resolution and the input wiring) and needs further isolation.
  • openlibrary-bot is not a valid test account for this — it already has write permission on the repo (confirmed via gh api repos/internetarchive/openlibrary/collaborators/openlibrary-bot/permission), so it would bypass the gate for an unrelated reason.

Related

  • #13160 — Epic: AI Workflows (parent)
  • #13154 — the fix this bug reports on
  • #13155 — the real-world issue that surfaced this

mekarpeles avatar Jul 15 '26 21:07 mekarpeles

⚠️ Contributors, this issue will be ready to work on once:

  • [ ] Needs: Investigation — the bypass still needs to be confirmed against a genuinely new issues: opened event from a non-write actor (see Context below — the evidence cited for the current failure predates the fix and doesn't establish a GitHub Actions bug)

Context

  • The allowed_non_write_users: "*" bypass and its rationale comment live at issue_enrichment.yml#L46-L51, merged via #13154.
  • Timestamp correction: PR #13154 was created at 2026-07-15T05:03:18Z but not merged until 2026-07-15T17:33:38Z (confirmed via gh api repos/internetarchive/openlibrary/pulls/13154). The issue's evidence section appears to use the creation time as the merge time.
  • Pulling the actual run history (gh api repos/internetarchive/openlibrary/actions/workflows/306909784/runs) changes the read on the two data points cited:
    • Run 29415075400 attempt 1 was created at 2026-07-15T12:24:12Z — over 5 hours before #13154 actually merged (17:33:38Z). Its failure is expected/correct: the bypass genuinely wasn't on master yet at that point. It isn't evidence of a lag bug.
    • Attempt 2 (the gh run rerun) still resolved head_sha: e3c0b6794d472dac7d0bd21978525db6136f48b4 — identical to attempt 1 — even though the rerun itself was invoked later (mekarpeles's comment on #13155, timed 21:55:02Z, lines up with the rerun's run_started_at: 21:55:36Z, well after the 17:33:38Z merge). A rerun reusing its original run's resolved commit rather than re-resolving against current master fully accounts for the identical failure, without needing a "workflow-file resolution lag" explanation.
    • No genuinely fresh issues: opened run from a non-write actor has occurred since the merge. The three post-merge runs with head_sha: 8404a0c (20:27:52Z, 20:32:25Z, 21:49:03Z) were all triggered by mekarpeles (pre-existing write access) — consistent with point 4 in the issue body that these don't exercise the gate.
    • Tangential: run 28984836071 (2026-07-09, pre-fix) shows jimchamp — who is on the issue_enrichment.md blessed-staff list — also failing the actor-permission check. That list tracks who gets full-vs-templated enrichment treatment; it isn't the same set as GitHub collaborator "write" permission, so it's a separate axis from this bug.

Issue Assessment

Open questions

  • [x] Does the "GitHub Actions workflow-resolution lag" hypothesis explain the observed failures? (Answer: evidence points against it — the original failure predates the merge, and the rerun's identical head_sha is explained by rerun semantics reusing the original run's resolved commit, not by lag in resolving the default-branch workflow file.)
  • [ ] Has a real issues: opened event from a non-write, non-staff account fired since 2026-07-15T17:33:38Z (the actual merge time)? Not as of this research — this needs to happen naturally (or be arranged with a genuinely non-write test account) before the bypass can be called confirmed or refuted.

Full triage checklist
  • [x] Triage — correct labels applied or removed
  • [x] Problem / opportunity — problem is clear, audience identified, actionable
  • [x] Scope — issue is well-scoped; does not try to do too many things
  • [x] Justification — reasoning and impact stated; sufficient for leads to prioritize
  • [x] Success & testing criteria — implicit but clear: a fresh non-write issues: opened event must succeed
  • [x] Proposal & breakdown — concrete "Next steps" plan present and actionable
  • [x] If bug: environment & repro steps — run IDs, timestamps, and log excerpts given in lieu of browser/OS (not applicable to a CI bug)
  • [x] Risks, concerns, open questions — identified and surfaced
  • [x] Richy context — relevant code, commits, PRs, and run history reviewed; no duplicate found
  • [x] References — run IDs and permalinks present where needed

[!NOTE] This comment was automatically generated by Richy, Open Library's issue enrichment assistant, on behalf of @mekarpeles. This is NOT a sign-off. This issue needs lead review before work begins.

openlibrary-bot avatar Jul 15 '26 22:07 openlibrary-bot

Supporting data point: the new pr_autoresponder.yml (#13164) ran on its own PR and the log shows the allowed_non_write_users="*" bypass firing correctly (Bypassing write permission check for mekarpeles due to allowed_non_write_users='*') — using the current workflow file, not a stale one. pull_request events are ref-tied to the PR's head commit, unlike issues events, which may be why this one isn't hitting the same resolution-lag bug. Doesn't resolve this issue (that test was staff, still not a real non-write actor) but is consistent with the ref-tied-vs-not theory.

mekarpeles avatar Jul 15 '26 22:07 mekarpeles

Can be closed, see proof of working w/ non-staff: https://github.com/internetarchive/openlibrary/issues/13170#issuecomment-4988551509

mekarpeles avatar Jul 16 '26 15:07 mekarpeles