Skip to content

bug(company-os): a system pause overwrites an operator pause — pause_agent has no already-paused guard (quota and auth paths) #21056

Closed

Description

@mrveiss

ControlsService.pause_agent (autobot-backend/llc/services/controls_service.py:87) has no guard for an agent that is already paused. Each call overwrites pause_reason, paused_at and pre_pause_status (it stores the current status, which is already paused), and logs a new CONTROL_AGENT_PAUSED event.

Scenario:

  1. An operator pauses an agent while it has a run in flight.
  2. That run then ends in a quota exhaustion (heartbeat_scheduler._handle_quota_exhausted, about :739) or, after PR fix(llc): keep a claude_code auth failure's reason on the run and pause the agent (#20202) #21055, an auth failure. The scheduler then calls pause_agent(actor_type="system") again.
  3. The system pause overwrites the operator's reason and the pre-pause status.
  4. A later resume_agent restores from the overwritten state. The operator's pause, and the status it recorded, are lost.

Found in review of PR #21055 (#20202). Both system-pause paths share the defect, so one fix covers both.

Acceptance criteria

  • pause_agent on an already-paused agent keeps the first pre_pause_status and the operator's pause_reason. Either it is a no-op that returns the existing pause, or it records the extra reason without overwriting.
  • A system pause never overrides an operator pause. Resuming an agent the operator paused restores the status from before the operator's pause.
  • Covered for both the quota-exhausted path and the auth-failure path (bug(company-os): claude_code heartbeats fail silently when the agent's OAuth session has expired, and keep firing every 15 minutes #20202). Each has a test: operator pause, then a system pause during the run, then resume, which restores the original status.
  • The activity log shows whether a repeated pause was a no-op or an added reason, with no duplicate "paused" transition.

Activity

  1. added
    bugSomething isn't working
    area: company-osWave 4 · cluster A — Company OS & LLC canvas
    phase:M2.5Heartbeats fire reliably
    on Nov 7, 2026
  2. github-actions commented on Nov 7, 2026

    @github-actions
    Contributor

    needs-structure cleared: goal milestone, matching phase label and native parent (or sub-issues) are all present (#19522).

  3. added
    needs-structureMissing goal milestone, matching phase label or native parent (#19522)
    on Nov 7, 2026
  4. mrveiss commented on Nov 7, 2026

    @mrveiss
    OwnerAuthor

    Maintainer decision: when an agent is already paused, a further pause request is a no-op. The first pause's reason and pre-pause status are kept, so a resume restores the status from before the first pause. The repeat is recorded in the activity log as a no-op, with the requested reason and actor in its metadata. This is fixed once in pause_agent, and covers the quota and auth paths. Sequenced after #21055.

  5. removed
    needs-structureMissing goal milestone, matching phase label or native parent (#19522)
    on Nov 8, 2026
  6. mrveiss commented on Nov 20, 2026

    @mrveiss
    OwnerAuthor

    AC audit against main 13685f3 (2026-11-20). A branch deleted as ZERO means its content is on main; it does not by itself meet the ACs.

    PR #21213 closed, branch deleted as ZERO.

    • AC1: autobot-backend/llc/services/controls_service.py:109-113,152-162 keeps the first pause; llc/tests/test_pause_already_paused_21056.py:86.
    • AC2/AC3: same file :124 (quota path) and :140 (auth-failure path): operator pause, system pause, resume restores the original status.
    • AC4: repeat recorded as no-op under CONTROL_AGENT_PAUSE_REPEATED (test :100-115), no second "paused" event.
      All ACs met; closing.
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

    area: company-osWave 4 · cluster A — Company OS & LLC canvasbackendbugSomething isn't workingphase:M2.5Heartbeats fire reliably

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions