Skip to content

feat(delegations): wire RFC #2829 sweeper + admin routes into platform server - #2845

Merged
HongmingWang-Rabbit merged 1 commit into
stagingfrom
feat/rfc2829-enable-server-side
May 5, 2026
Merged

feat(delegations): wire RFC #2829 sweeper + admin routes into platform server#2845
HongmingWang-Rabbit merged 1 commit into
stagingfrom
feat/rfc2829-enable-server-side

Conversation

@HongmingWang-Rabbit

Copy link
Copy Markdown
Contributor

Activates the server-side foundation that PRs #2832, #2836, #2837 shipped without wiring (each PR landed dead code on purpose so the review surface stayed tight).

What this PR wires up

  1. router.go — registers the RFC RFC: Async-first A2A delegation with durable task ledger #2829 PR-4 admin endpoints behind `AdminAuth`:

    • `GET /admin/delegations[?status=in_flight|stuck|failed|completed&limit=N]`
    • `GET /admin/delegations/stats`
  2. cmd/server/main.go — starts the RFC RFC: Async-first A2A delegation with durable task ledger #2829 PR-3 stuck-task sweeper as a supervised goroutine alongside the existing scheduler + hibernation-monitor + image-auto-refresh.

What this PR does NOT do

  • PR-2's `DELEGATION_RESULT_INBOX_PUSH` flag stays default off — flip happens via env config in a follow-up after staging burn-in.
  • PR-5's `DELEGATION_SYNC_VIA_INBOX` flag stays default off — same reason. The two flags are independent.
  • Canvas operator panel UI: this PR exposes the JSON contract; the canvas panel consumes it in a separate canvas PR.

Coverage

2 new router gate tests in `admin_delegations_route_test.go`:

  • List endpoint requires AdminAuth (unauthenticated → 401)
  • Stats endpoint requires AdminAuth (unauthenticated → 401)

Pattern mirrors `admin_test_token_route_test.go` (the IDOR-fix gate for PR #112). Catches a future router refactor that silently drops AdminAuth — operator dashboard data exposes caller_id, callee_id, and task_preview, none of which should reach unauthenticated callers.

Sweeper boots as a no-op until at least one delegation row exists, so this PR is safe to land before PR-5's agent-side cutover sees production traffic.

Test plan

  • 2 router gate tests pass
  • Existing tests untouched
  • Build clean
  • CI green
  • Staging: confirm sweeper boots in logs (`DelegationSweeper: started ...`)
  • Staging: `curl /admin/delegations` with admin token returns JSON shape

Refs RFC #2829.

…m server

Activates the server-side foundation that PRs #2832, #2836, #2837
shipped without wiring (each PR landed dead code on purpose so the
review surface stayed tight).

## What this PR wires up

  1. router.go — registers the RFC #2829 PR-4 admin endpoints behind
     AdminAuth:
       GET /admin/delegations[?status=...&limit=N]
       GET /admin/delegations/stats

  2. cmd/server/main.go — starts the RFC #2829 PR-3 stuck-task
     sweeper as a supervised goroutine alongside the existing
     scheduler + hibernation-monitor + image-auto-refresh:
       go supervised.RunWithRecover(ctx, "delegation-sweeper",
                                    delegSweeper.Start)

## What this PR does NOT do

  - PR-2's DELEGATION_RESULT_INBOX_PUSH flag stays default off — flip
    happens via env config in a follow-up after staging burn-in.
  - PR-5's DELEGATION_SYNC_VIA_INBOX flag stays default off — same
    reason. The two flags are independent; either can be flipped in
    isolation.
  - Canvas operator panel UI: this PR exposes the JSON contract; the
    canvas panel consumes it in a separate canvas PR.

## Coverage

2 new router gate tests in admin_delegations_route_test.go:

  - List endpoint requires AdminAuth (unauthenticated → 401)
  - Stats endpoint requires AdminAuth (unauthenticated → 401)

Pattern mirrors admin_test_token_route_test.go (the IDOR-fix gate
for PR #112). Catches a future router refactor that silently drops
AdminAuth — operator dashboard data exposes caller_id, callee_id, and
task_preview, none of which should reach unauthenticated callers.

Sweeper boots as a no-op until at least one delegation row exists,
so this PR is safe to land before PR-5's agent-side cutover sees
production traffic.

Refs RFC #2829.
@HongmingWang-Rabbit
HongmingWang-Rabbit added this pull request to the merge queue May 5, 2026
Merged via the queue into staging with commit f0fd7b4 May 5, 2026
22 checks passed
@HongmingWang-Rabbit
HongmingWang-Rabbit deleted the feat/rfc2829-enable-server-side branch May 5, 2026 05:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant