Skip to content

TUI power inhibitor ignores prevent_sleep_while_streaming=false #452

Closed

Description

@pigmej

Summary

[power].prevent_sleep_while_streaming = false disables the shared daemon power inhibitor, but the TUI client can still acquire a power inhibitor while a turn is processing.

On Linux this can still hit the systemd-inhibit / polkit / pkttyagent path even though the config says sleep prevention is disabled.

Repro

  1. Set:

    [power]
    prevent_sleep_while_streaming = false
  2. Start a Linux TUI/remote-client session.

  3. Run an agent turn.

  4. Observe the power-inhibit path can still be used from the TUI sleep guard.

Expected

When prevent_sleep_while_streaming = false, neither the daemon nor the TUI should acquire a power inhibitor.

Reference fix

I could not create a PR from this account, but pushed a minimal reference fix here:

The main change gates sync_sleep_guard() on config().power.prevent_sleep_while_streaming, matching the existing daemon-side config gate.

Activity

  1. 1jehuang commented on Jul 7, 2026

    @1jehuang
    Owner

    Fixed in 6b94b54. The TUI sleep guard (sync_sleep_guard()) now re-checks [power].prevent_sleep_while_streaming on every call, matching the daemon-side gate, so neither the daemon nor the TUI acquires a power inhibitor when the config disables it. Thanks @pigmej for the reference fix, which this follows (the dev_cargo.sh linker hunk in the reference branch was unrelated and not taken).

    Will be included in the next release.

  2. added
    bug
    triage: fixed-pending-release
    autonomous: clear
    priority: medium
    on Jul 7, 2026
  3. added a commit that references this issue on Jul 7, 2026
    6b94b54
  4. 0p9b commented on Jul 23, 2026

    @0p9b

    Confirmed the user-visible Linux failure mode on jcode v0.55.0 over an SSH/TTY session: when streaming begins with sleep prevention enabled, the terminal polkit path writes text such as org.freedesktop.login1.inhibit-block-sleep, polkit-agent-helper-1, and Password: directly over the Ratatui screen.

    The post-fix configuration works as expected in v0.55.0:

    [power]
    prevent_sleep_while_streaming = false

    After changing it, fully exit the affected TUI, run reset, and restart jcode to clear the already-contaminated frame. No polkit rule, password, or elevated permission is needed.

    Trade-off: jcode no longer prevents the machine from sleeping during model streaming; normal OS power policy and other inhibitors remain unchanged.

  5. added 2 commits that reference this issue on Aug 30, 2026
    2201e49
    ca5e391
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

    autonomous: clearbugpriority: mediumtriage: fixed-pending-release

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions