Repository navigation
sminos: a session sent to the background goes on as the same member - #228
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2826ce0dca
ℹ️ 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".
| else: | ||
| state_word = "stopped" if transcript_path(sid) else "gone" | ||
| status = (r or {}).get("status") | ||
| status = max((x["status"] for x in chain if x["status"]), key=lambda e: e["ts"], default=None) |
There was a problem hiding this comment.
Preserve writer sequence when inheriting status
When the same writer sets a status on the predecessor and later sets or clears it on the continued session after a backward clock correction, this timestamp-only max selects the stale predecessor status. Status ordering within one writer is defined by seq, and this code has already reduced each session separately before losing that cross-session ordering; merge the lineage's status events by writer/sequence (as the in-charge merge below does) before comparing timestamps across writers.
Useful? React with 👍 / 👎.
| return latest_membership(evs) == "joined" | ||
|
|
||
| try: | ||
| carried = cursor_load(project, old) |
There was a problem hiding this comment.
Carry pending deliveries across the hand-off
When an addressed event is recorded for the old session shortly before the hand-off—especially on another machine and synced afterward—this transfers only its chat cursor. The successor's former lineage is not considered by _owed, and deliver_next checks only member.session, so the event addressed to the old ID is never pushed to the continuing job. Carry the old delivery state and treat events addressed to former session IDs as owed to the successor.
Useful? React with 👍 / 👎.
| held = own_alias(_own_events(project, sid), sid) | ||
| if str(peer.get("kind") or "") == "bg" and not held[0]: | ||
| old, old_peer = predecessor(project, sid) |
There was a problem hiding this comment.
Recover the predecessor alias when the job joins late
If reconciliation reads the old transcript after its process exits but before the successor appears in the peer registry, hand_off retires the old session while the successor is not yet joined and therefore cannot rename it. When the successor later reaches this code, own_alias is empty and predecessor can no longer find the stopped seat-less predecessor, so the join records the job's generated title instead of the inherited alias. The projection may display the inherited alias, but _member_alias and default_from read the successor's own events and attribute its messages to the generated title until a daemon rename happens (which never occurs for a local project without a daemon).
Useful? React with 👍 / 👎.
| """The session that goes on for `session`: itself while it runs or was | ||
| never handed off, else the end of its chain of hand-offs (continued_in).""" | ||
| seen = {session} | ||
| while not S.session_running(session) and (nxt := S.continued_in(session)) and nxt not in seen: |
There was a problem hiding this comment.
Redirect controls before the predecessor process exits
During the normal hand-off window the old interactive process remains alive while the background job is already the member, so this condition returns the old session for a full-ID query. Because sminos_control.py uses watch_session for steer, interrupt, model, compact, answer, and decide, those commands target the ending predecessor rather than the active successor, even though the same old ID resolved through member addressing reaches the successor. Keep the old endpoint behavior only for a watcher that intends to auto-follow, and resolve control commands through the recorded continuation immediately.
Useful? React with 👍 / 👎.
…a made-up harness name never renames one
…retried whole, a resume unlinks, one writer's lines read in order - reconciliation looks, for each seat whose session no longer runs, for the record naming a job it continues in: the job may join before the harness writes it. transcript_path keeps its hits per invocation, so the pass costs no extra glob beside state(). - hand_off copies the cursor and moves the seat before it retires the old session; a seat lock another command holds leaves it joined, for the next pass to do again; the rename runs whoever won the retirement. - an own joined after a continued retirement ends the link: a resumed session is its own member, and the job keeps its own events. - a chain's in-charge events are merged in each writer's seq order.
…aches on another thread
…d-off is the target the verbs and the bridge see
2826ce0 to
47be624
Compare
/background(and ←, the agents view's gesture) does not move a session: the engine starts a--bgjob with--resume <transcript> --fork-session(a new session id, a new process, a new bridge socket), lets the interactive process exit, and appends{"type":"continued-in","continuedInSessionId":<new>}to the old transcript (engine 2.1.300,G_t/MAe). sminos keyed everything on the session id, so the member was retiredendedand an unrelated one joined under the job's generated title. Seen today in MAWS:maws-febecame "GUI AI agent workspace charter". Separately, a derived name (<dir>-<one random byte>, drawn again by every process unless thetengu_session_stable_addressgate is on) renamed a member on a plain resume (maws-4d→maws-3f, same session).What changes (sminos.py, sminos_bridge.py)
reason: "continued", to: <new>. The link is recorded when the job joins while the old process still exits, else when the old one's membership would end; a reconcile pass over stopped seats catches a job that joined before the record existed. The job takes over the alias, chat cursor and seat, and inherits the in-charge line and status through the projection's lineage. A tag,alias#oldshortor full id naming the old session resolves to the job;list --jsoncarriesformer.derived,auto,collision) never replaces an alias the log already holds; a given name (/rename,--name) still renames. Applies to the view, joins, the record hook's alias, and a session's sender identity.sminos watchfollows the session into the job when it ends by a hand-off; a full id passed to watch/steer/interrupt/... resolves along the chain.transcript_pathcaches hits per invocation (cleared byforget_caches), so the new seat pass sharesstate()'s glob.Design: "Hand-off" and "Names the harness makes up" in §2 of the smns design, plus a Decision Log entry; SKILL.md's overview and
--jsonfields. The desk's own projection still reads the job as a separate session; folding it there is MAWS's follow-up.Verification: tests in
run-sminos-tests.sh(1153 assertions in the family core; each fix-wave test shown to fail with its fix reverted). Independent review: high rung (4 findings, fixed in 50d3e02), then medium rung (1 finding, fixed in 2826ce0). ci-gate GREEN on 2826ce0: https://github.com/SSFSKIM/doperpowers/actions/runs/39080394732. Version 7.171.0.🤖 Generated with Claude Code