Repository navigation
Description
The owner reported (2026-11-23): a notice is kept in step on the Mac and the iPhone, but when the user has acted on the agent themselves (answered its question or given it its next instruction in the session's terminal, on either device), the notice should count as read as well, and it does not.
What the code shows, at commit 968516d:
- When a session's agent is in another state than its notice was made in, the host marks the notice handled as
.movedOn(Sources/AgentTermHost/NoticeCenter.swift:55-64, called for every list of sessions byHostServer.updateNotices). Notice.reads(.movedOn)isfalse(Sources/AgentTermProtocol/Notice.swift:65-66): handled, but not read. A notice is made read only by a reply from a notification or the Inbox (.answered,HostServer.swift:2313), the session opened on a device (.opened,:2305), a dismissal (.dismissed), or reading it in the Inbox.- So a question the user answered by typing in the session's terminal, which moves the agent on, leaves its notice unread on every device, and the Inbox's count of unread items with it.
What has to be told apart: the agent moving on because of what the user did (typed in its session, on the Mac or the iPhone) from the agent moving on by itself (it went on after a timeout, the session ended, it asks something else before anyone looked). Only the first is the user having seen it. Not known yet: whether every agent's state changes only after the input (Claude Code, Codex, Copilot CLI, Antigravity at their versions, principle 5), and whether input from an agent's own MCP server (shell_send) must not count.
Decided by the owner on 2026-11-23: a notice whose agent moved on is read on every device, whatever it moved on to: back to working (someone answered, since an agent that waits does not go on by itself), something else asked (that has a notice of its own), or its session ended. Notice.reads(.movedOn) is true; a notice is unread only while its agent is still in the state it was made for, and nobody read, opened, answered or dismissed it.
Also said by the owner (2026-11-23): its notification is taken back too, on the Mac and on the iPhone. What the code does already, not tried on a real iPhone yet: a notice handled as .movedOn is taken back as any handled one, since that follows being handled, not being read: the Mac removes its macOS notification (AppModel.noticeHandled); a connected iPhone removes it on noticeHandled (PhoneModel.swift:1814-1817); an iPhone away is sent a take-back through Apple (HostServer.tellHandled), a background push iOS may deliver late or not at all until Apple grants the filtering entitlement (#237); an iPhone that connects again removes every handled one of the log (PhoneModel.swift:1795-1802).
The way it was first thought of, not taken: the host notes, per session, that a user's client typed into it (Client input that is not an emulator's answer, TerminalReply) while its agent waited or was done; the notice of the state it moves on from is then handled as read (a How of its own, such as .answeredInSession, which reads says is read). Whether that is the behaviour wanted, and for which states (a question, a permission, a finished task), is the owner's choice.
- Decided with the owner which user actions count as read
- Tried with the real agents at their versions: the state after a reply typed in the terminal
- Reproduced: a test that fails because a notice whose question was answered in the terminal is not read, seen failing
- Fixed, the test passing, the layers of rule 2 run, committed, CI green
Definition of done
- What the owner decides counts as read is written here: every moving on of the agent.
- The real agents are tried at their versions (principle 5): typing a reply in the session's terminal moves each one's state on, and its notice is read on both apps; what was found, with the versions, is written here.
- A test in
AgentTermHostTests(with a state folder and a port of its own): a notice made for a question, the question answered by input typed into the session from a client; it fails because the notice is not read on every device, seen failing, then passes and stays. A second: a session that ends, and an agent that asks something else, make the notice read too. - After the fix a notice whose session the user acted on is read on every device, the Mac and the iPhone, and the Inbox's unread count goes down on both, whatever the agent moved on to.
- The words, if any are new, in
AgentTermProtocol(principle 9); the protocol's number raised if a message changes (principle 6). docs/SPEC.mdanddocs/DESIGN.md(the Inbox) say it; a case indocs/TESTING.mdthat the test names.- Its notification is taken back when the agent moves on: on the Mac and on a connected iPhone, by a test (
scripts/test-both.sh "iPhone Air"); on an iPhone away, tried on a real iPhone with a TestFlight build and noted in the milestone's pull request, with what Waiting for Apple: the Notification (NSE) Filtering entitlement, to take notifications back at once #237 still leaves late. swift build,swift test,scripts/test-mac.sh,scripts/test-ios.sh "iPhone Air"andscripts/test-both.sh "iPhone Air"(what one app shows of what the other did).make formatandmake lint, committed on the milestone's branch and pushed, CI on the branch green.
Tiếng Việt
Đây là bản dịch của phần tiếng Anh ở trên; các ô đánh dấu chỉ có ở phần tiếng Anh.
Owner báo (2026-11-23): thông báo hiện đã đồng bộ giữa Mac và iPhone, nhưng khi người dùng tự thao tác với agent (trả lời câu hỏi của nó, hoặc đưa chỉ dẫn tiếp theo, ngay trong terminal của session, trên thiết bị nào cũng vậy), thông báo đó cũng phải được tính là đã đọc, và hiện tại thì không.
Code cho thấy, ở commit 968516d:
- Khi agent của một session ở trạng thái khác với trạng thái lúc tạo thông báo, host đánh dấu thông báo là đã xử lý theo kiểu
.movedOn(Sources/AgentTermHost/NoticeCenter.swift:55-64, đượcHostServer.updateNoticesgọi với mọi danh sách session). Notice.reads(.movedOn)làfalse(Sources/AgentTermProtocol/Notice.swift:65-66): đã xử lý, nhưng chưa đọc. Một thông báo chỉ thành đã đọc khi trả lời từ notification hoặc Inbox (.answered,HostServer.swift:2313), mở session trên một thiết bị (.opened,:2305), bỏ qua (.dismissed), hoặc đọc nó trong Inbox.- Vì vậy một câu hỏi người dùng đã trả lời bằng cách gõ trong terminal của session, làm agent chuyển trạng thái, vẫn để thông báo của nó chưa đọc trên mọi thiết bị, kéo theo số mục chưa đọc của Inbox.
Điều cần phân biệt: agent chuyển trạng thái vì việc người dùng làm (gõ trong session của nó, trên Mac hoặc iPhone) với agent tự chuyển (đi tiếp sau một thời gian chờ, session kết thúc, hỏi câu khác trước khi có ai xem). Chỉ trường hợp đầu là người dùng đã thấy. Chưa biết: trạng thái của mọi agent có chỉ đổi sau input không (Claude Code, Codex, Copilot CLI, Antigravity ở phiên bản đang dùng, nguyên tắc 5), và input từ MCP server của chính agent (shell_send) có phải không được tính không.
Đã quyết bởi owner ngày 2026-11-23: thông báo có agent đã chuyển trạng thái được tính là đã đọc trên mọi thiết bị, dù nó chuyển sang gì: làm tiếp (đã có người trả lời, vì agent đang chờ không tự đi tiếp), hỏi câu khác (câu đó có thông báo riêng), hay session kết thúc. Notice.reads(.movedOn) là true; một thông báo chỉ chưa đọc khi agent vẫn ở đúng trạng thái lúc tạo nó, và chưa ai đọc, mở, trả lời hay bỏ qua nó.
Owner nói thêm (2026-11-23): notification của nó cũng phải được thu hồi, trên Mac và trên iPhone. Điều code đã làm, chưa thử trên iPhone thật: thông báo xử lý theo kiểu .movedOn được thu hồi như mọi thông báo đã xử lý, vì việc thu hồi đi theo trạng thái đã xử lý chứ không theo trạng thái đã đọc: Mac gỡ notification macOS của nó (AppModel.noticeHandled); iPhone đang kết nối gỡ nó khi nhận noticeHandled (PhoneModel.swift:1814-1817); iPhone ở xa được gửi một lệnh thu hồi qua Apple (HostServer.tellHandled), là một push nền mà iOS có thể giao muộn hoặc không giao, cho tới khi Apple cấp entitlement filtering (#237); iPhone kết nối lại thì gỡ mọi thông báo đã xử lý trong log (PhoneModel.swift:1795-1802).
Cách nghĩ ban đầu, không dùng: host ghi nhận, theo từng session, rằng client của người dùng đã gõ vào đó (input của Client không phải câu trả lời của emulator, TerminalReply) trong lúc agent đang chờ hoặc đã xong; thông báo của trạng thái nó rời đi khi đó được xử lý là đã đọc (một How riêng, ví dụ .answeredInSession, mà reads coi là đã đọc). Đó có phải hành vi mong muốn không, và cho những trạng thái nào (câu hỏi, xin quyền, việc đã xong), là quyết định của owner.
- Quyết cùng owner những thao tác nào của người dùng được tính là đã đọc
- Thử với các agent thật ở phiên bản đang dùng: trạng thái sau khi gõ trả lời trong terminal
- Tái hiện: một test fail vì thông báo có câu hỏi đã được trả lời trong terminal vẫn chưa đọc, đã thấy fail
- Đã sửa, test pass, chạy các tầng của rule 2, commit, CI xanh
Định nghĩa hoàn thành
- Điều owner quyết là được tính đã đọc được ghi vào đây: mọi lần agent chuyển trạng thái.
- Các agent thật được thử ở phiên bản đang dùng (nguyên tắc 5): gõ trả lời trong terminal của session làm trạng thái của từng agent chuyển đi, và thông báo của nó thành đã đọc trên cả hai app; điều tìm được, kèm phiên bản, được ghi vào đây.
- Một test trong
AgentTermHostTests(với state folder và port riêng): tạo thông báo cho một câu hỏi, trả lời câu hỏi bằng input gõ vào session từ một client; test fail vì thông báo không được đọc trên mọi thiết bị, đã thấy fail, rồi pass và được giữ lại. Test thứ hai: session kết thúc, và agent hỏi câu khác, cũng làm thông báo thành đã đọc. - Sau khi sửa, thông báo của session mà người dùng đã thao tác được đọc trên mọi thiết bị, Mac và iPhone, và số chưa đọc của Inbox giảm ở cả hai, dù agent chuyển sang trạng thái nào.
- Câu chữ mới, nếu có, nằm trong
AgentTermProtocol(nguyên tắc 9); số protocol tăng nếu một message thay đổi (nguyên tắc 6). docs/SPEC.mdvàdocs/DESIGN.md(phần Inbox) có nói đến; một case trongdocs/TESTING.mdmà test ghi tên.- Notification của nó được thu hồi khi agent chuyển trạng thái: trên Mac và iPhone đang kết nối, bằng một test (
scripts/test-both.sh "iPhone Air"); trên iPhone ở xa, thử trên iPhone thật với bản TestFlight và ghi trong pull request của milestone, kèm phần Waiting for Apple: the Notification (NSE) Filtering entitlement, to take notifications back at once #237 vẫn còn làm chậm. swift build,swift test,scripts/test-mac.sh,scripts/test-ios.sh "iPhone Air"vàscripts/test-both.sh "iPhone Air"(thứ một app hiện từ việc app kia làm).make formatvàmake lint, commit trên nhánh của milestone và push, CI trên nhánh xanh.
Activity
manhpham90vn commentedon Nov 23, 2026
Fixed in e91b892: A notice whose agent moved on is read on every device (
Notice.reads), and its notification taken back as before. NOTICE-7,NoticeCenterTests,InboxBookTests.Run on
milestone-0.15.1, 2026-11-23:swift build;swift test(531 host tests, 186 protocol and the rest, 0 failures);scripts/test-mac.sh(a whole run: the two new tests passed; three others failed and passed on their own, #323);scripts/test-ios.sh "iPhone Air"passed;scripts/test-both.sh "iPhone Air"passed;make format,make lint; CI on the branch green (run 45100931606).Left: the real agents tried (item 2), and an iPhone away with a TestFlight build (item 7).
manhpham90vn commentedon Nov 23, 2026
Item 2 not tried yet, 2026-11-24: the real agents would have to be signed in and answer in a folder they trust, as said in #320. That is the owner's to do (rule 1), and it is written in PR #326 with the TestFlight check (item 7). Stays open.
fix: take back the profile question, answer an agent from the Inbox, …
test(host): cover read-on-move-on notices across devices end to end
manhpham90vn commentedon Nov 25, 2026
Closed at the owner's word (2026-11-25): the automated tests are enough for 0.15.1; the trials below are not done.
Done:
Notice.reads(.movedOn)is true (e91b892). New NOTICE-7b (02e6a60),PushTests.testANoticeWhoseAgentMovedOnIsReadOnEveryDevice: through the host, with the Mac and the iPhone connected, a question answered by Return typed from the iPhone, a question asked in place of another, and a task whose session ends are each handled as moved on and read in both Inboxes and the host's log. Seen failing with moved on not read (4 unread on each device), then passing 3 times out of 3. NOTICE-5's row no longer says moved on is not read.Not done:
test-both.shcheck that the notification is taken back on the Mac and a connected iPhone. The Mac's test app posts no system notification (rule 3), and the iPhone's would need its Notification Center driven through SpringBoard. An iPhone away not tried with TestFlight.