Skip to content

Next rebuild: upstream #21299 adds a scope unit to AgentScope, and the overlay's decorator would drop it #86

Open

Description

@immakermatty

What changes upstream

pingdotgg#21299, "fix(server): agent-browser and Chrome no longer outlive the agent that started them", is open and mergeable. It was rebuilt by a maintainer from a contributor's work, and it is marked as needing human approval before merge.

The PR changes the AgentScope contract in packages/shared/src/AgentScope.ts:

  • wrap returns { command, args, unit }. unit is the systemd scope the agent runs in.
  • A new stop(unit) stops that scope after Claude, ACP, Pi or Muse releases its agent: on Stop, on a CLI restart, and on the 30-minute idle release. Detached children that called setsid, such as tool daemons and Chrome, are reaped with it.
  • Codex, OpenCode, Cursor, Grok's own cgroup and persistent terminals keep their current ownership.

Why it matters for the overlay

  1. Row 8 would silently disable the new cleanup. apps/server/src/lazurio/agentBrowserSession.ts decorates AgentScope. For a thread-bound agent it returns a new object, { command: "/usr/bin/env", args: [...] }, instead of spreading the inner launch. With fix(server): agent-browser and Chrome no longer outlive the agent that started them pingdotgg/t3code#21299 that drops unit. The adapter then has no scope to stop, so on Linux the agent's detached children outlive it again, and nothing fails loudly.
    • Fix when rebuilding: return { ...launch, command: "/usr/bin/env", args: [...] }.
    • Add a test that a unit from the inner scope survives the decorator. The existing recordingAgentScope in agentBrowserSession.test.ts can return one.
    • If the per-thread variable moves into the adapters' environment builders, as the upstream offer for [Feature]: Expose current thread info via environment variables pingdotgg/t3code#6781 proposes, the decorator goes away together with the risk.
  2. Row 12 overlaps. apps/server/src/lazurio/threadLifecycle.ts stops a thread's agent-browser daemon when the thread is archived or deleted. With fix(server): agent-browser and Chrome no longer outlive the agent that started them pingdotgg/t3code#21299, upstream already reaps the daemon when the agent is released, and earlier: on Stop and on idle release. Check whether row 12 still needs its own daemon stop. Its other half, letting go of the thread's Environment browser tabs, stays.
  3. Behaviour change for agents on an Environment. After fix(server): agent-browser and Chrome no longer outlive the agent that started them pingdotgg/t3code#21299, anything an agent starts in the background ends with its agent: dev servers, agent-browser sessions, watchers. Agents on a Lazurio Environment keep working through the shared Environment browser, which runs outside the agent's scope and is not affected. But a dev server an agent left running for a person would stop when the agent goes idle. Note this in the runbook and in the people's announcement when the rebuild takes in fix(server): agent-browser and Chrome no longer outlive the agent that started them pingdotgg/t3code#21299.

When

Found while preparing the upstream offers of the v0.1.0 rebuild (#70, stage 9).

Activity

  1. immakermatty commented on Oct 21, 2026

    @immakermatty
    Author

    The v0.1.1 candidate (#103, row 8 commit db957e5712) now carries the fix this issue asks for at the next rebuild:

    pingdotgg#21299 is still not in upstream v0.1.1, so this issue stays open. When it lands, re-check that stop(unit) still works through /usr/bin/env (env execs, so the PID and the scope stay the agent's), and re-evaluate row 12's daemon stop.

  2. immakermatty commented on Oct 29, 2026

    @immakermatty
    Author

    Checked again in the v0.1.4 rebuild (#143, PR #144, head 246a4e0bdd):

    • Row 8's decorator returns { ...launch, command: "/usr/bin/env", args: [...] } and passes ...inner, so upstream's unit and stop survive (apps/server/src/lazurio/agentBrowserSession.ts). agentBrowserSession.test.ts asserts that a unit from the inner scope survives and that stop(unit) reaches the inner scope.
    • Row 12 still stops the thread's agent-browser daemon: upstream's stop ends the agent when it is released, not when its thread is archived or deleted, and the row also lets go of the thread's Environment browser tabs.

    Both points of this issue are covered on v0.1.4. What remains is the canary check that the Environment browser's window and tabs outlive an agent's scope (stage 7 of the next real rebuild).

    — T3 Release (bot)

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

Metadata

Metadata

Assignees

No one assigned

    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