Skip to content

Cut Agent API, subagents, and compression roles over to per-agent profile runtimes #2637

Description

@acoliver

Parent: #2635

Objective

Cut the Agent API, subagents, compression, and reusable role runtimes over to the transactional profile architecture. Remove their independent profile stores/populators/activation paths and prove multiple concurrent execution owners are isolated without ambient runtime identity.

This task does not implement interactive OAuth coordination (#2562) or utility-model generation (#2629).

Scope

Agent API

Expose narrow public capabilities:

  • dispatch one typed ProfileCommand protocol;
  • immutable redacted profile state/document views, summaries, requested/effective diffs and typed health;
  • factual agent+command+revision subscriptions;
  • saved/v2-document/unconfigured initial state for createAgent/fromConfig/preflight;
  • no runtime/provider/settings/credential/store escape hatches.

ProfilesControl, legacy activation APIs, and providerActivationExecutor are removed in a versioned change or retained only as thin adapters with no directory scan, alternate schema, private store, direct mutation, profile-as-CLI-overrides, or ambient access. Failed initial profile construction publishes no partial agent.

Subagents

  • Every launch creates an independent controller/runtime/session; definitions are templates, not live shared active state.
  • Pass qualified profile ID or explicit captured v2 document across launch boundaries, never foreground current state or runtime ID.
  • Replace subagentSettingsPopulation, buildActivationCliOverrides, LB runWithRuntimeScope profile pinning, and parallel auth/keyfile population.
  • Derive immutable runtime/tool/context snapshots from the shared resolver/factory.
  • Foreground transitions never mutate running subagents.
  • Parent delegation/definition/environment/profile policy intersections cannot expand authority.
  • Parent turn awaiting subagent remains transition-blocked; independent subagents may continue.
  • Missing auth escalates structured challenge to the host per Make lazy authentication cancellable and route subagent auth challenges through the interactive host #2562; subagent never starts hidden UI.

Compression and reusable roles

  • Replace CompressionProfileResolver, CompressionLoadBalancingProvider population/auth/LB duplication, ProfileManager.applyLoadedProfile, and SettingsService.importFromProfile with shared graph resolution/runtime construction.
  • Parent transition captures qualified role document + etag; no late repository lookup.
  • Lazy role runtime is child of parent revision, cached/disposed with that revision, and owns its own provider/model/auth/LB operational state.
  • Preserve characterized parent-overlay, nested-LB rejection, context-window, auth warning/failover, fallback/error, and disposal semantics.
  • Apply role capability ceilings: compression can deny tools/shell even if referenced profile requests them.
  • Establish narrow construction/runtime capability for future search/summarization roles without exposing interactive profile CRUD or adding role-specific fields to base profile schema.

Concurrency and routing

  • Explicit Agent/Turn/ProviderCall/ToolInvocation contexts route all calls/events/messages.
  • AsyncLocalStorage may carry tracing/request metadata only, never active execution identity.
  • Multiple simultaneous subagents/roles/foreground agents may use the same named definition without sharing mutable state.
  • Shared repositories/credential stores/catalogs/transports are borrowed through keyed ports; runtime disposal never closes shared infrastructure.

Coordination / non-overlap

Acceptance criteria

  • Agent API exposes only typed commands/redacted immutable queries/factual subscriptions and explicit initial profile state.
  • No Agent API/ProfilesControl/activation adapter owns a second store/schema/mutation path.
  • Concurrent subagents have independent profile/provider/model/auth/policy/LB/session state and pass the Subagents fail intermittently: z.ai 400 error 1213 on context accumulation and Codex GPT-5.5 Null final message #2410 parallel isolation invariant without profile identity ALS.
  • Subagent auth challenges route to the supervising host or fail fast noninteractively; no hidden prompt/instructions occur.
  • Compression standard/LB/parent-overlay/reference capture/role-ceiling behavior runs through the shared resolver/factory with no late repository mutation.
  • Role runtimes are parent-revision children with deterministic cleanup and no shared-infrastructure disposal.
  • subagentSettingsPopulation, profile-derived CLI overrides, compression population/auth lists, applyLoadedProfile, importFromProfile, and independent ProfilesControl mutation have no production consumers.
  • Agent API, createAgent, subagent concurrency, compression standard/LB, role lifecycle, auth escalation boundaries, and noninteractive behavioral tests pass with full test/lint/typecheck/format/build verification.

Metadata

Metadata

Assignees

No one assigned

    Labels

    APIAPIs and things to plugin and extend LLxprt CodearchitectureArchitectural refactor / clean designsubagentsasync / synch / other types of subagents.type: task

    Type

    Projects

    Status
    Todo

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions