Skip to content

Background task indicator stuck (background_outstanding never decrements) after cancelling a delegated async agent task #440

Description

@Charlie-1909

Environment: Codeg v0.24.0 (latest at time of report), Windows 11

Diagnosed by: this report was investigated and written by Claude Code, running as the active agent inside a Codeg session, at the request of the human user. Claude Code inspected the app's own logs and running processes to trace the root cause below (not a guess from the UI alone).

Steps to reproduce:

  1. In a Claude Code session running inside Codeg, delegate work to a sub-agent via the Task/Agent tool (this gets registered by Codeg as an "async agent task" under bg-watch).
  2. Cancel/stop that sub-agent before it finishes on its own (e.g. by sending it a message telling it to stop).
  3. The session's UI keeps showing "1 task running in background" indefinitely, even long after the sub-agent's connection has gone Connected -> Disconnected.

Evidence from ~/.codeg/logs/codeg.<date>.log:

  • [bg-watch] registered async agent task=<task_id> is logged once when the agent is launched, incrementing the parent session's outstanding count to 1.
  • No corresponding deregistration log line ever appears afterward, even after the task is cancelled and its own connection later logs Connected -> Disconnected.
  • Every subsequent turn_complete event for the parent session logs background_outstanding=1, indefinitely (checked over many turns spanning ~50 minutes).
  • Closing the window and reopening the app does not fix it — the underlying codeg.exe process never actually exits (same PID and StartTime before/after "restart"), so the in-memory counter survives. Only fully killing the process and relaunching resets the indicator.

Relation to other issues: This looks related to but distinct from #200 (closed by the maintainer as fixed in a newer version). That issue was about a normally-completed task not ending the session. This one is specifically triggered by cancelling an in-flight background agent task — the registration/deregistration pair for that specific code path appears to still be unbalanced.

Workaround: Fully kill the codeg.exe process (not just close the window) and relaunch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions