Thanks to visit codestin.com
Credit goes to github.com

Skip to content

🤖 fix: prevent message edits from hanging during active streams - #4153

Merged
ammario merged 1 commit into
mainfrom
fix-active-stream-edit-hang
Sep 8, 2026
Merged

🤖 fix: prevent message edits from hanging during active streams#4153
ammario merged 1 commit into
mainfrom
fix-active-stream-edit-hang

Conversation

@ammar-agent

@ammar-agent ammar-agent commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fix message edits hanging during an active stream by reserving the edit before awaiting interruption. Terminal policy can no longer dispatch a queued successor while stopStream settles, leaving the edit waiting on the wrong turn.

Implementation

  • Use the existing owned edit reservation for the entire interruption → truncation → replacement-startup path.
  • Remove the separate queue-deferral flag and its try/finally synchronization; preserve completion cleanup, startup preemption, and admission guards.
  • Allow the edited startup's own emergency context-budget recovery through its reservation without admitting competing turns.

Validation

  • Deterministic completion/abort races failed before the fix and pass afterward: the edit retains ownership, restores queued input, and persists only the edited user turn.
  • Added a regression for emergency budget recovery during edited startup.
  • After rebasing onto current main, all 667 agent-session/coordinator tests passed (~11s).
  • All 6 stream-completion IPC tests pass under Node 22 (~6s); replaced the old private-flag polling with an explicit edit-wait barrier.
  • make static-check passes locally.

Subtractive ledger

Production: 26 lines added, 48 removed; net −22. Removed duplicate edit-deferral state, its synchronization, and a redundant queue-drain guard. Existing reservation ownership and cleanup now enforce the same safety boundary across the whole operation. No unrelated offsets.

Risks

This changes edit exclusion timing across stream completion, queue dispatch, and compaction. Existing completion/admission/queue tests remain green, and owned budget-recovery coverage protects the edited request from blocking itself.


Generated with xum • Model: openai:gpt-6-astra • Thinking: xhigh • Cost: $3.79

@ammar-agent

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-08T18:50:57.539627Z ce4b508 Manual request
🔒 Security Review Completed 2026-09-08T18:54:06.845824Z ce4b508 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 1c3949c093

ℹ️ 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".

@chatgpt-codex-connector

Copy link
Copy Markdown

Security review completed. No security issues were found in this pull request.

Reviewed commit: 1c3949c093

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Use existing edit ownership for interruption, queue exclusion, and startup; remove duplicate deferral state while preserving owned budget recovery.

---

_Generated with `xum` • Model: `openai:gpt-6-astra` • Thinking: `xhigh` • Cost: `$3.79`_

<!-- mux-attribution: model=openai:gpt-6-astra thinking=xhigh costs=3.79 -->
@ammar-agent
ammar-agent force-pushed the fix-active-stream-edit-hang branch from 1c3949c to ce4b508 Compare September 8, 2026 18:45
@ammar-agent

Copy link
Copy Markdown
Collaborator Author

@codex review

Updated the integration test to await the actual edit-completion barrier instead of polling the removed private flag. All six IPC completion tests and local static checks pass; production code is unchanged from the approved review.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: ce4b508950

ℹ️ 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".

@chatgpt-codex-connector

Copy link
Copy Markdown

Security review completed. No security issues were found in this pull request.

Reviewed commit: ce4b508950

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@ammario
ammario merged commit 55fdd13 into main Sep 8, 2026
35 of 38 checks passed
@ammario
ammario deleted the fix-active-stream-edit-hang branch September 8, 2026 21:33
ammario pushed a commit that referenced this pull request Sep 8, 2026
## Summary

Prevent the local-agent interference warning from flashing for
coordinated sub-agents, while retaining it for unrelated local task
families sharing the project directory. Follow-up UX fix after #4153.

## Implementation

- Derive frontend-only family roots during the existing bulk metadata
load, before archived rows are filtered. Cycle members and incoming
descendants share a deterministic representative; no extra IPC, disk
reads, or persisted state.
- Compare those roots in the UI, excluding coordinated ancestors,
descendants, siblings, and cousins while still warning about unrelated
families' active sub-agents.
- Retain workspace identity rather than a display name during activity
handoffs, and resolve it against current candidates so navigation into
that agent's family cannot leave a stale warning.
- Replace manual memoized ID collection and repeated metadata lookup
with filtered metadata and a direct active-workspace selection; inline
the single-use warning view. No new timer or effect.
- In a separate CI compatibility commit, recognize Codex's observed
automatic security-review heading without exempting actual findings.

## Validation

- Five same-family cases reproduced the false warning before the fix; a
separate regression reproduced the held-warning leak when switching into
the active agent's child.
- All 232 focused config/warning/workspace-family tests and 1,021
workspace/task service tests pass. Real-config tests cover archived
ancestry, cycle members/incoming descendants in both input orders,
unrelated trees, and non-persistence of derived roots.
- Codex gate tests reproduce the new-heading false positive and verify
that explicit or appended security findings remain blocking.
- Headless Storybook-manager checks passed at 1140px and the existing
pinned 375px phone viewport: one-line warning, ellipsis on phone, no
horizontal overflow or composer displacement.
- Local `make static-check` passes.

## Subtractive ledger

**P1: 61 production lines added, 62 removed; net −1.** The warning fix
is +59/−61 (net −2); the separate CI-format compatibility fix is +2/−1
(net +1). Removed frontend ancestry traversal, manual ID-list
memoization, redundant metadata lookup/fallback, stale display-name
retention, and a single-use view wrapper. Complete family scope is
derived during the existing bulk metadata read, not synchronized through
new state.

## Risks

This changes warning eligibility and adds an optional derived frontend
metadata field, not task execution, isolation, or persisted config.
Unrelated task trees still warn; existing activity smoothing and
unregistered-workspace protection remain intact.

---

_Generated with `xum` • Model: `openai:gpt-6-astra` • Thinking: `xhigh`
• Cost: `$63.33`_

<!-- mux-attribution: model=openai:gpt-6-astra thinking=xhigh
costs=63.33 -->
yermakoffivan pushed a commit to yermakoffivan/mux that referenced this pull request Sep 9, 2026
## Summary

Version bump for the v0.28.5 patch release. Headline changes since
v0.28.4: remote server connections in the desktop app (coder#4101),
self-updating `xum server` under a restart supervisor (coder#4083, coder#4127),
first-class GPT-6 Astra and Astra Pro support including Codex OAuth
routing (coder#4064, coder#4094, coder#4106, coder#4124), token-budget context window
rollovers (coder#4097), the workspace remembering model and mode on send
(coder#3968), in-place plugin updates (coder#4164), the optional flat sidebar chat
list (coder#3994), and copying selected chat text as Markdown (coder#4170). It
also carries a long run of streaming, compaction, and task-lifecycle
fixes (reconnect streaming coder#4123, message edits during active streams
coder#4153, Codex OAuth prompt-cache routing coder#4159, compaction/history
fencing coder#4133 through coder#4148, task lock ordering coder#4161) plus the Effect
Wave 4 runtime refactors and deslop passes 1 through 3.

## Implementation

Bumped with `node ./scripts/set-package-version.js 0.28.5` so the root
`package.json` and the legacy `packages/mux-compat` forwarding package
stay version-locked. `src/common/compat/productIdentity.test.ts` passes
locally (8/8).

After this PR merges, the `v0.28.5` tag will be applied to the squash
commit and the GitHub Release published to trigger the
desktop/npm/docker pipelines.

---

_Generated with `xum` • Model: `anthropic:claude-fable-5-1` • Thinking:
`xhigh` • Cost: `$1.64`_

<!-- mux-attribution: model=anthropic:claude-fable-5-1 thinking=xhigh
costs=1.64 -->
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.

2 participants