Skip to content

Commit fcfcf09

Browse files
AbirAbbasclaude
andcommitted
fix(chat): a fresh reading that finds the chat held here lifts a news-only send block
The displaced-window block set from a listing row or the displaced notice now yields to the reading a send makes itself: when that newer reading shows this computer holds the chat, the send goes ahead. A block a take decided, or a failed take, still never lifts that way. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent 86373f7 commit fcfcf09

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

‎internal/tui3/homepanel_heldelsewhere.go‎

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ type ownershipReadMsg struct {
6161
type sendHold struct {
6262
fence uint64
6363
blocked bool
64+
// seen marks a block that only news of another holder set: a listing row
65+
// or the displaced notice. A fresh reading made for this send that finds
66+
// the chat held here again lifts it, because that reading is newer than
67+
// the news; a block a take decided, or a failed take, never lifts that way.
68+
seen bool
6469
// failed marks a hold whose take did not finish, so its session is a
6570
// copy this window may not keep using even if a later take finds the
6671
// chat already here.
@@ -242,7 +247,11 @@ func (a *app) resumeOwnedSend(msg ownershipReadMsg) tea.Cmd {
242247
if msg.proof {
243248
fence = msg.fence
244249
}
245-
if row.Status == chatlist.Here && row.Fence == fence && !held.blocked {
250+
if row.Status == chatlist.Here && row.Fence == fence && (!held.blocked || held.seen && row.Mine && !held.failed) {
251+
if held.blocked {
252+
held.blocked, held.seen = false, false
253+
a.machineRead.sendHolds[id] = held
254+
}
246255
return msg.resume()
247256
}
248257
if !held.blocked && (row.Status == chatlist.Idle || row.Status == chatlist.Off) && row.Head != "" && row.Head == msg.head {
@@ -303,7 +312,7 @@ func (a *app) rememberSendHolds(msg homeMachinesMsg) {
303312
for _, row := range msg.rows {
304313
held, known := a.machineRead.sendHolds[row.Cell]
305314
if heldElsewhere(row) && (!known || row.Fence >= held.fence) {
306-
held.blocked = true
315+
held.blocked, held.seen = true, !known || held.seen || !held.blocked
307316
a.machineRead.sendHolds[row.Cell] = held
308317
}
309318
if row.Status != chatlist.Here || held.blocked || held.failed {
@@ -320,7 +329,8 @@ func (a *app) rememberSendHolds(msg homeMachinesMsg) {
320329
var displacedSendSuffix = chatlist.Superseded("")
321330

322331
// blockDisplacedSend keeps a shown displacement stronger than a cached writer
323-
// reading. Only a successful continuation can make this window writable again.
332+
// reading. A successful continuation makes this window writable again, and so
333+
// does a fresh reading for a send that finds the chat held here.
324334
func (a *app) blockDisplacedSend(text string) {
325335
if a.file == "" || !strings.HasSuffix(text, displacedSendSuffix) {
326336
return
@@ -329,8 +339,8 @@ func (a *app) blockDisplacedSend(text string) {
329339
a.machineRead.sendHolds = map[string]sendHold{}
330340
}
331341
id := filepath.Base(session.DirOf(a.file))
332-
held := a.machineRead.sendHolds[id]
333-
held.blocked = true
342+
held, known := a.machineRead.sendHolds[id]
343+
held.blocked, held.seen = true, !known || held.seen || !held.blocked
334344
a.machineRead.sendHolds[id] = held
335345
}
336346

0 commit comments

Comments
 (0)