Skip to content

Let runners register in parallel with one registration token - #24

Merged
waynesun09 merged 8 commits into
mainfrom
emu-05-runner-registration
Nov 19, 2026
Merged

waynesun09 merged 8 commits into
mainfrom
emu-05-runner-registration

Conversation

@waynesun09

@waynesun09 waynesun09 commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Part of #39

What this fixes

Runners started at the same time with config.sh got 401 on their next runner API call, so parallel runner start-up failed. There were two causes.

GitHub Emulator before
Unnamed POST /actions/runner-registration (config.sh sends only url and runner_event; the name comes with the agent add after it) Each call gives the runner its own credential. A runner is replaced by name only at the agent add (config.sh --replace) Every call was named unnamed-runner. The reuse-by-name for restarting pods re-keyed that one row, so the earlier runners' credentials stopped working
Second use of a registration token Works: one token registers any number of runners until it expires (1 hour) 401: the token was deleted after one use

Changes

  • _create_runner_from_registration reuses a row by name only when the request names the runner. An unnamed registration always creates a new runner. A named one (a restarting pod) still reuses its row.
  • The registration token is no longer deleted after use, on every route that takes one: /actions/runner-registration, the pool agent add with a token in the body, and the repository and enterprise pipelines register. Expiry is still checked.
  • An enterprise remove token serves only config.sh remove (a runner-registration call with runner_event remove) and registers no runner on any route. Migration 0019_enterprise_remove_tokens adds a nullable for_remove column to enterprise_runner_registration_tokens to tell the two apart; existing rows stay registration tokens.
  • Issuing a registration or remove token drops the tokens past their expiry.
  • Deleting an agent with the credential from config.sh remove's own unnamed runner-registration call also deletes that broker row, as the --replace path already does.
  • A bug ledger entry, docs/bugs/fixed/runners-registering-together-lose-their-tokens.md, and its PLAN.md line.
  • An import sort in actions_dispatch.py and actions_pipelines.py, and the unused hashlib import removed (ruff I001, F401).

Tests

New tests in tests/actions/test_unnamed_runner_registration.py:

Test On main
test_unnamed_registrations_keep_their_own_tokens fails (401)
test_one_registration_token_registers_several_runners fails (401)
test_a_repository_token_registers_several_runners_on_every_route fails (401)
test_a_remove_token_serves_remove_and_registers_no_runner fails
test_config_sh_remove_leaves_no_runner_behind fails
test_expired_registration_tokens_are_pruned fails
test_a_named_registration_still_reuses_its_row passes: it guards the restarting-pod case

Full suite: runs in this pull request's CI (ci.yml).

Effect on existing behaviour

  • A named registration behaves as before.
  • A registration token can be used again until it expires, where a second use got 401 before. Expired tokens are refused as before, and are deleted when a new token is issued.
  • An enterprise remove token no longer registers a runner.
  • config.sh remove leaves no unnamed-runner row behind.
  • The schema gains one nullable column (migration 0019_enterprise_remove_tokens, after fix(#40): allocate user and organization ids from one sequence #41's 0018).

@waynesun09
waynesun09 requested a review from jctanner November 18, 2026 21:18
@qodo-code-review

qodo-code-review Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

Allow parallel runners to share a registration token

🐞 Bug fix 🧪 Tests 📝 Documentation 🕐 20-40 Minutes

Grey Divider

AI Description

• Give unnamed registrations separate runner credentials so parallel startups do not invalidate one
 another.
• Keep registration tokens reusable until expiry across runner registration routes, while preserving
 named-runner reuse.
• Add regression tests and document the failure and fix.
Merge Risk 🟡 Medium

Blast radius 🟡 Medium 💥 2 capabilities

  • 2 affected capabilities within one bounded functional scope: self-hosted runner integration.
  • Registration creates the runner credential that is subsequently consumed by distributed-task and dispatch endpoints.
  • Repository and enterprise pipelines routes are alternate producers of the same runner-registration outcome, not independent functional scopes.
  • Removal, agent lookup, and REST/pipelines/admin visibility are different surfaces of the same bounded runner-management integration.
  • They share runner persistent state and scope filtering; the path shows the remove credential crossing authentication, state, deletion, and inventory consumers.
Sources

alembic/versions/0019_enterprise_remove_tokens.py[32-40]

def upgrade() -> None:
    inspector = inspect(op.get_bind())
    tables = set(inspector.get_table_names())
    for table, column in _COLUMNS:
        if table not in tables:
            continue
        if column in {c["name"] for c in inspector.get_columns(table)}:
            continue
        op.add_column(table, sa.Column(column, sa.Boolean(), nullable=True))
Behavioral complexity 🔴 High 🧩 Multiple interactions

  • Before: all runner-registration exchanges and runner bearer credentials represented ordinary runners, and listings consumed the runner table without a remove-only distinction.
  • After: a nullable migration marker distinguishes registration tokens from remove tokens; an exchanged remove credential must be admitted for agent lookup and deletion but rejected for ordinary runner operations, excluded from listings, scoped to the matching enterprise, and consumed during deletion.
  • New correctness condition: authentication permissions, persistent row classification, deletion target identity, job/session cleanup, and every runner-list consumer must agree across pre-migration NULL rows and newly marked rows.
  • These are coordinated invariants and compatibility cases introduced by the new state transition, not complexity inherited merely from SQLAlchemy or existing cleanup helpers.
Sources

alembic/versions/0019_enterprise_remove_tokens.py[32-40]

def upgrade() -> None:
    inspector = inspect(op.get_bind())
    tables = set(inspector.get_table_names())
    for table, column in _COLUMNS:
        if table not in tables:
            continue
        if column in {c["name"] for c in inspector.get_columns(table)}:
            continue
        op.add_column(table, sa.Column(column, sa.Boolean(), nullable=True))
Potential damage 🟡 Medium 🩹 Temporary loss

  • A bad token or identity transition can prevent a runner from registering, invalidate an earlier runner credential, or leave a newly registered runner unable to poll or dispatch jobs.
  • Recovery is generally supported by issuing a fresh registration token and reconfiguring or re-registering the affected runner.
  • Reverting code does not repair already-created rows or credentials automatically, but the affected persistent state can be replaced through supported registration flows.
  • No external financial or confidentiality effect is established.
  • Recoverable through a fresh registration token and runner re-registration; stale rows or invalidated credentials may require administrative cleanup.
  • Existing queued workflow state is not directly rewritten by the registration-token change.
Assessed commit e9b1e17
Diagram

graph TD
    A["Runner client"] --> B["Registration routes"] --> C{"Token valid?"}
    C -->|no| X["401 response"]
    C -->|yes, reusable| D{"Named dispatch?"}
    D -->|yes| E["Reuse named runner"] --> G["Runner credential"]
    D -->|no| F["Create runner"] --> G
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Centralize registration handling
  • ➕ One token-lifecycle policy could reduce drift between registration routes.
  • ➖ The routes have different runner-creation and response behavior, making a shared abstraction a broader, riskier change.

Recommendation: The focused route-level fix is appropriate for this regression: it retains existing expiry checks and named-runner reuse without restructuring distinct protocols. Consider centralizing token validation separately if these routes continue to diverge.

Files changed (6) +178 / -12

Bug fix (3) +21 / -12
actions_dispatch.pySeparate unnamed registrations and retain their registration token +13/-7

Separate unnamed registrations and retain their registration token

• Limits name-based runner-row reuse to requests that supply a name, so unnamed runners no longer re-key one shared row. Stops deleting the registration token after runner creation and cleans up imports.

src/app/api/actions_dispatch.py

actions_distributed_task.pyKeep tokens reusable for pool agent registration +2/-1

Keep tokens reusable for pool agent registration

• Stops consuming the registration token when a pool agent is created with a token in the request body.

src/app/api/actions_distributed_task.py

actions_pipelines.pyKeep tokens reusable on both pipelines registration routes +6/-4

Keep tokens reusable on both pipelines registration routes

• Stops deleting registration tokens after repository and enterprise runner registration. Also sorts the affected imports.

src/app/api/actions_pipelines.py

Tests (1) +111 / -0
test_unnamed_runner_registration.pyCover independent credentials and reusable registration tokens +111/-0

Cover independent credentials and reusable registration tokens

• Tests that multiple unnamed registrations retain working credentials, one token registers multiple runners, and named registration still reuses its row. Also exercises repeated repository-token use through pool agent add and pipelines registration.

tests/actions/test_unnamed_runner_registration.py

Documentation (2) +46 / -0
PLAN.mdIndex the fixed runner-registration bug +1/-0

Index the fixed runner-registration bug

• Adds the new fixed-bug entry to the plan's bug ledger.

PLAN.md

runners-registering-together-lose-their-tokens.mdDocument the parallel-registration failure +45/-0

Document the parallel-registration failure

• Records both causes of the 401 responses, reproduction steps, expected behavior, and the fix.

docs/bugs/fixed/runners-registering-together-lose-their-tokens.md

@fullsend-ai-review

fullsend-ai-review Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 9:20 PM UTC · Completed 9:27 PM UTC

Commit: 507fd41 · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $1.77

@qodo-code-review

qodo-code-review Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Used registration tokens accumulate forever ✓ Resolved

Resolving commit: 5779a50

Resolution reason
Added _prune_expired_registration_tokens, which deletes expired registration and enterprise
registration tokens without deleting on use, and invokes it when new registration or remove tokens
are created; added a test verifying expired tokens are pruned.
Description
The registration routes now retain successful token records, but no path deletes them after
expires_at. Every normally used repository or enterprise token therefore remains in its database
table indefinitely, making those tables grow with routine runner registrations.

2. Remove tokens can register many runners ✓ Resolved

Resolving commit: 5779a50

Resolution reason
Adds a for_remove flag on enterprise registration tokens, set by the remove-token route.
Registration is refused for remove-purpose tokens in actions_dispatch.py (only runner_event "remove"
is allowed), in actions_distributed_task.py (pool agent registration treats remove tokens as no
runner), and in actions_pipelines.py (pipelines registration rejects them). The remove exchange
still works and tests assert remove tokens register no runner. This addresses the finding with a
different implementation (flag and route checks rather than a separate credential type).
Description
create_enterprise_remove_token stores remove tokens as EnterpriseRunnerRegistrationToken
records, and the registration routes accept them without distinguishing their purpose. Retaining
those records after use now lets anyone holding a remove token mint multiple enterprise runner
credentials throughout its one-hour lifetime, rather than at most one.

3. Runner removals leave extra rows behind ✓ Resolved

Resolving commit: 5779a50

Resolution reason
In dt_delete_pool_agent, after deleting the target agent, the authenticated runner is also deleted
when it is a different runner named "unnamed-runner" (the temporary config.sh remove credential). A
test test_config_sh_remove_leaves_no_runner_behind asserts runner counts return to baseline after
repeated remove cycles. This matches the suggested fix's cleanup intent, though it does not change
_create_runner_from_registration itself and instead handles cleanup on the delete path.
Description
_create_runner_from_registration creates a new unnamed-runner row for every nameless request,
including the request made by config.sh remove. On each enterprise runner shutdown, the cleanup
script deletes the original agent but not this new row, so repeated shutdowns accumulate offline
entries in the runner list.

Grey Divider

Context sources
❌ Tickets: failed to load — Ticket collection could not establish complete evidence
✅ Compliance rules (platform): 6 rules
✅ Cross-repo context — repo relationships
  Explored: repo: fullsend-ai/fullsend (sha: fa7e47cc) — View relationship
Review mode: Auto: ⚖️ Balanced: Authentication and token lifecycle changes span multiple registration routes.

Grey Divider

Tip of the day
💡 Did you know, you can describe a rule in plain language on the Rules page and Qodo drafts it for you

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread src/app/api/actions_dispatch.py Resolved
Comment thread src/app/api/actions_dispatch.py Resolved
Comment thread src/app/api/actions_dispatch.py Resolved
@fullsend-ai-review fullsend-ai-review Bot added the risk/moderate PR risk: moderate label Nov 18, 2026
@fullsend-ai-review

fullsend-ai-review Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Risk Assessment: moderate (2/5)

Details

Moderate risk change across 10 files adding an Alembic schema migration and runner registration tests with no protected path or dependency edits, balanced by Actions endpoint change coupling and historical churn.

Previous run

Risk Assessment: moderate (2/5)

Details

Moderate risk change spanning 10 files with an Alembic schema migration and new runner registration tests, with no protected path or dependency changes, balanced by historical regression churn and change coupling across Actions endpoints.

Previous run (2)

Risk Assessment: moderate (2/5)

Details

Moderate risk change spanning 9 files with an Alembic schema migration and new runner registration tests, with no protected path or dependency changes, balanced by historical regression churn and change coupling across Actions endpoints.

Previous run (3)

Risk Assessment: moderate (2/5)

Details

Moderate change size and clear alignment with tracking issue #39 with thorough test coverage, with risk driven primarily by an Alembic schema migration and moderate historical churn on shared files.

Previous run (4)

Risk Assessment: moderate (2/5)

Details

Moderate risk change modifying 9 files including an Alembic migration and runner registration tests with no protected or dependency changes, maintaining moderate risk due to historical regression churn and coupling in Actions endpoints.

Previous run (5)

Risk Assessment: moderate (2/5)

Details

Moderate risk change expanded from 6 to 9 files including an Alembic migration and runner registration tests with no protected or dependency changes, maintaining moderate risk due to historical regression churn and coupling in Actions endpoints.

Previous run (6)

Risk Assessment: moderate (2/5)

Details

Moderate risk change modifying runner registration endpoints across 6 files with test coverage and no protected or dependency changes, balanced by historical coupling and regression churn in actions dispatch logic.

@fullsend-ai-review

fullsend-ai-review Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Review

Findings

Low

  • [incorrect-doc] specs/github-actions.md:1564 — Section 26.3 still says the registration token is "1 hour, single-use". This PR removes the post-use deletion on every registration route, so one token now registers any number of runners until it expires. The spec is not updated by this PR.
    Remediation: Edit specs/github-actions.md line 1564 to say the registration token expires after 1 hour and is reusable until it expires.
  • [logic-error] src/app/api/actions_dispatch.py:402 — register_site_wide_runner still includes enterprise remove-only credentials in its reuse-by-name lookup (null repo_id/org_id). After an abandoned remove exchange, registering a site-wide runner named unnamed-runner re-keys that credential without clearing remove_only, so the token is rejected by runner endpoints; several abandoned exchanges make scalar_one_or_none() raise a 500.
    Remediation: Restrict site-wide reuse to enterprise_slug IS NULL and remove_only IS NOT TRUE, and test registration after abandoned remove exchanges.
  • [api-contract] src/app/api/actions_runners.py:166 — The individual enterprise runner GET (and the repository individual-runner GET) still returns remove-only credential rows as ordinary runners, although the list endpoints exclude them.
    Remediation: Apply Runner.remove_only.is_not(True) to both individual-runner GET queries and test that remove-only IDs return 404.
  • [rbac-violation] src/app/api/actions_dispatch.py:119 — Exchanging an expiring remove token creates a remove-only credential with no expiration. An abandoned exchange can still list and delete runners in its scope after the source remove token expires. No broader than the non-expiring ordinary runner credentials the emulator already issues.
    Remediation: Give remove-only credentials an expiry no later than the source token and enforce it during authentication.
  • [misplaced-abstraction] src/app/models/actions.py:26 — remove_only stores config.sh remove broker credentials in the runners table although the code comment says the credential "is not a runner". Every runner query needs a remove_only filter; the missed ones cause the two findings above.

Earlier findings

  • src/app/api/actions_dispatch.py:109, rbac-violation — resolved; the remove exchange now creates a separate remove_only credential and the reuse-by-name query skips such rows.
  • src/app/api/actions_distributed_task.py:535, rbac-violation (two findings) — resolved; agent update is scoped with _same_scope_as(authenticated_runner).
  • src/app/api/actions_distributed_task.py:546, rbac-violation (two findings) — resolved; agent deletion is scoped with _same_scope_as(authenticated_runner).

Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR

4 finding(s) below the low severity threshold were not posted.

Previous run

<!-- fullsend:review-findings-v2:eyJ2ZXJzaW9uIjoyLCJhY3Rpb24iOiJyZXF1ZXN0LWNoYW5nZXMiLCJmaW5kaW5ncyI6W3sic2V2ZXJpdHkiOiJsb3ciL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iiwic3RhdHVzIjoib3BlbiJ9LHsiaWQiOiJmXzY0Y2M4ZmI1NWIyM2RjNjAiLCJzdGF0dXMiOiJvcGVuIn0seyJpZCI6ImZfZGI0ZWM3ZjJjN2Q3NzQyZiIsInN0YXR1cyI6InJlY2xhc3NpZmllZCJ9LHsiaWQiOiJmX2Y1MjhjZTNiZTNiN2E4ZWQiLCJzdGF0dXMiOiJyZWNsYXNzaWZpZWQifSx7ImlkIjoiZl9kZTk5MmI2YzU0ZGVlYzdlIiwic3RhdHVzIjoicmVjbGFzc2lmaWVkIn0seyJpZCI6ImZfZjE5OTQ2YmFmN2Q4ODBiYyIsInN0YXR1cyI6Im9wZW4ifSx7ImlkIjoiZl8wN2JkNDdhMzRhMjY5Y2RhIiwic3RhdHVzIjoicmVzb2x2ZWRfYnlfY2hhbmdlIn0seyJpZCI6ImZfNzY2ZmY3NDQ1MjViNDZjMCIsInN0YXR1cyI6InJlc29sdmVkX2J5X2NoYW5nZSJ9XX0= -->

Review

Findings

Low

  • [incorrect-doc] specs/github-actions.md:1564 — Section 26.3 still says "Registration token: 1 hour, single-use", but this PR keeps registration tokens until they expire. Still present; the file is not touched by this PR.
    Remediation: Update the line, e.g. "valid for 1 hour, can register multiple runners".
  • [logic-error] src/app/api/actions_dispatch.py:402 — The site-wide registration lookup matches only name, repo_id IS NULL and org_id IS NULL, so it also matches enterprise-scoped unnamed-runner remove-only brokers. One match is re-keyed but stays remove_only (the credential is then rejected); several matches make scalar_one_or_none() raise and return 500. Only triggers when an admin names a site-wide runner unnamed-runner.
    Remediation: Add Runner.remove_only.is_not(True) and Runner.enterprise_slug.is_(None) to the lookup, with a regression test.
  • [api-contract] src/app/api/actions_runners.py:166 — Remove-only credentials are hidden from the runner lists, but the single-runner GET endpoints (enterprise here and repository get_runner near line 320) do not filter them, so the id from a remove exchange returns a phantom unnamed-runner.
    Remediation: Apply the remove_only exclusion to both GET queries and test that broker ids return 404.
  • [rbac-violation] src/app/api/actions_dispatch.py:109 — The remove exchange yields a removal credential with no expiry; it keeps working after its source token expires and is pruned. It adds no capability beyond an ordinary runner credential, which also does not expire.
    Remediation: Optionally store an expiry bounded by the source token and enforce it on agent list and delete.
  • [misplaced-abstraction] src/app/models/actions.py:26 — The remove_only column keeps non-runner credentials in the runners table, which forces remove_only filters across many queries; two are still missing (see above).
  • [rbac-violation] src/app/api/actions_distributed_task.py:546 — Earlier pool-agent authorization finding stays open: this push does not show it fixed, and the pool-agent update and delete routes still authorize on same-scope checks alone.
  • [rbac-violation] src/app/api/actions_distributed_task.py:535 — Earlier pool-agent authorization finding stays open: this push does not show it fixed.

Earlier findings

  • src/app/api/actions_dispatch.py:154, logic-error, resolved — the reuse-by-name query now filters Runner.remove_only.is_not(True).
  • src/app/models/actions.py:26, api-contract, resolved — admin_frontend.py (lines 155 and 333) now excludes remove-only credentials; the single-runner GET gap is raised above as a new finding.
  • src/app/models/actions.py:26, scope-creep, reclassified to info — the remove-token changes follow from keeping tokens until expiry and ending shared unnamed-runner reuse; the bug-ledger entry documents both.
  • src/app/api/actions_dispatch.py:137, src/app/api/actions_dispatch.py:101 and src/app/api/actions_runners.py:130, backward-incompatible, reclassified to info — intended, documented behaviour matching GitHub.

Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR

4 finding(s) below the low severity threshold were not posted.

Previous run (2)

<!-- fullsend:review-findings-v2:eyJ2ZXJzaW9uIjoyLCJhY3Rpb24iOiJyZXF1ZXN0LWNoYW5nZXMiLCJmaW5kaW5ncyI6W3sic2V2ZXJpdHkiOiJtZWRpdW0iLCJjYXRlZ29yeSI6ImxvZ2ljLWVycm9yIiwiZmlsZSI6InNyYy9hcHAvYXBpL2FjdGlvbnNfZGlzcGF0Y2gucHkiLCJpZCI6ImZfYzc1Y2I1MTA2Njc0MjNmYiIsImxpbmUiOjE1NCwiYWN0aW9uYWJsZSI6dHJ1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doIiwiY2F0ZWdvcnkiOiJhcGktY29udHJhY3QiLCJmaWxlIjoic3JjL2FwcC9hcGkvYWN0aW9uc19kaXN0cmlidXRlZF90YXNrLnB5IiwiaWQiOiJmXzA3YmQ0N2EzNGEyNjljZGEiLCJsaW5lIjozMjMsImFjdGlvbmFibGUiOnRydWUsImRpbWVuc2lvbiI6ImNvcnJlY3RuZXNzIn0seyJzZXZlcml0eSI6Im1lZGl1bSIsImNhdGVnb3J5IjoibG9naWMtZXJyb3IiLCJmaWxlIjoic3JjL2FwcC9hcGkvYWN0aW9uc19kaXNwYXRjaC5weSIsImlkIjoiZl83NjZmZjc0NDUyNWI0NmMwIiwibGluZSI6MTE5LCJhY3Rpb25hYmxlIjp0cnVlLCJkaW1lbnNpb24iOiJjb3JyZWN0bmVzcyJ9XSwiZGlzcG9zaXRpb25zIjpbeyJpZCI6ImZfMDdiZDQ3YTM0YTI2OWNkYSIsInN0YXR1cyI6InJlc29sdmVkX2J5X2NoYW5nZSJ9LHsiaWQiOiJmXzc2NmZmNzQ0NTI1YjQ2YzAiLCJzdGF0dXMiOiJyZXNvbHZlZF9ieV9jaGFuZ2UifSx7ImlkIjoiZl9mMTk5NDZiYWY3ZDg4MGJjIiwic3RhdHVzIjoib3BlbiJ9XX0= -->

Review

Findings

Medium

  • [logic-error] src/app/api/actions_dispatch.py:154 — Named registration can reuse a remove-only credential row. After an abandoned remove exchange in a scope, registering an explicitly named unnamed-runner matches that broker row (the reuse-by-name query has no remove_only filter). The reuse branch re-keys it but leaves remove_only=True, so registration succeeds while the returned credential receives 401 from runner endpoints.
    Remediation: Exclude rows with remove_only=True from the reuse-by-name query. Add a regression test that abandons a remove exchange, registers an explicitly named unnamed-runner, and authenticates with its returned credential.
  • [api-contract] src/app/models/actions.py:26 — The new remove-only row type is not handled by the admin runner-list consumer. src/app/api/admin_frontend.py:299 selects every Runner without filtering remove_only (and the runner count at line 146 also includes them), so an abandoned remove exchange appears in the admin API/UI as an offline unnamed-runner. The new "listed nowhere" test covers only the pool, pipelines and Actions REST listings.
    Remediation: Filter remove-only rows from the admin runner listing and count, and include the admin endpoint in the abandoned-exchange regression test.

Low

  • [rbac-violation] src/app/api/actions_distributed_task.py:546 — Still present: agent deletion authenticates the credential but selects the target solely by agent_id. The remove-only credential carries repo_id or enterprise_slug, and agent listing enforces that scope, but deletion checks neither, so a credential issued for one repository or enterprise can delete an agent in another scope by supplying its numeric ID. Impact is limited by the integration-testing emulator context.
    Remediation: Constrain deletion to the credential's repository or enterprise scope, rejecting out-of-scope targets before deleting either row. Add cross-repository and repository-to-enterprise deletion tests for remove-only credentials.
  • [incorrect-doc] specs/github-actions.md:1564 — Section 26.3 says Registration token: 1 hour, single-use. After this PR the emulator keeps registration tokens until they expire, so one token registers several runners; the spec line now conflicts with that behaviour.
    Remediation: Change the line to - Registration token: 1 hour (reusable until expiry).
  • [scope-creep] src/app/models/actions.py:26 — The diff adds a remove-only credential subsystem (Runner.remove_only, broker rows on runner_event == "remove", allow_remove_only in distributed-task auth, broker-row deletion on agent removal) that the PR body does not describe in full. Most of it follows from the core fix, but it may overlap with follow-up issue Check the runner's credential on the token exchange and deregister routes #43.
    Remediation: Confirm with maintainers whether it belongs here or in Check the runner's credential on the token exchange and deregister routes #43, and mention it in the PR description if kept.
  • [misplaced-abstraction] src/app/models/actions.py:26 — Removal credentials are stored as Runner rows with remove_only=True, which forces Runner.remove_only.is_not(True) filters at every runner query site and leaks wherever one is missed (see the admin listing finding).
    Remediation: Optionally model removal credentials separately so runner queries need no defensive filters.
  • [backward-incompatible] src/app/api/actions_dispatch.py:137 — Registration tokens are now reusable until expiry (previously single-use), and a registration without a name always creates a new row. Clients that register without a name and never add an agent will accumulate unnamed-runner rows.
  • [backward-incompatible] src/app/api/actions_dispatch.py:101 — A runner_event=remove call now returns a remove-only credential that can list agents in its scope and delete an agent, and is consumed on the first delete; other runner API calls with it return 401 (the intended config.sh remove flow).
  • [backward-incompatible] src/app/api/actions_runners.py:130 — Enterprise remove tokens are now rejected for registration on every route and work only for runner_event=remove; existing rows keep working as registration tokens.

Earlier findings

  • src/app/api/actions_distributed_task.py:323, api-contract, resolved — _get_runner_from_token takes allow_remove_only, and dt_list_pool_agents and dt_delete_pool_agent accept remove-only credentials (listing scoped to the credential's repo/enterprise).
  • src/app/api/actions_dispatch.py:119, logic-error, resolved — a runner_event == "remove" exchange now takes an early branch that inserts a separate remove-only row and no longer renames or re-keys an existing runner.

Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR
Previous run (3)

<!-- fullsend:review-findings-v2:eyJ2ZXJzaW9uIjoyLCJhY3Rpb24iOiJyZXF1ZXN0LWNoYW5nZXMiLCJmaW5kaW5ncyI6W3sic2V2ZXJpdHkiOiJoaWdoIiwiY2F0ZWdvcnkiOiJhcGktY29udHJhY3QiLCJmaWxlIjoic3JjL2FwcC9hcGkvYWN0aW9uc19kaXN0cmlidXRlZF90YXNrLnB5IiwiaWQiOiJmXzA3YmQ0N2EzNGEyNjljZGEiLCJsaW5lIjozMjMsImFjdGlvbmFibGUiOnRydWUsImRpbWVuc2lvbiI6ImNvcnJlY3RuZXNzIn0seyJzZXZlcml0eSI6Im1lZGl1bSIsImNhdGVnb3J5IjoibG9naWMtZXJyb3IiLCJmaWxlIjoic3JjL2FwcC9hcGkvYWN0aW9uc19kaXNwYXRjaC5weSIsImlkIjoiZl83NjZmZjc0NDUyNWI0NmMwIiwibGluZSI6MTE5LCJhY3Rpb25hYmxlIjp0cnVlLCJkaW1lbnNpb24iOiJjb3JyZWN0bmVzcyJ9LHsic2V2ZXJpdHkiOiJsb3ciLCJjYXRlZ29yeSI6InJiYWMtdmlvbGF0aW9uIiwiZmlsZSI6InNyYy9hcHAvYXBpL2FjdGlvbnNfZGlzdHJpYnV0ZWRfdGFzay5weSIsImlkIjoiZl9mMTk5NDZiYWY3ZDg4MGJjIiwibGluZSI6NTM1LCJhY3Rpb25hYmxlIjp0cnVlLCJkaW1lbnNpb24iOiJzZWN1cml0eSJ9XX0= -->

Review

Findings

High

  • [api-contract] src/app/api/actions_distributed_task.py:323 — The new guard rejects the credential that config.sh remove needs to look up its agent. The runner calls GET /_apis/distributedtask/pools/{pool_id}/agents (agent lookup) before DELETE, but dt_list_pool_agents (~line 460) calls _get_runner_from_token without allow_remove_only=True, so the remove-only credential gets 401 before reaching the delete route. On base the remove exchange returned an ordinary runner credential, so this PR introduces the regression. test_config_sh_remove_leaves_no_runner_behind skips the lookup and misses it.
    Remediation: Pass allow_remove_only=True in dt_list_pool_agents (ideally scoped to the credential's repo/enterprise) while still rejecting remove-only credentials for registration, update, sessions and job polling. Add a regression test: remove exchange, then GET pools/1/agents?agentName=..., then DELETE, all with the exchanged credential.

Medium

  • [logic-error] src/app/api/actions_dispatch.py:119 — Remove exchanges now store broker identities in the runners table (remove_only=True), but only the repo/enterprise GET .../actions/runners routes filter them out. dt_list_pool_agents (actions_distributed_task.py:461) and the pipelines list endpoints (actions_pipelines.py:106 and :202) still list every runner, so a remove exchange shows up as an extra offline unnamed-runner, indefinitely if the removal is abandoned. This contradicts the bug note's claim that the credential is 'not listed as a runner'.
    Remediation: Add Runner.remove_only.is_not(True) to those three queries and test the endpoints after an uncompleted remove exchange.

Low

  • [rbac-violation] src/app/api/actions_distributed_task.py:535 — dt_delete_pool_agent looks up the target by agent_id only, without comparing the remove credential's repo_id/enterprise_slug, so a remove credential from one scope can delete another scope's agent. This pre-dates the PR (base allowed any runner token to do so, and dt_update_pool_agent has the same unscoped lookup) and the remove-only credential is narrower than before.
    Remediation: Require the target runner's repo_id/enterprise_slug to match the credential's scope and reject cross-scope targets; add tests for cross-repo and enterprise targets.

Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR
Previous run (4)

Review

Reason: tool-failure

This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kiLCJpZCI6ImZfZmUwYWRjMGE4NDJkY2NmNSIsImxpbmUiOjEwMSwiYWN0aW9uYWJsZSI6dHJ1ZSwiZGltZW5zaW9uIjoic2VjdXJpdHkifSx7InNldmVyaXR5IjoibWVkaXVtIiwiY2F0ZWdvcnkiOiJsb2dpYy1lcnJvciIsImZpbGUiOiJzcmMvYXBwL2FwaS9hY3Rpb25zX2Rpc3BhdGNoLnB5IiwiaWQiOiJmXzIyNjRkZTJkOTllZmQ4MDYiLCJsaW5lIjoxMzAsImFjdGlvbmFibGUiOnRydWUsImRpbWVuc2lvbiI6ImNvcnJlY3RuZXNzIn1dLCJkaXNwb3NpdGlvbnMiOlt7ImlkIjoiZl82Y2I5OTY4ZWE0NTlkMmQyIiwic3RhdHVzIjoicmVzb2x2ZWRfYnlfY2hhbmdlIn0seyJpZCI6ImZfZmUwYWRjMGE4NDJkY2NmNSIsInN0YXR1cyI6InJlc29sdmVkX2J5X2NoYW5nZSJ9LHsiaWQiOiJmXzNlNDVmMWRiYzQ5MzQxM2UiLCJzdGF0dXMiOiJvcGVuIn0seyJpZCI6ImZfOTUxYTA3ZmFiOTgxMmM4MiIsInN0YXR1cyI6Im9wZW4ifSx7ImlkIjoiZl83Mjk3YjY0ODczZTA5YjkwIiwic3RhdHVzIjoib3BlbiJ9LHsiaWQiOiJmX2I1MjI4NWZhZmE5ZWRjODkiLCJzdGF0dXMiOiJvcGVuIn0seyJpZCI6ImZfMjI2NGRlMmQ5OWVmZDgwNiIsInN0YXR1cyI6InJlc29sdmVkX2J5X2NoYW5nZSJ9LHsiaWQiOiJmXzVmYzI5MzA4NmI0ZTMyY2EiLCJzdGF0dXMiOiJvcGVuIn1dfQ== -->

Review

Findings

High

  • [api-contract] src/app/api/actions_distributed_task.py:460 — The remove-only credential is refused on every route except DELETE, but dt_list_pool_agents (GET pools/{id}/agents, agentName lookup) calls _get_runner_from_token without allow_remove_only=True. actions/runner's unconfigure path looks the agent up by name before deleting it, so config.sh remove would get 401 there. Before this PR the remove exchange returned an ordinary runner row that passed this check. test_config_sh_remove_leaves_no_runner_behind keeps agent_id from registration and skips the lookup.
    Remediation: Allow remove-only credentials on the read-only agent discovery route while still rejecting registration, updates, sessions and job polling. Add a test that finds the agent by name with the exchanged credential before deleting it.

Medium

  • [api-contract] src/app/api/actions_distributed_task.py:461 — Remove-only brokers are hidden from the REST runner lists but not from the distributed-task agent list (select(Runner).order_by(Runner.id)) or the pipelines list endpoints in actions_pipelines.py. While a removal broker exists, they show a fake offline unnamed-runner.
    Remediation: Apply Runner.remove_only.is_not(True) to those listings and test them after a remove exchange.

Low

  • [logic-error] src/app/api/actions_dispatch.py:153 — The reuse-by-name query does not exclude remove-only rows. A registration that explicitly names the runner unnamed-runner while a removal broker exists re-keys that broker without clearing remove_only. The returned credential then gets 401, and the outstanding removal credential stops working. Rare, because removal brokers are short-lived.
    Remediation: Add Runner.remove_only.is_not(True) to the reuse query and test that case.
  • [rbac-violation] src/app/api/actions_distributed_task.py:536 — DELETE pools/{pool_id}/agents/{agent_id} picks its target only by agent_id; the credential's repo or enterprise scope is not compared with the target's. This gap was already in the base code, and the PR narrows the remove credential to DELETE only.
    Remediation: Check the target against the credential's repository or enterprise scope and reject cross-scope targets.
  • [backward-incompatible] src/app/api/actions_distributed_task.py:415 — The pool-agent registration route now rejects an enterprise remove token with 401, and registration tokens are no longer consumed on use. Deliberate and matches GitHub; a minor emulator contract change.
    Remediation: Note the behaviour change in the release notes.
  • [backward-incompatible] src/app/api/actions_distributed_task.py:438 — Registration tokens now persist after use on the pool-agent registration route, which changes behaviour for clients that expected them to be consumed.
    Remediation: Note the behaviour change in the release notes.
  • [stale-doc] specs/github-actions.md:1564 — Section 26.3 still says Registration token: 1 hour, single-use; this PR makes tokens reusable until they expire.
    Remediation: Drop single-use and state that a registration token can register several runners within its 1-hour validity.

Earlier findings

  • src/app/api/actions_dispatch.py:101, logic-error — resolved: the remove exchange now returns a separate remove-only credential before the reuse-by-name lookup.
  • src/app/api/actions_dispatch.py:130, logic-error — resolved: a remove exchange carrying an existing runner's name no longer modifies that runner; covered by test_a_remove_exchange_gives_a_credential_that_only_removes.
  • src/app/api/actions_dispatch.py:101, privilege-escalation — resolved: the exchange issues a remove_only credential that both auth helpers refuse for ordinary runner operations. The remaining deletion-scope gap is the low rbac-violation finding above.

Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR
Previous run (6)

<!-- fullsend:review-findings-v2:eyJ2ZXJzaW9uIjoyLCJhY3Rpb24iOiJyZXF1ZXN0LWNoYW5nZXMiLCJmaW5kaW5ncyI6W3sic2V2ZXJpdHkiOiJtZWRpdW0iLCJjYXRlZ29yeSI6ImxvZ2ljLWVycm9yIiwiZmlsZSI6InNyYy9hcHAvYXBpL2FjdGlvbnNfZGlzcGF0Y2gucHkiLCJpZCI6ImZfNmNiOTk2OGVhNDU5ZDJkMiIsImxpbmUiOjEwMSwiYWN0aW9uYWJsZSI6dHJ1ZSwiZGltZW5zaW9uIjoiY29ycmVjdG5lc3MifSx7InNldmVyaXR5IjoibWVkaXVtIiwiY2F0ZWdvcnkiOiJwcml2aWxlZ2UtZXNjYWxhdGlvbiIsImZpbGUiOiJzcmMvYXBwL2FwaS9hY3Rpb25zX2Rpc3BhdGNoLnB5IiwiaWQiOiJmX2ZlMGFkYzBhODQyZGNjZjUiLCJsaW5lIjoxMDEsImFjdGlvbmFibGUiOnRydWUsImRpbWVuc2lvbiI6InNlY3VyaXR5In0seyJzZXZlcml0eSI6ImxvdyIsImNhdGVnb3J5IjoiYmFja3dhcmQtaW5jb21wYXRpYmxlIiwiZmlsZSI6InNyYy9hcHAvYXBpL2FjdGlvbnNfZGlzdHJpYnV0ZWRfdGFzay5weSIsImlkIjoiZl8zZTQ1ZjFkYmM0OTM0MTNlIiwibGluZSI6NDM4LCJhY3Rpb25hYmxlIjpmYWxzZSwiZGltZW5zaW9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bXBhdGlibGUiLCJmaWxlIjoic3JjL2FwcC9hcGkvYWN0aW9uc19kaXN0cmlidXRlZF90YXNrLnB5IiwiaWQiOiJmXzVmYzI5MzA4NmI0ZTMyY2EiLCJsaW5lIjo0MzgsImFjdGlvbmFibGUiOmZhbHNlLCJkaW1lbnNpb24iOiJjcm9zcy1yZXBvLWNvbnRyYWN0cyJ9XSwiZGlzcG9zaXRpb25zIjpbeyJpZCI6ImZfMjI2NGRlMmQ5OWVmZDgwNiIsInN0YXR1cyI6Im9wZW4ifSx7ImlkIjoiZl81ZmMyOTMwODZiNGUzMmNhIiwic3RhdHVzIjoib3BlbiJ9XX0= -->

Review

Findings

Medium

  • [logic-error] src/app/api/actions_dispatch.py:101 — The remove-only restriction does not survive the credential exchange. runner-registration with an enterprise remove token and runner_event="remove" still creates an ordinary Runner and returns an unrestricted runner credential. That credential can then call POST /_apis/distributedtask/pools/1/agents with no token in the body. dt_register_pool_agent's bearer branch authenticates it and registers or renames the runner without checking where the credential came from. A remove token can therefore still register a runner through the normal two-step flow. The new test only covers direct use of the remove token.
    Remediation: Keep the remove-only purpose on the identity issued by the remove exchange, and enforce it in agent registration and other registration-capable consumers. Add a regression test that exchanges a remove token with runner_event="remove", tries an agent add with the returned credential, and expects it to be rejected.
  • [privilege-escalation] src/app/api/actions_dispatch.py:101 — Same root cause as above, seen from the security side. runner_event is set by the caller, and the issued credential is not limited to removal. When name or agentName is supplied in the exchange, the by-name reuse path can also overwrite the token of an existing enterprise runner in that scope.
    Remediation: Issue a purpose-scoped removal credential and enforce it on every endpoint that consumes it. Do not let a removal exchange reuse or re-key named runners. See also the logic-error finding at this location.

Low

  • [backward-incompatible] src/app/api/actions_distributed_task.py:438 — Registration tokens are no longer consumed on first use. A client that relied on single use now has the token accepted until it expires. This matches GitHub and the PR documents it as intentional. Remediation: note the changed token lifetime in the docs or release notes.
  • [backward-incompatible] src/app/api/actions_distributed_task.py:415 — Enterprise remove tokens are now refused on the pool agent add and the enterprise pipelines register route, where they returned 200 before. On /actions/runner-registration they are accepted only with runner_event="remove". Existing rows have for_remove NULL and keep working as registration tokens.
  • [backward-incompatible] src/app/api/actions_distributed_task.py:538 — DELETE pools/{pool_id}/agents/{agent_id} now also deletes the calling runner when it is named unnamed-runner and is not the target. The match is on the placeholder name, so a real runner given that name would be treated as a broker identity. Remediation: optionally mark placeholder broker rows explicitly instead of matching the name.
  • [stale-doc] specs/github-actions.md:1564 — Section 26.3 still says "Registration token: 1 hour, single-use", but registration tokens are now reusable until they expire. Remediation: update that bullet.

Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR
Previous run (7)

<!-- fullsend:review-findings-v2:eyJ2ZXJzaW9uIjoyLCJhY3Rpb24iOiJyZXF1ZXN0LWNoYW5nZXMiLCJmaW5kaW5ncyI6W3sic2V2ZXJpdHkiOiJtZWRpdW0iLCJjYXRlZ29yeSI6ImxvZ2ljLWVycm9yIiwiZmlsZSI6InNyYy9hcHAvYXBpL2FjdGlvbnNfZGlzcGF0Y2gucHkiLCJpZCI6ImZfMjI2NGRlMmQ5OWVmZDgwNiIsImxpbmUiOjEzMCwiYWN0aW9uYWJsZSI6dHJ1ZSwiZGltZW5zaW9uIjoiY29ycmVjdG5lc3MifSx7InNldmVyaXR5IjoibG93IiwiY2F0ZWdvcnkiOiJiYWNrd2FyZC1pbmNvbXBhdGlibGUiLCJmaWxlIjoic3JjL2FwcC9hcGkvYWN0aW9uc19kaXN0cmlidXRlZF90YXNrLnB5IiwiaWQiOiJmXzVmYzI5MzA4NmI0ZTMyY2EiLCJsaW5lIjo0MzgsImFjdGlvbmFibGUiOmZhbHNlLCJkaW1lbnNpb24iOiJjcm9zcy1yZXBvLWNvbnRyYWN0cyJ9XX0= -->

Review

Findings

Medium

  • [logic-error] src/app/api/actions_dispatch.py:130 — An unnamed registration now always creates a new runner row, and config.sh remove goes through this path. It posts to /actions/runner-registration with runner_event: "remove". The route never reads runner_event and calls _create_runner_from_registration. dt_delete_pool_agent (actions_distributed_task.py:525-536) then deletes only the target agent. Unlike dt_update_pool_agent (lines 487-491), it does not delete the broker runner it authenticated as. Every removal therefore leaves one more unnamed-runner row. Before this PR, unnamed requests reused one placeholder row, so at most one orphan existed. Now orphans pile up with each register/remove cycle, and runner lists and counts grow. --replace does not leak, because dt_update_pool_agent deletes the broker identity. The normal register flow does not leak either. Empty-string name/agentName is also now treated as unnamed. The PR body acknowledges the orphan rows.
    Remediation: Handle runner_event == "remove" separately, for example by issuing a credential without keeping a Runner row. Or make dt_delete_pool_agent also delete the authenticated runner when it is a different row from the agent being removed, as dt_update_pool_agent does. Add a regression test for the remove flow.

Low

  • [backward-incompatible] src/app/api/actions_distributed_task.py:438 — Registration tokens are no longer deleted on use. This covers /actions/runner-registration, the pool agent add with a token, and both pipelines register routes. A second use used to return 401; now the token works until it expires, which matches GitHub. Downstream tests that expect a second use to be rejected will now get 200. Expired tokens are never deleted from the database.
    Remediation: Mention the change in release notes. Consider deleting expired tokens opportunistically.

Labels: PR fixes a runner registration bug


Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR

fullsend-ai-review[bot]

This comment was marked as outdated.

@fullsend-ai-review fullsend-ai-review Bot added the bug Something isn't working label Nov 18, 2026
@fullsend-ai-review

fullsend-ai-review Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 10:27 PM UTC · Completed 10:36 PM UTC

Commit: 5779a50 · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $2.56

fullsend-ai-review[bot]

This comment was marked as outdated.

@fullsend-ai-review

fullsend-ai-review Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 10:44 PM UTC · Completed 10:55 PM UTC

Commit: 6ad804b · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $2.26

fullsend-ai-review[bot]

This comment was marked as outdated.

fullsend-ai-review[bot]

This comment was marked as outdated.

@fullsend-ai-review

fullsend-ai-review Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ❌ Failure (post-script /home/runner/work/github-emulator/github-emulator/.fullsend/.fullsend-cache/resources/sha256/e7a9998a1b648e11a40a2f74e5b270e63707430a0953227f2f651b4c86d70654/scripts/post-review.sh failed:…) · Started 11:41 PM UTC · Completed 12:02 AM UTC

Commit: d958487 · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $0.47

@fullsend-ai-review

fullsend-ai-review Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 3:09 AM UTC · Completed 3:17 AM UTC

Commit: d958487 · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $2.51

@fullsend-ai-review fullsend-ai-review Bot added the risk/moderate PR risk: moderate label Nov 19, 2026
fullsend-ai-review[bot]

This comment was marked as outdated.

@jctanner jctanner left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Requesting changes — one regression and one inconsistency, both small:

  1. The remove credential can't do its job. config.sh remove looks up its agent (GET /_apis/distributedtask/pools/{pool}/agents?agentName=...) before the DELETE, but dt_list_pool_agents still calls _get_runner_from_token without allow_remove_only=True, so the exchanged credential gets 401 before reaching your delete route. The new test skips the lookup, which is why it passes. Fix: allow the remove-only credential on the list route (scoped to its repo/enterprise), keep refusing it on register/update/sessions/poll, and add a regression test that does the full exchange → lookup → delete with the exchanged credential.
  2. Broker rows leak into the runner lists. Only the repo/enterprise actions/runners routes filter remove_only; dt_list_pool_agents and the pipelines list endpoints still show every remove exchange as an offline unnamed-runner, indefinitely if the removal is abandoned — the bug note says it "is not listed as a runner". Add Runner.remove_only.is_not(True) to those three queries and test after an uncompleted remove exchange.
    The cross-scope delete the bot noted is pre-existing and is fixed by #31's _same_scope_as — merge this after #31 and renumber the 0018 migration (0018 is now taken by the merged #41).

@waynesun09
waynesun09 force-pushed the emu-05-runner-registration branch from d958487 to b4dc304 Compare November 19, 2026 17:27
@waynesun09

Copy link
Copy Markdown
Member Author

Thanks @jctanner. Both fixed in b4dc304, rebased on main 1ed1121:

  1. Remove lookup: the remove-only credential can now call GET pools/{pool}/agents. It only sees runners in the repository or enterprise it was issued for. Register, update, sessions and poll still refuse it. test_config_sh_remove_full_flow_with_the_exchanged_credential runs the whole exchange → lookup by agentName → delete with the exchanged credential. A repository runner with the same name stays out of the enterprise credential's lookup.
  2. Broker rows: dt_list_pool_agents and both pipelines lists now filter Runner.remove_only.is_not(True). test_an_abandoned_remove_exchange_is_listed_nowhere does a remove exchange with no delete, then checks the pool list, the pipelines list and the REST list.

The migration is now 0019_enterprise_remove_tokens, on top of #41's 0018_shared_account_ids. Agreed on merging after #31.

@fullsend-ai-review

fullsend-ai-review Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 5:29 PM UTC · Completed 5:42 PM UTC

Commit: b4dc304 · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $3.09

fullsend-ai-review[bot]

This comment was marked as outdated.

@waynesun09
waynesun09 force-pushed the emu-05-runner-registration branch from b4dc304 to 0d9beec Compare November 19, 2026 19:14
@fullsend-ai-review

fullsend-ai-review Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ⚠️ Cancelled · Started 7:16 PM UTC · Completed 7:22 PM UTC

Commit: 0d9beec · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $0.86

This review was superseded by a newer commit. Check the current pull request HEAD's review status before merging.

@fullsend-ai-review

fullsend-ai-review Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 7:24 PM UTC · Completed 7:35 PM UTC

Commit: 638956e · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $2.22

fullsend-ai-review[bot]

This comment was marked as outdated.

fullsend-ai-review[bot]

This comment was marked as outdated.

@jctanner jctanner left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Re-verified at 638956e — all findings fixed: the remove credential is accepted on the scoped agent list (allow_remove_only=True), broker rows are filtered from the pool and both pipelines lists (remove_only.is_not(True)), and the new full-flow test does the exchange → agentName lookup → delete with the exchanged credential. Approving. The bot's remaining low findings (stale spec line in specs/github-actions.md, the site-wide unnamed-runner admin edge) are fine as follow-ups; the carried pool-agent rbac notes are addressed by merged #31's scope checks.

@jctanner jctanner left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Re-verified at 638956e — all findings fixed: the remove credential is accepted on the scoped agent list (allow_remove_only=True), broker rows are filtered from the pool and both pipelines lists (remove_only.is_not(True)), and the new full-flow test does the exchange → agentName lookup → delete with the exchanged credential. Approving. The bot's remaining low findings (stale spec line, the site-wide unnamed-runner admin edge) are fine as follow-ups; the carried pool-agent rbac notes are addressed by merged #31's scope checks.

actions/runner's config.sh posts only url and runner_event to
/actions/runner-registration; the name comes with the agent add that
follows. Every such registration got the placeholder name, and the
reuse-by-name meant for restarting pods re-keyed that one row. Runners
registering at the same time then lost their tokens and got 401 on
their next call. Reuse a row by name only when the request names the
runner.

Assisted-by: Claude
Signed-off-by: Wayne Sun <gsun@redhat.com>
Every registration route deleted the registration token after one use,
so a second runner using the same token got 401: runner-registration
(what config.sh calls), the pool agent add with a token in the body, and
the repository and enterprise pipelines register. On GitHub one
registration token registers any number of runners until it expires.

Assisted-by: Claude
Signed-off-by: Wayne Sun <gsun@redhat.com>
A fixed-bug entry for runners that register together, and its PLAN.md
line.

Assisted-by: Claude
Signed-off-by: Wayne Sun <gsun@redhat.com>
Follow-ups to keeping registration tokens until they expire:
- An enterprise remove token shares the registration-token table. It now
  carries for_remove (migration 0018) and serves only a runner-registration
  call with runner_event "remove"; every route that registers a runner
  refuses it.
- Issuing a registration or remove token drops the tokens past their
  expiry, so kept tokens do not pile up.
- config.sh remove authenticates with the credential from its own unnamed
  runner-registration call. Deleting the agent now deletes that broker
  row too, as the --replace path already does, so each removal no longer
  leaves an unnamed-runner row behind.

Assisted-by: Claude
Signed-off-by: Wayne Sun <gsun@redhat.com>
A runner-registration call with runner_event "remove" returned an
ordinary runner credential: it could add or rename an agent, and with a
name it re-keyed an existing runner. It now returns a remove-only
credential (runners.remove_only, added to migration 0018). It deletes an
agent and nothing else, is never reused or re-keyed by name, is not
listed as a runner, and is deleted with the agent it removes. That flag,
not the placeholder name, now marks the broker row.

Assisted-by: Claude
Signed-off-by: Wayne Sun <gsun@redhat.com>
- config.sh remove looks its agent up by name before deleting it. The
  remove-only credential may now list pool agents, limited to the
  repository or enterprise it was issued for; it is still refused
  everywhere else.
- Remove-only credentials are not runners, so the pool agent list and the
  repository and enterprise pipelines lists leave them out, including
  after a remove exchange that never deleted anything.
- The migration is now 0019_enterprise_remove_tokens, on top of
  0018_shared_account_ids.

Assisted-by: Claude
Signed-off-by: Wayne Sun <gsun@redhat.com>
- The reuse-by-name query skips remove-only rows, so a registration that
  names its runner "unnamed-runner" after an abandoned remove exchange
  gets an ordinary runner, not the broker row with remove_only still set.
- The admin runner list and the admin summary's runner count leave out
  remove-only credentials, like every other runner list.

Assisted-by: Claude
Signed-off-by: Wayne Sun <gsun@redhat.com>
Hygiene's pre-commit runs ruff over every whole file a change touches.
This fixes what main's config reports in them: import order and unused
imports (ruff --fix), the late imports in actions_distributed_task.py
moved to the top, unused locals, and admin_frontend.py's one-line
if/semicolon statements split. No behaviour change.

Assisted-by: Claude
Signed-off-by: Wayne Sun <gsun@redhat.com>
@waynesun09
waynesun09 force-pushed the emu-05-runner-registration branch from 638956e to e9b1e17 Compare November 19, 2026 23:22
@fullsend-ai-review

fullsend-ai-review Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 11:24 PM UTC · Completed 11:36 PM UTC

Commit: e9b1e17 · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $2.59

@fullsend-ai-review fullsend-ai-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Note: The following review comments could not be posted on the diff (GitHub returned 422) and are included here instead:

  • src/app/api/actions_dispatch.py (file-level): Line 402 ·
    [low] logic-error

register_site_wide_runner still includes enterprise remove-only credentials in its reuse-by-name lookup: those rows have null repo_id and org_id. After an abandoned enterprise remove exchange, registering a site-wide runner named 'unnamed-runner' re-keys that credential without clearing remove_only, so the registration succeeds but its token is rejected by runner endpoints. Several abandoned exchanges make scalar_one_or_none() raise and return 500.

Suggested fix: Restrict site-wide reuse to enterprise_slug IS NULL and remove_only IS NOT TRUE, and test registration after abandoned remove exchanges.

  • src/app/api/actions_runners.py (file-level): Line 166 ·
    [low] api-contract

The individual enterprise runner GET (and the repository individual-runner GET) still returns remove-only credential rows as ordinary runners, although the list endpoints exclude them. The remove exchange returns the credential row's ID, so fetching that ID yields a phantom 'unnamed-runner'.

Suggested fix: Apply Runner.remove_only.is_not(True) to both individual-runner GET queries and test that remove-only IDs return 404.

@fullsend-ai-review fullsend-ai-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

See the review comment for full details.

Comment thread src/app/api/actions_dispatch.py Resolved
Comment thread src/app/models/actions.py Resolved
@waynesun09
waynesun09 merged commit f627d6d into main Nov 19, 2026
49 checks passed
@waynesun09
waynesun09 deleted the emu-05-runner-registration branch November 19, 2026 23:39
jctanner added a commit that referenced this pull request Nov 20, 2026
…scope with runner scoping

- migrations 0018_runner_public_key/0019_runner_registration_broker renumbered
  to 0020/0021 (0018 and 0019 are taken by merged #41 and #24)
- dt_update_pool_agent: ordinary runners keep #31's scope-filtered lookup
  (out-of-scope is 404); registration brokers look up unscoped and get #44's
  403 broker-scope refusal, as both PRs' tests pin
- full suite: 1494 passed, 1 known sandbox failure (test_security_headers
  needs a built frontend/dist)
jctanner added a commit that referenced this pull request Nov 20, 2026
…egister

Merges current main into the branch, renumbers the migrations to
0020_runner_public_key and 0021_runner_registration_broker (0018 and 0019
are taken by merged #41 and #24), and reconciles the pool-agent update
authorization: ordinary runners keep #31's scope-filtered lookup
(out-of-scope is 404) while registration brokers look up unscoped and get
the 403 broker-scope refusal, as both PRs' tests pin.

Full suite: 1494 passed, 1 known sandbox failure (test_security_headers
needs a built frontend/dist).

Signed-off-by: James Tanner <jtanner+github@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working risk/moderate PR risk: moderate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants