Skip to content

Task deletion can leave ActorTemplates from later list pages #360

Open

Description

@ryo-whaletech

What happened?

Task deletion lists ActorTemplates through Client.ListActorTemplates, but the client currently returns only the first response page. Agent Substrate may return a bounded page with a non-empty next_page_token, so a Task-owned template on a later page is not discovered or deleted.

Deletion reconciliation still succeeds in this case, allowing the Task record to be removed while the later-page template remains.

With the current Substrate implementation, this can occur when a Task-owned template sorts after the first 1000 ActorTemplates in the atespace.

What did you expect to happen?

Task deletion should examine all ActorTemplate pages and remove every template belonging to the deleted Task, including templates from earlier Task spec revisions.

How can it be reproduced?

Using the existing in-process mock Substrate server:

  1. Return an unrelated template and/or a Task-owned template on the first ListActorTemplates page, together with a non-empty continuation token.
  2. Return another template belonging to the Task on the second page.
  3. Run ReconcileDelete for that Task.

Before the fix, AX requests only the first page, reconciliation returns successfully, and the later-page Task template remains undeleted.

Additional context

Agent Substrate explicitly supports page_token and next_page_token. I reproduced this deterministically through AX's existing reconciliation and gRPC client path.

I also have a tested fix and regression test ready in my fork:

ryo-whaletech@facea9a

The fix makes Client.ListActorTemplates follow continuation tokens, matching its existing "all ActorTemplates" abstraction. Errors from later pages are returned rather than treating a partial listing as complete.

Pull request creation is currently restricted for this repository. I'm happy to submit the patch if maintainers would like me to proceed.

Activity

  1. arbazkhan971 commented on Sep 22, 2026

    @arbazkhan971

    Fix ready: implemented on my fork (branch fix/360-actortemplate-pagination, regression test included, make test green) and ready to PR — but this repo's collaborators_only PR creation policy rejects PRs from non-collaborators (see #358), so I cannot open it. If PR creation opens for external contributors, I will open the PR immediately. Happy to adjust scope per maintainer feedback.

  2. self-assigned this
    on Sep 25, 2026
  3. added a commit that references this issue on Sep 27, 2026
  4. ericcurtin commented on Sep 27, 2026

    @ericcurtin

    I ran into this same PR creation restriction. Fix and regression test here: ericcurtin#2

    Happy to open against google/ax directly if a maintainer enables it, or if someone wants to cherry-pick the commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions