Skip to content

feat(tui): kill watched harnesses with confirmation - #141

Merged
senamakel merged 38 commits into
mainfrom
kill-hung-harness
Aug 2, 2026
Merged

feat(tui): kill watched harnesses with confirmation#141
senamakel merged 38 commits into
mainfrom
kill-hung-harness

Conversation

@senamakel

@senamakel senamakel commented Aug 2, 2026

Copy link
Copy Markdown
Member

Summary

  • add a capital K action for the selected watched harness in the Agents rail
  • require an explicit y confirmation before sending the destructive request
  • carry task-scoped kill requests over the authenticated screen-control channel
  • resolve ownership on the worker before terminating the real PTY and screen stream

User impact

Operators can recover from a hung harness without leaving the TUI. Press Esc to focus the Agents rail, select the task, press K, then press y; any other key cancels.

Validation

  • cargo test
  • cargo clippy --all-targets -- -D warnings
  • cargo fmt --check
  • focused real-PTY kill integration test
  • detached tmux TUI smoke test

Summary by CodeRabbit

  • New Features

    • Added the ability to terminate a running harness from the Agents view using K, with explicit confirmation.
    • Added task-scoped termination support through the runtime and screen stream.
    • Added status feedback for successful, cancelled, or failed termination requests.
  • Bug Fixes

    • Prevented unauthorized or stale termination requests from stopping the wrong harness.
    • Preserved operator-controlled sessions when termination is requested.
  • Compatibility

    • Older capability responses continue to work when termination support is unavailable.

Co-authored-by: Medulla <medulla@tinyhumans.ai>

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

senamakel has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 19 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a7d77be6-0bc6-42e1-b4c2-f4267c3501de

📥 Commits

Reviewing files that changed from the base of the PR and between 701c292 and b55896b.

📒 Files selected for processing (11)
  • src/sdk/src/control_socket/server/hub_ops.rs
  • src/sdk/src/daemon/task_loop/probe.rs
  • src/sdk/src/hub/handle/mod.rs
  • src/sdk/src/hub/runner/mod.rs
  • src/sdk/src/hub/runner/types.rs
  • src/sdk/src/hub/socket/task_run.rs
  • src/tui/src/ui/app/input.rs
  • src/tui/src/ui/app/keys/agents.rs
  • src/tui/src/ui/app/keys/mod.rs
  • src/tui/src/ui/app/state.rs
  • src/tui/src/ui/app/tests.rs
📝 Walkthrough

Walkthrough

The change adds negotiated screen-kill capabilities, task-scoped kill messages, authenticated termination routing, TUI confirmation, and orchestrator-aware worker session shutdown. Tests cover protocol compatibility, UI behavior, authorization, and end-to-end termination.

Changes

Screen-kill capability and termination primitives

Layer / File(s) Summary
Capability and termination primitives
src/sdk/src/daemon/..., src/sdk/src/tinyplace/frames/..., src/sdk/src/tinyplace/screen/..., src/tui/src/worker_loop/commands.rs
Capability payloads include optional screenKill support. Daemon aborts distinguish cancellation from termination. Capability probes expose runtime state without using the general task slot. The screen protocol adds task and correlation identifiers for Kill.

Hub negotiation and routing

Layer / File(s) Summary
Capability negotiation and dispatch
src/sdk/src/hub/runner/..., src/sdk/src/hub/socket/task_run.rs
The runner caches negotiated capabilities, shares abort notifiers, records killable waiters, and dispatches tasks with negotiated screen-kill state.
Runtime and screen kill routing
src/sdk/src/runtime/..., src/sdk/src/hub/handle/mod.rs, src/tui/src/worker/stream/...
The runtime exposes kill_task. The hub sends correlation-checked kill messages. The worker router authorizes termination by sender, task, and correlation ID.

TUI and worker behavior

Layer / File(s) Summary
TUI confirmation and command dispatch
src/tui/src/ui/app/..., src/tui/src/event_loop/cmd_dispatch/mod.rs
The Agents rail uses K to arm confirmation. Lowercase y emits Cmd::KillTask; other keys cancel it. Results update the application status.
Orchestrator-owned session termination
src/tui/src/worker/..., src/tui/tests/e2e_screen_stream.rs
Termination stops sessions only when orchestration owns them. Ordinary aborts preserve reusable sessions. End-to-end tests verify stale correlations are rejected and matching correlations close the harness and stream.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant TUI
  participant Runtime
  participant HubHandle
  participant ScreenRouter
  participant DaemonRuntime
  participant PtyManager
  TUI->>Runtime: kill_task(worker, task_id)
  Runtime->>HubHandle: kill(worker, task_id)
  HubHandle->>ScreenRouter: send Kill(task_id, correlation_id)
  ScreenRouter->>DaemonRuntime: terminate_task(sender, task_id, correlation_id)
  DaemonRuntime->>PtyManager: signal termination
  PtyManager-->>ScreenRouter: close owned session
Loading

Possibly related PRs

Suggested reviewers: sanil-23

Poem

A rabbit taps K by the screen,
Then waits for a “y” to be seen.
The task sends its sign,
The stream shuts in time,
And old stale receipts stay clean.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the primary change: adding a confirmed kill action for watched harnesses in the TUI.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e2d04d0a92

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/tui/src/ui/app/keys/agents.rs Outdated
Comment thread src/tui/src/worker/stream/router.rs Outdated
@senamakel senamakel self-assigned this Aug 2, 2026
# Conflicts:
#	src/sdk/src/runtime/backend/runtime.rs
#	src/sdk/src/runtime/mod.rs
#	src/tui/src/event_loop/cmd_dispatch/mod.rs
#	src/tui/src/ui/app/keys/mod.rs
#	src/tui/src/ui/app/types.rs
#	src/tui/src/worker/stream/tests.rs
The kill command now resolves the target from the current rail selection instead of relying on a cached watch target, preventing stale or mismatched kills. The daemon runtime gains a dedicated abort method that safely cancels a task while holding the lock, and the router uses it directly rather than closing sessions indirectly.
The abort signal now carries a termination flag that, when set, stops the serving harness and closes its session instead of merely sending an interrupt. This lets a kill request fully tear down a task while preserving the existing interrupt behaviour for ordinary aborts.
The test for task-scoped kill now polls the session state until the harness process actually stops, instead of asserting immediately after the kill. This makes the test robust against timing differences in process termination.
The session id was moved into the report callback, preventing its use later in the task. Cloning it first ensures the id remains available for the rest of the test flow.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

senamakel has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d242b6fae9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/sdk/src/tinyplace/screen/types.rs
Comment thread src/sdk/src/tinyplace/screen/types.rs
The runner now records the task id on each dispatch waiter, and the screen kill message carries a correlation id so a delayed kill cannot match a later dispatch that reused the same task id. The daemon probe advertises the new screen_kill capability, which older workers omit and therefore deserialize as false, preventing an upgraded controller from sending them an unknown screen control message.
The kill path now checks that the worker advertises harness termination support and resolves the active dispatch correlation id before sending the kill message. The daemon verifies this correlation id when terminating, preventing stale or mismatched kill requests from aborting a task that has since been reused by a different dispatch.
The test fixtures for ScreenMessage::Kill were missing the correlation_id field, which is now required by the message structure. Added the field to all three test locations to keep the test data consistent with the updated message definition.
Add tests for the new screenKill agent capability, asserting it is omitted for older workers and defaults to false when absent. Also extend the TUI end-to-end screen stream test to verify that a stale kill dispatch with a reused task id does not stop the live session.
Reformat the serde attribute on `screen_kill` and the `terminate_task` guard condition to fit on single lines, improving code readability without changing behavior.
The terminate_task documentation now reflects that the operation is a termination signal rather than an abort, and explicitly describes how the correlation check prevents a delayed request from terminating a later dispatch that reused the same task id.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

senamakel has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e4ae395c62

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/sdk/src/hub/handle/mod.rs Outdated
Comment thread src/tui/src/worker/stream/router.rs Outdated
The capability probe no longer acquires a concurrency slot before running, since control-plane negotiation must not block behind harness-task slots it may need to terminate. The probe remains serialized by the capability cache lock and bounded by its own timeout, and the TUI router now unsubscribes using the correct source channel when killing a task.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

senamakel has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 026dd2192f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/sdk/src/hub/handle/mod.rs Outdated
Cache the last successfully negotiated capabilities per worker address during task dispatch, and use this cached data in the kill path instead of issuing a fresh capability probe. This ensures an emergency kill can proceed even when a worker is wedged and unable to respond to a new negotiation request.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

senamakel has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 697445cab6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/sdk/src/daemon/capabilities/mod.rs Outdated
Comment thread src/sdk/src/hub/socket/task_run.rs Outdated
Comment thread src/sdk/src/hub/runner/capabilities.rs
Screen termination support is now advertised only when the embedding worker installs an authenticated screen-message router, preventing false capability claims in headless or unauthenticated contexts. The daemon runtime exposes an explicit enablement method, and the hub runner now negotiates capabilities with abort awareness so a backend cancellation during negotiation is honored before task dispatch, with stale capability entries cleared on refresh failure.
The daemon runtime now imports AtomicBool alongside the existing atomic types, preparing for upcoming state tracking that requires a boolean atomic flag.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

senamakel has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

The `run` method now calls `run_inner` directly instead of `run_with_screen_kill`, passing `None` for the screen-control parameter. This aligns the public API with the internal execution path and removes the now-redundant wrapper.
The stop_turn path now checks whether the operator has taken over the session before interrupting and closing it. This prevents the orchestrator from terminating a session that has been handed to the user, avoiding a race between control handoff and termination.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

senamakel has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 218c4ede65

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/sdk/src/hub/socket/task_run.rs Outdated
The capabilities negotiation now always returns the abort notification handle alongside the result, so callers can still use it to cancel a task even when capability discovery fails. This simplifies the dispatch flow by removing the need to reconstruct the abort handle from an optional tuple.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

senamakel has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 701c292ad5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/sdk/src/hub/runner/mod.rs Outdated
The task runner now checks worker capabilities and abort state before dispatching a task, allowing the control socket to return early with an aborted outcome when the task has already been cancelled. This prevents unnecessary work and ensures the screen kill capability is properly negotiated with the worker before execution begins.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

senamakel has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c62e32a1ab

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/sdk/src/control_socket/server/hub_ops.rs Outdated
Comment thread src/tui/src/ui/app/keys/mod.rs
The hub now forwards the externally visible task id when running negotiated tasks, so abort signals and waiter registrations reference the id callers expect rather than the internal request id. This also clears the armed kill state on any mouse activity in the TUI, cancelling a pending harness kill and showing a status message when the user interacts.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
src/sdk/src/hub/socket/task_run.rs (1)

165-182: 🚀 Performance & Scalability | 🔵 Trivial

Every task dispatch now pays a full capability round trip.

capabilities_for_dispatch runs before every dispatch, and TaskRunner::capabilities clears its cache and performs a fresh network round trip (bounded by self.ack_window) each time — there is no short-lived reuse across back-to-back dispatches to the same worker. This adds per-task latency to every dispatch, including ones with an explicit provider that do not need capability data for routing.

This trade-off looks intentional: reusing a cached result would reintroduce the exact staleness problem this negotiation exists to avoid (an emergency kill needing up-to-date screen_kill support). Monitor per-dispatch latency after this change, particularly for workflows that delegate many small tasks in quick succession to the same worker.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/sdk/src/hub/socket/task_run.rs` around lines 165 - 182, Review the
pre-dispatch negotiation around TaskRunner::capabilities_for_dispatch and the
TaskRunner::capabilities cache behavior; avoid introducing cached capability
reuse that could make emergency kill support stale. Preserve the fresh,
ack_window-bounded negotiation for dispatches requiring capability data, while
considering whether explicit-provider dispatches can bypass capability
negotiation without affecting abort handling or task result emission.
src/sdk/src/hub/runner/mod.rs (1)

225-236: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider moving the new kill/dispatch logic out of mod.rs.

kill_correlation_for, run_negotiated, and run_inner add new behavior-heavy code directly to runner/mod.rs. This crate already extracts comparable logic — capability negotiation — into its own file, runner/capabilities.rs. Move the new kill and dispatch logic to a dedicated submodule, for example runner/dispatch.rs, and re-export it from mod.rs.

As per coding guidelines, "Keep mod.rs focused on module documentation, mod/pub use wiring, and glue that fits no more specific submodule."

Also applies to: 282-307

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/sdk/src/hub/runner/mod.rs` around lines 225 - 236, Move the
behavior-heavy kill and dispatch implementations, including
kill_correlation_for, run_negotiated, and run_inner, from runner/mod.rs into a
dedicated runner/dispatch.rs submodule. Keep mod.rs limited to module wiring and
glue, declare the new submodule there, and re-export the moved public API so
existing callers retain the same access path.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/tui/src/ui/app/keys/agents.rs`:
- Around line 85-93: Add an App helper near set_status, such as arm_kill, that
sets the kill confirmation status and then assigns kill_armed last; update the
KeyCode::Char('K') handling to call this helper instead of performing the two
operations inline, preserving the existing no-target status path.

In `@src/tui/src/ui/app/keys/mod.rs`:
- Around line 47-56: Update the kill confirmation branch in the key handling
function around self.kill_armed to confirm only an unmodified lowercase y key;
require that Ctrl, Alt, and other modifiers are absent before returning
Cmd::KillTask, while preserving cancellation for all other keypresses.

---

Nitpick comments:
In `@src/sdk/src/hub/runner/mod.rs`:
- Around line 225-236: Move the behavior-heavy kill and dispatch
implementations, including kill_correlation_for, run_negotiated, and run_inner,
from runner/mod.rs into a dedicated runner/dispatch.rs submodule. Keep mod.rs
limited to module wiring and glue, declare the new submodule there, and
re-export the moved public API so existing callers retain the same access path.

In `@src/sdk/src/hub/socket/task_run.rs`:
- Around line 165-182: Review the pre-dispatch negotiation around
TaskRunner::capabilities_for_dispatch and the TaskRunner::capabilities cache
behavior; avoid introducing cached capability reuse that could make emergency
kill support stale. Preserve the fresh, ack_window-bounded negotiation for
dispatches requiring capability data, while considering whether
explicit-provider dispatches can bypass capability negotiation without affecting
abort handling or task result emission.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 18b2d91f-bac2-40b3-b88c-6b463371f9ec

📥 Commits

Reviewing files that changed from the base of the PR and between 7e59d10 and 701c292.

📒 Files selected for processing (33)
  • src/sdk/src/daemon/capabilities/mod.rs
  • src/sdk/src/daemon/providers/types.rs
  • src/sdk/src/daemon/runtime.rs
  • src/sdk/src/daemon/task_loop/probe.rs
  • src/sdk/src/daemon/types.rs
  • src/sdk/src/hub/handle/mod.rs
  • src/sdk/src/hub/runner/capabilities.rs
  • src/sdk/src/hub/runner/mod.rs
  • src/sdk/src/hub/runner/types.rs
  • src/sdk/src/hub/socket/task_run.rs
  • src/sdk/src/runtime/mod.rs
  • src/sdk/src/runtime/openhuman/mod.rs
  • src/sdk/src/tinyplace/frames/tests/capabilities.rs
  • src/sdk/src/tinyplace/frames/tests/codec.rs
  • src/sdk/src/tinyplace/frames/tests/mod.rs
  • src/sdk/src/tinyplace/frames/types.rs
  • src/sdk/src/tinyplace/screen/tests.rs
  • src/sdk/src/tinyplace/screen/types.rs
  • src/tui/src/event_loop/cmd_dispatch/mod.rs
  • src/tui/src/ui/app/input.rs
  • src/tui/src/ui/app/keys/agents.rs
  • src/tui/src/ui/app/keys/mod.rs
  • src/tui/src/ui/app/render/agents/composer.rs
  • src/tui/src/ui/app/state.rs
  • src/tui/src/ui/app/tests.rs
  • src/tui/src/ui/app/types.rs
  • src/tui/src/worker/executor/run.rs
  • src/tui/src/worker/pty/handle/control.rs
  • src/tui/src/worker/pty/manager/session.rs
  • src/tui/src/worker/stream/router.rs
  • src/tui/src/worker/stream/tests.rs
  • src/tui/src/worker_loop/commands.rs
  • src/tui/tests/e2e_screen_stream.rs

Comment thread src/tui/src/ui/app/keys/agents.rs
Comment thread src/tui/src/ui/app/keys/mod.rs
The call to run_negotiated in hub_ops.rs was reformatted to fit on a single line, reducing unnecessary line breaks without changing any behavior.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

senamakel has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

The kill confirmation is now armed through a dedicated method that sets the status and stores the target as one state transition, and the confirming `y` keypress only proceeds when no modifiers are held, preventing accidental kills with modified key combinations.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c2b1cfc308

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/sdk/src/daemon/task_loop/probe.rs
Comment thread src/tui/src/ui/app/keys/agents.rs Outdated

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

senamakel has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 35072e96ea

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/sdk/src/hub/handle/mod.rs
The kill path now sends the original wire task id to the worker instead of the visible task id, ensuring the worker can correctly identify and terminate the intended task. Additionally, the capabilities probe now returns cached values immediately while refreshing them in the background when screen kill is active, avoiding a blocking wait during task termination.
The input handler now checks that a task is still running before routing key events to it, preventing stale or completed tasks from receiving input.
The kill command now uses a dedicated kill_target method that only returns a target when the selected task is running, preventing accidental termination of non-running tasks. The watch_target method no longer filters by task status, allowing it to serve other purposes without the kill-specific constraint.
The kill confirmation tests previously used a bare app fixture without a running task, which did not reflect the real scenario where a task is active. A new helper now seeds a running task before these tests, ensuring the kill flow is exercised against a realistic state.
The test helper `app_with_running_task` referenced `TuiEvent` via the old module path, which has been moved to `crate::ui::events`. The import is updated to reflect the new location, ensuring the test compiles and runs correctly.
The test helper now constructs the app first and then removes any TaskComplete events for the demo task from the snapshot, rather than scripting a TaskStart event before app creation. This aligns the fixture with the current event flow where task completion is the relevant state to filter.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

senamakel has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

# Conflicts:
#	src/tui/src/ui/app/input.rs

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

senamakel has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b55896b2f0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

.inner
.screen_kill
.load(std::sync::atomic::Ordering::Relaxed)
&& self.inner.capabilities.lock().await.is_none()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep static kill support outside the probe mutex

Fresh evidence after the cold-probe fix: when an earlier capability request has spawned the background get_capabilities, that function holds inner.capabilities across the inference, so a later pre-dispatch request blocks on this .lock().await before it can enter the static-response branch. If inference exceeds the runner's three 12-second acknowledgement windows, the task is dispatched with screen_kill: false; thus a backend capability probe immediately followed by a task can still make that task permanently unkillable. Track the in-progress probe separately or otherwise return the static control facts without waiting on this mutex.

Useful? React with 👍 / 👎.

Comment on lines 482 to +484
if abort.is_aborted() {
// A real interrupt, not a kill: Ctrl-C reaches the harness the
// same way the operator's would, and the session survives it.
let _ = self.sessions.write(id, &[0x03]);
if abort.is_terminated() {
self.stop_turn(id);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Observe termination before launching or injecting the task

When a kill arrives before await_turn starts—while the PTY executor is selecting/opening a session or waiting in inject_prompt—the abort is not observed until this loop. The executor can therefore launch a new harness, spend the readiness/dialog/paste budgets waiting, and even submit the task after the operator confirmed the kill, only closing it afterward. Race setup and prompt injection against the abort signal, or check termination throughout those stages, so a confirmed kill cannot start additional work.

Useful? React with 👍 / 👎.

@senamakel
senamakel merged commit 33382c0 into main Aug 2, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant