Skip to content

fix(code): make /offload interruptible - #5590

Merged
Mason Daugherty (mdrxy) merged 6 commits into
mainfrom
aolsenjazz/code/interrupt-offload
Aug 18, 2026
Merged

fix(code): make /offload interruptible#5590
Mason Daugherty (mdrxy) merged 6 commits into
mainfrom
aolsenjazz/code/interrupt-offload

Conversation

@aolsenjazz

@aolsenjazz Alexander Olsen (aolsenjazz) commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

/offload and /compact can now be interrupted with Escape as their progress hint promises.


Previously, the interface showed esc to interrupt while offloading, but pressing Escape did nothing. On a slow or stuck offload, users remained on the Offloading state with no way to regain control without waiting for the request to finish or fail.

Now Escape cancels an in-progress offload and returns the interface to an idle, usable state. If the offload had already completed when cancellation arrived, its result is preserved; otherwise, the pending operation is cleaned up so the conversation can continue normally.

Made by Open SWE

Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
@github-actions github-actions Bot added dcode Related to `deepagents-code` fix A bug fix (PATCH) internal User is a member of the `langchain-ai` GitHub organization size: S 50-199 LOC labels Aug 18, 2026
@open-swe
open-swe Bot marked this pull request as ready for review August 18, 2026 14:20

@open-swe open-swe Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Open SWE Review found 2 potential issues.

Approval score: 0/100 · Decision: commented · Blocked by: team auto approve disabled, repo auto approve disabled, open blocking findings, score below threshold

Open in WebView Open SWE trace

Comment thread libs/code/deepagents_code/app.py Outdated
Comment thread libs/code/deepagents_code/app.py
@mdrxy

Copy link
Copy Markdown
Member

Will rebase #5261 after merging

…-start cancel

Address open review comments on #5590:

- Reserve busy state synchronously: _handle_offload now sets _agent_running
  before the first await (same event-loop tick as run_worker), closing the
  window where _submit_input/_process_next_from_queue could consider the app
  idle and dispatch a queued prompt concurrently with the offload. The
  reservation/release moved into a new _handle_offload wrapper around
  _offload_impl so the finally always runs, even when a cancelled task's own
  error handling is still awaiting.

- Recover offload cancelled before worker start: hook the offload worker
  into the existing _recover_unstarted_agent_worker path inside
  _cancel_worker. A worker cancelled before Textual takes its first step
  never runs _run_offload_task, so its finally never clears _offload_worker;
  every later Escape would then be consumed re-cancelling the dead worker.
  The recovery clears the worker reference so Escape falls through to the
  agent or the double-Esc input-clear path.

Tests: replace the stale guard test (the early "Cannot offload while agent
is running" check is now subsumed by queue admission) with three regression
tests covering duplicate /offload queueing, queued prompts staying blocked
until offload completes, and Esc recovery before the worker's first step.
@github-actions github-actions Bot added size: M 200-499 LOC and removed size: S 50-199 LOC labels Aug 18, 2026
@mdrxy
Mason Daugherty (mdrxy) merged commit ab82d48 into main Aug 18, 2026
54 checks passed
@mdrxy
Mason Daugherty (mdrxy) deleted the aolsenjazz/code/interrupt-offload branch August 18, 2026 19:33
Mason Daugherty (mdrxy) pushed a commit that referenced this pull request Aug 19, 2026
> [!CAUTION]
> Merging this PR will automatically publish to **PyPI** and create a
**GitHub release**.

For the full release process, see
[`.github/RELEASING.md`](https://github.com/langchain-ai/deepagents/blob/main/.github/RELEASING.md).

---

_Release notes preview: keep this section in sync with the package
`CHANGELOG.md`. Publish reads the merged CHANGELOG via `release.yml`,
not this PR description — keep them aligned anyway so the PR stays an
accurate historical record for reviewers and anyone returning later._

---


##
[0.1.58](deepagents-code==0.1.57...deepagents-code==0.1.58)
(2026-08-19)

### Breaking Changes

- `deepagents-code` now requires Python 3.12 or newer.
([#5603](#5603))

### Features

- Added OpenRouter `z-ai/glm-5.3` to the model switcher.
([#5641](#5641))
- Added support for re-authenticating MCP servers from the viewer.
([#5637](#5637))
- Footer pickers can now be opened with `ctrl+click`.
([#5611](#5611))
- Resume hints now account for `TERM_PROGRAM` support before showing
terminal-specific guidance.
([#5580](#5580))

### Fixes

- Completed the `dcode config` command surface.
([#5581](#5581))
- Made `/offload` interruptible.
([#5590](#5590))
- Improved chat and footer UI behavior: rapid typing stays visible,
double-click collapses a resized chat input, and the MCP footer wraps on
narrow windows.
([#5424](#5424),
[#5578](#5578),
[#5651](#5651))
- Captured stdio MCP server stderr in the logger.
([#5610](#5610))
- Drained hook pipes after timeout.
([#5606](#5606))
- Grouped resume trace rounds.
([#5593](#5593))
- Omitted web-search prompt guidance when web search is unavailable.
([#5602](#5602))
- Resolved message pointer shapes per cell.
([#5592](#5592))

_End release notes preview._

---

> [!NOTE]
> A **community contributors** list and a **Special thanks** section
(crediting the users who filed the issues this release's PRs closed) are
appended to the GitHub release notes automatically at publish time (see
[Release
Pipeline](https://github.com/langchain-ai/deepagents/blob/main/.github/RELEASING.md#release-pipeline),
step 3).

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: langchain-oss-automated-triage[bot] <248757908+langchain-oss-automated-triage[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dcode Related to `deepagents-code` fix A bug fix (PATCH) internal User is a member of the `langchain-ai` GitHub organization size: M 200-499 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants