Skip to content

bug: orphan sweeper kills ~/.trinity/setup.sh after 90 s, and TMPDIR on the workspace volume is never cleaned #4002

Closed

Description

@obasilakis

Problem

startup.sh starts the agent server in the background (docker/base-image/startup.sh:671) before it runs the agent's persistent setup hook ~/.trinity/setup.sh (startup.sh:677-680). The agent server starts the orphan sweeper, which waits 90 s (_DEFAULT_STARTUP_DELAY_SECONDS) and then SIGKILLs every 30 s any process that is not allowlisted.

setup.sh and its children are not on the allowlist: they are not an execution, not a docker exec session and not a platform essential. So any setup.sh step still running about 90 s after boot is killed mid-flight. A cold pip install of a large wheel set (torch + CUDA, ~2 GB) routinely runs longer than that. startup.sh only prints Warning: setup.sh had errors (continuing startup), so the agent comes up with a half-installed environment.

Second half: TMPDIR is placed on the workspace volume (startup.sh:65-73, default /home/developer/.tmp, #1098). Nothing ever empties it. Every killed install leaves its pip-unpack-* / build dirs behind, and they survive restarts and recreates because they sit on the persistent volume.

Evidence (eu2)

  • Oracle agents' setup.sh installs sentence-transformers + faiss-cpu (pulls CUDA torch) on venv rebuild.
  • Abandoned pip temp dirs were estimated at about 35–40 GB across the oracle workspaces, plus ~9.7 GB of .tmp/pip-unpack-* on one agent alone.
  • A truncated nvidia-cublas wheel from a killed install caused a SIGBUS in a later run.
  • The host disk is at 94%.
  • Agent-side workaround shipped in the agent's own repo: setup.sh appends itself to ~/.trinity/persistent-processes.allow, which protects its descendant tree. It also empties its own pip temp dir on start and on exit.

Proposed fix

  1. Protect the setup hook in the platform: allowlist the setup.sh process tree for its lifetime. Either register its PID with the sweeper registry, or run it before the agent server starts (it is a boot step, so ordering it first is the simpler option).
  2. Bound TMPDIR on the volume: at boot, before anything else uses it, remove entries older than N days, or clear it entirely, since nothing should rely on scratch surviving a restart.
  3. Make a setup.sh failure visible: record it in the agent's health or compatibility report, not only as a log line.

Activity

  1. added
    priority-p2
    type-bug
    theme-reliability
    on Oct 27, 2026
  2. obasilakis commented on Oct 27, 2026

    @obasilakis
    ContributorAuthor

    /claim

  3. added
    status-in-progress
    on Oct 27, 2026
  4. github-actions commented on Oct 27, 2026

    @github-actions

    Claimed by @obasilakis. Label status-in-progress added.

    Next steps:

    1. Create branch: feature/4002-<short-slug>
    2. Implement the feature
    3. Open a PR with Fixes #4002
  5. added
    complexity-medium
    on Oct 30, 2026
  6. added
    status-in-dev
    and removed
    status-in-progress
    on Oct 30, 2026
  7. removed
    status-in-dev
    on Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

complexity-mediumpriority-p2theme-reliabilitytype-bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions