Skip to content

A failed background job can be reported as exited with code 0 #15080

Open

Description

@mardausdennis

Component

CLI / TUI

Description

A persistent background job whose command fails can be stored as exited with code 0. The background_process tool then shows status: exited instead of failed for that job

When the liveness watch of a persistent job no longer finds the process, it finalizes the job with exited(active, 0, null) (packages/opencode/src/kilocode/background-process/index.ts:897 on main). The ChildProcess exit handler first awaits output and ownership checks and only then passes the real code or signal to the same finalizer. The first terminal write wins, so when the watch is first the real outcome is lost

Plugins

None

Kilo version

7.8.8, and the same code is on current main

Steps to reproduce

  1. Start a persistent background job whose command exits with code 1
  2. Let the liveness watch notice the exit before the exit handler finishes its output and ownership checks
  3. Read the job. It reports status exited and exit code 0

A local probe on main 6c1596e4f8 held only the persistent exit finalizer and left the watch unchanged. The child exited with code 1, and the stored exit code was 0 before and after the finalizer completed

It also happened without any hold. In a local test run on 2026-10-12 at 19:10 UTC a job whose own outcome file recorded code 1 was stored with exit code 0. That run used an earlier version of an unconfirmed stop is reported before its guarded runner ends, which still asserted the stored code; the test on main reads the outcome file instead

Expected behavior is that a job owned by the manager's ChildProcess keeps that process's real exit code or signal, whichever observer finishes first

Screenshot and/or share link

Not applicable, there is no UI. The probe and the test run used synthetic jobs and no user data

Operating System

Windows 11

Terminal

PowerShell

Activity

  1. added
    area:cliCLI, TUI and core engine
    communityOpened by someone outside the Kilo team
    needs-triageCommunity PR no maintainer has looked at yet
    on Oct 14, 2026
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:cliCLI, TUI and core enginecommunityOpened by someone outside the Kilo teamneeds-triageCommunity PR no maintainer has looked at yet

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions