Skip to content

A window that just acted is still watching: the unattended door stops lying about who had gone (#833) - #851

Merged
santoshkumarradha merged 3 commits into
devfrom
post-diet/fix833
Sep 11, 2026
Merged

santoshkumarradha merged 3 commits into
devfrom
post-diet/fix833

Conversation

@santoshkumarradha

Copy link
Copy Markdown
Member

Closes #833.

What was true

Every road that ended a hosted conversation went through one door,
session retired, and therefore said one sentence:
nobody was left watching this conversation, so the reply stopped — ask again to pick it up. A person's own goodbye said it, aforge engine --stop said it, a
signal said it, a stale build letting go said it, and the idle sweep said it.

And a conversation with no surface attached was unwatched on the instant. A call
that stalled past internal/remote's ten-second callDeadline (#832) tears the
window's pipe without the person going anywhere, so the room read as empty a
fraction of a second after they had pressed 1 on a card in it. #833 is that
reply: bash · cancelled, and the unattended sentence, on a screen the person
was sitting in front of.

What is true now

Presence is renewed by the act itself. Every call a window makes records the
act — (*server).dispatch is the one funnel every keystroke takes — and
Session.watchedLocked counts a window that acted inside watchGrace as
somebody in the room. The grace is 2 * callDeadline, derived and never
retyped: one deadline for the call that did not come back, one for the link that
has not been dialled again yet. Both the sweep (RetireIfIdle) and the
stand-down reading (enginehost.Host.idleLocked, through IdleSince) go
through it.

The door is not disabled. A room with no surface and no act inside the grace
is still retired, still closed, still flushed — pinned by
TestAConversationNobodyEverWatchedIsStillRetired and
TestAnActThatHasAgedOutStopsCountingAsPresence, and by every test already in
internal/remote/idle_test.go and internal/enginehost.

Every ending names the door it actually came through. A goodbye
(MethodClose) is conversation left. A host stopped on somebody's word while a
window is still in the room is a new door, engine stopped, with its own
sentence. Only the unattended door says nobody was left watching — and when it
does, the cause carries the window it believed had gone
(Agent.InterruptNamed, stopAs), so the sentence names it:
nobody was left watching this conversation from studio, so the reply stopped — ask again to pick it up.

The manual page (internal/manual/chat/models-and-cost.md) carries all three
sentences and a heading in the words somebody would actually ask.

Reproduction

internal/remote/unattended_test.go, deterministic, no model and no wall clock.
Two of its four tests were red on dev and are green here; the other two are the
guards that the door still works.

Tests

  • laptop: go build ./..., go vet, gofmt, make test-quick,
    go test ./internal/remote/ ./internal/enginehost/ ./internal/manual/... -count=1,
    go test ./internal/session/ -run 'Stop|Resume|Manual|Door' -count=1
  • Spark: the full internal/session, internal/remote and internal/enginehost
    suites, and TestQuestionsE2E/TheOrdinaryRoadCarriesAQuestionAndItsAnswer
    six copies in parallel — recorded in a comment below.

The first attempt at this fix was made by the Cursor CLI on Grok 4.6 Fast and
reviewed as a skeptic; what it got right and what was changed on top is in the
lane report.

🤖 Generated with Claude Code

santoshkumarradha and others added 3 commits September 10, 2026 22:04
… just acted

Two reds and one guard, all deterministic and with no model behind them:
a window that made a call and then lost its link is retired for want of a
watcher, and every road that ends a conversation says nobody was left
watching it — including one taken with a window still in the room.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…me through

WHAT WAS TRUE: every road that ended a hosted conversation cancelled the turn
as `session retired`, so a person's own goodbye, a host stopped with
`aforge engine --stop`, a signal, a stale build letting go and the idle sweep
all read out the unattended door's one sentence — `nobody was left watching this
conversation, so the reply stopped`. And a conversation with no surface attached
was unwatched on the instant: a call that stalled past internal/remote's ten
second `callDeadline` (#832) tore the pipe under a window nobody had left, and
the room looked empty a fraction of a second after the person pressed a key in
it. #833 is a reply that stopped on that sentence, with its bash cancelled,
while its window was still on the screen.

WHAT IS TRUE NOW: presence is renewed by the act itself. Every call a window
makes records the act ([server.dispatch] is the one funnel), and
[Session.watchedLocked] counts a window that acted inside `watchGrace` — twice
`callDeadline`, the stalled call and the redial after it, derived and never
retyped — as somebody in the room. The sweep and the stand-down reading both go
through it, so a stalled road no longer empties a conversation somebody is
sitting in. The door is not disabled: a room with no surface and no act inside
the grace is still retired, closed and flushed.

And every ending now names the door it actually came through. A goodbye is
`conversation left`; a host stopped under a window still in the room is a new
door, `engine stopped`; only the unattended door says nobody was left watching,
and when it does the cause carries the window it believed had gone
([Agent.InterruptNamed], `stopAs`) so the sentence names it. The manual page
carries all three, under a heading in the words somebody would ask.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Co-Authored-By: Cursor Agent (Grok 4.6 Fast) <[email protected]>
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@santoshkumarradha

Copy link
Copy Markdown
Member Author

Evidence

Deterministic reproduction — internal/remote/unattended_test.go, no model, no wall clock. On dev (c0b2041):

--- FAIL: TestAWindowThatActedSecondsAgoIsStillWatching
    a conversation whose window acted a moment ago was retired for want of a watcher
--- PASS: TestAConversationNobodyEverWatchedIsStillRetired
--- FAIL: TestAStopTakenWithAWindowInTheRoomDoesNotSayNobodyWasWatching
    a conversation closed with a window still in the room said nobody was left watching it

Laptop — go build ./..., go vet, gofmt, make test-quick (all 19 packages ok),
go test ./internal/remote/ ./internal/enginehost/ ./internal/pair/... ./internal/relay/ ./internal/furrow/ ./internal/manual/... -count=1,
go test ./internal/session/ -run 'Stop|Resume|Manual|Door' -count=1: green.

Spark, isolated clone at 756c465a5:

ok  github.com/Agent-Field/aforge-v2/internal/session     210.806s
ok  github.com/Agent-Field/aforge-v2/internal/remote       25.831s
ok  github.com/Agent-Field/aforge-v2/internal/enginehost   13.828s
ok  github.com/Agent-Field/aforge-v2/internal/manual        1.478s

The acceptance, end to end. TestQuestionsE2E/TheOrdinaryRoadCarriesAQuestionAndItsAnswer,
six copies in parallel, twice — once on the suite's own model and once on the bench's
E2E_MODEL=deepseek/deepseek-v4-flash-0731, the model #833 was captured under. Twelve
copies, all ok, and grep -c 'nobody was left watching' is 0 in every one of the
twelve logs.

🤖 Generated with Claude Code

@santoshkumarradha
santoshkumarradha marked this pull request as ready for review September 11, 2026 02:40
@santoshkumarradha
santoshkumarradha merged commit 29de6be into dev Sep 11, 2026
3 checks passed
@santoshkumarradha
santoshkumarradha deleted the post-diet/fix833 branch September 11, 2026 02:40
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.

chat: a reply stops with 'nobody was left watching this conversation' and a cancelled bash while the person is sitting in front of it

1 participant