Skip to content

fix(native): notify superseded conversation on codex/antigravity session rotation - #7293

Open
omni-resolve-agent[bot] wants to merge 1 commit into
mainfrom
fix/34731964201
Open

fix(native): notify superseded conversation on codex/antigravity session rotation#7293
omni-resolve-agent[bot] wants to merge 1 commit into
mainfrom
fix/34731964201

Conversation

@omni-resolve-agent

Copy link
Copy Markdown
Contributor

Summary

Extracted claude-native's supersession notice into a shared helper, omnigent/native/_native_supersession.py::post_supersession_notice, and call it from the codex-native rotation path (after /new, command='/new') and the antigravity-native cascade rotation path (after /clear, command='/clear'); claude-native's _post_clear_supersession is now a thin wrapper over the same helper. The notice posts idle status, a persisted assistant message linking to /c/, and the external_session_superseded redirect event to the OLD conversation, all best-effort. Committed as 756c648 on branch fix/34731964201 for the workflow-owned publisher.

Root Cause

codex-native _maybe_rotate_session_on_thread_started and antigravity-native _rotate_session_for_cascade complete the session rotation (create the new conversation, transfer the terminal, release the old runner binding) but never post the three supersession events that claude-native's _post_clear_supersession posts, so the superseded conversation's web view is stranded: its Working… spinner never clears, no message links to the new chat, and an open client never redirects.

Validation

Demo

Recordings: none — Before: no clip from the repro run — the failure is a no-motion absence (the old view just stays on /c/ with a stuck spinner), described textually per dev/recording-lanes.md. After: the corrected outcome's driver, tests/e2e_ui/chat/test_codex_rotation_supersession_redirect.py, uses the sync Playwright page fixture, which the suite's OMNIGENT_E2E_RECORD_DIR video hook does not instrument (conftest._record_video patches only playwright.async_api.Browser), so the recorder cannot emit a webm for this journey. Textual before/after for the PR Demo section: BEFORE — after /new the open browser stayed on /c/?view=chat for the full 30s window (63 polls), the Working… spinner never cleared, and no notice appeared; AFTER — the browser auto-redirects to the new conversation and the old conversation carries an assistant notice 'This conversation was ended by /new' linking to /c/ (e2e_ui journey passes in ~31s including the redirect).

Issues

Closes #7290
Resolves OMNI-7410

…ion rotation

Codex-native /new and antigravity-native /clear rotate the Omnigent session
binding onto a fresh conversation but never told the abandoned one, stranding
its web view: the Working... spinner never cleared, no message linked to the
new chat, and an open client never redirected. Claude-native already posted
the three supersession events from its rotation path.

Extract claude-native's supersession notice into a shared helper
(omnigent/native/_native_supersession.py) and call it from the codex
_maybe_rotate_session_on_thread_started and antigravity
_rotate_session_for_cascade rotation paths after the terminal transfer:
idle status, a persisted notice message linking to the new conversation,
and the external_session_superseded redirect event, all best-effort.
@github-actions github-actions Bot added the P2-medium Priority: bug with workaround, important feature request label Sep 13, 2026
@github-actions

github-actions Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

UI Preview for this PR has been removed.

@github-actions github-actions Bot added the size/XL Pull request size: XL label Sep 13, 2026
@omnigent-ci

omnigent-ci Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Polly AI Review

Missing visual demonstration

This fix changes user-visible web behavior — the superseded conversation now stops its "Working…" spinner, gains an assistant notice message linking to the new chat, and an open client auto-redirects. The PR description's "Attached images/videos" scan returns (none found).

The description gives a thorough, credible reason no .webm is produced (the sync Playwright page fixture isn't instrumented by the OMNIGENT_E2E_RECORD_DIR video hook), and the "before" is genuinely a no-motion absence. That explains the missing video, but a screenshot of the after-state is still feasible and would be worth attaching — e.g. the old conversation showing the This conversation was ended by … notice with the /c/<new> link, or the browser after it redirects. Please attach one, or confirm explicitly that even a static capture isn't obtainable for this journey.

Blocking issues

None. I verified the extraction is behavior-preserving:

  • omnigent.native._native_supersession.post_supersession_notice uses urllib.parse.quote(old_session_id, safe=""), which is exactly what the original url_component did (bridge.py::url_component is urllib.parse.quote(value, safe="")), so URL encoding of the session id is unchanged.
  • The old_session_id == new_session_id defensive guard, the three-event ordering (idle status → assistant notice → external_session_superseded), and the per-post httpx.HTTPError-swallowing best-effort semantics are all preserved verbatim.
  • In codex_native/forwarder.py, both old_session_id and new_session_id are in scope at the call site (set just above), and the notice is posted after the coalescers close and after target.session_id is rotated — correct ordering. _AGENT_NAME is "codex-native-ui", matching the test's assertion.
  • In antigravity_native/reader.py, the notice is posted after write_bridge_state and the runner-release PATCH, with new_session_id in scope; posting to the old session's /events after releasing its runner_id is fine (the events endpoint is server-side, independent of runner binding — same order claude-native already uses).
  • The claude-native _post_clear_supersession thin wrapper keeps its existing signature, so its positive-control test still passes.

Security vulnerabilities

None. No new external input is trusted: new_session_id is a server-generated conversation id embedded in a markdown link, not user-controlled. Path components remain percent-encoded. No secrets, deserialization, or auth-boundary changes.

Non-blocking notes

  • The rotation-capable harnesses are exactly claude/codex/antigravity, and all three now emit the notice — good coverage. Note claude_native/forwarder.py::_maybe_rotate_session_on_fork (the /fork path) does not post this notice; if a fork is meant to supersede rather than branch alongside the original, it may want the same treatment — worth a one-line confirmation that fork is intentionally excluded.
  • _AGENT_NAME is now duplicated as a literal ("codex-native-ui", "antigravity-native-ui") alongside the existing per-harness constants; harmless, just a minor drift risk if those wrapper names ever change.

Approach

Sound and idiomatic. Hoisting the three-event notice into a single shared post_supersession_notice and reducing _post_clear_supersession to a command="/clear" wrapper is the right DRY move, and passing command as a parameter cleanly handles the /new vs /clear wording difference. The test strategy — a _RecordingAP unit assertion of the exact posts for all three harnesses plus a live e2e_ui redirect journey — matches the producer/consumer split well.

Summary

A clean, behavior-preserving refactor that closes a real gap: codex-native and antigravity-native rotations now notify the superseded conversation just as claude-native already did. The extraction is verified equivalent (URL encoding, ordering, best-effort error handling, guard all preserved), scope variables are correct, and tests pin the contract for all three harnesses. No blocking correctness or security concerns. The only real ask is a static after-state screenshot for the Demo section, since this fix produces a concrete user-visible change even though a video can't be auto-recorded for this journey.


Automated review by Polly · workflow run

from pathlib import Path

import httpx
import pytest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2-medium Priority: bug with workaround, important feature request size/XL Pull request size: XL ui-preview

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] codex-native / antigravity-native: session rotation never notifies the superseded conversation (no idle status, notice, or redirect)

0 participants