Repository navigation
Conversation
Signed-off-by: Yehor Komarov <10210242+geoolekom@users.noreply.github.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Review fixes for the push of a phone's chats. - A push is written as one step under the chat's intake and the store's lock, so a message of the person or the marker of a harness session is stored either before the push is checked or after it is written. The erasure check is asked again once the store is held. - The marker of a harness session is looked up and written under the intake too. - A `seen` that no item of the chat has is refused (`unknown seen`), and the item is found by its time from the end, so two items of one time do not make a false fork. - A push is refused when it carries two equal turns, a turn more than a day after the computer's clock, or a time that is not spelled `...T...Z`. The times of the phone and the computer are still never used to order turns. - The fork id is made with the shared length-prefixed digest. - `valid_id` of the chat is public and used by the push and the handoff. - The hidden calls of the chat are named for what they are (`is_own_call`), and the origin note is documented as no session marker. - The push command moves to its own module, `phone::push`, which holds the wire contract (request, line limit, answer, errors). The rule for a fork is told once, in `chat::from_phone`. - Tests: the order of a chat is the order its turns arrived, whatever the phone's clock says; a turn far ahead is refused; a resend that overlaps stored turns adds the new ones only; an unknown `seen`; two turns of one time; the calls of tools kept in a fork; the model never sees where a chat was started; nothing is stored during an erasure; a message waits for work under the intake. Signed-off-by: Yehor Komarov <10210242+geoolekom@users.noreply.github.com>
…rasure without I/O A phone turn too long for one line is now split by the phone into turns of the same role, a millisecond apart, so nothing is left out of the computer's chat. A turn more than a day after the computer's clock is refused as `time too far ahead`, not as a malformed push. Times still order nothing. The write-time erasure check no longer reads the host while the intake and the records are held: the manager counts the erasures that reached the deleting step, and a push compares that count as it starts and as it writes. The check that may wait for the host runs once, as the command starts. The look before a Claude Code marker counts a turn of either role that the answer did not store itself, so a phone turn of any kind during an answer withholds the marker. Tests: the marker waits for the intake and a turn that lands between the look and the marker never precedes it; the intake test uses a signal instead of a sleep; the manager's erasure count; split turns. The module docs tell each fact in one place: the wire contract in `push.rs`, what is stored and when a chat forks in `from_phone.rs`, the line limit next to `MAX_LINE`. Signed-off-by: Yehor Komarov <10210242+geoolekom@users.noreply.github.com>
… owner of the erasure rule An answer that tells text, calls a tool, gets its result and tells more text, with nothing from outside, gets exactly one marker. This is the only test that fails when the count of the answer's own turns misses the text told before a call. The manager's count of erasures is read by an own store from inside its `erase`, and is already 1 there: a push that read the count before the deleting began and writes after it must see the change, so the count may not move after the stores are erased. The rule that keeps a push from writing into an erasure is told in one place, `Manager::erasures`; the other places that touch it point there. Signed-off-by: Yehor Komarov <10210242+geoolekom@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes
A paired phone can now send the computer the chats it started and the turns it wrote in any chat. The agent stores them in its own chat records (source
chat) as turns written elsewhere, with the times and the conversation id the phone gave them. So the computer'schat-listandchat-getshow them, facts are learned from them, and their time is counted, as for the computer's own chats.sync-push-chat. One push is{id, seen, turns}: the phone's conversation id, the time of the last item the phone knows the computer has, and up to 200 turns (role,time,text). The answer is{"ok":true,"format":2,"id","forked","added"}. The command, its limits and its errors are written inagent/src/phone/push.rs:phone_pairing::MAX_LINE; a longer one closes the channel, as for any line the agent does not expect). The phone measures what it writes and splits a long run into pushes that fit, each with theseenof the one before. A turn that is too long for a line of its own is split by the phone into turns of the same role, in order, each a millisecond after the one before, so nothing is cut or left out and the computer's chat holds the parts one after the other;...T...Z(UTC) is{"error":"invalid sync request"};{"error":"time too far ahead"}, so the phone can tell a wrong clock from a wrong shape. The computer stores its own later turns of a chat after the latest turn the chat holds, so a time days ahead would carry them with it; a time within the day is kept, and does that for up to a day. A phone that is behind is not refused;idthat is not a lower case UUID isinvalid chat, aseenthat no item of the chat has isunknown seen(the phone then sends the chat again from its start), and a push during the erasure iserasing.seen, answersadded: 0, whatever was stored after them since. The check does not rely on the store dropping an equal turn.seen, it is left as it is. The agent stores the earlier part plus the phone's turns as a new chat and answers with its id. The id is made from the push, so a resend gives the same fork and not a second one.Manager::erasures, no I/O) and the push compares that count as it starts with the count as it writes. An erasure that began, and even ended, in between makes the push answererasingand store nothing.sync-chatssays where each chat was started (origin:computer,phoneorcontinued). It is kept in a hiddenchat_origincall in the records, which models and the earlier-part builder skip. The turns copied into a fork are stored without telling the fact learner or the activity recorder again, so nothing is counted twice.sync-chatsformat is 2 because the chat items have a new field. The phone code reads the items by key and does not checkformat, so an old phone still reads the answer.Known limits
continuedorigin insync-chats. The titles inchat-listare unchanged.Verification
cargo fmt --check,cargo clippy -p construct-agent -p chat-core --all-targets --locked -- -D warnings,pre-commit run --all-files: clean.cargo test -p construct-agent -p chat-core -p phone-pairing --locked --no-fail-fast: everything passes except timing tests that are not part of this change.a_backoff_is_not_cut_short_by_a_new_promptinagent/tests/manage.rsfails on a cleanmainbuild too (6 of 16 runs under load). Twochat_claudetests (a_silent_claude_is_given_up,a_turn_that_is_dropped_leaves_nothing_running) failed once while the machine was at a load of 6 to 9, and pass alone. All of them pass in CI.agent/tests/phone_chats.rs): a chat the phone started is inchat-listandchat-getwith the phone's id and times; the same turns sent twice add nothing; a turn of the same text at another time is a new turn; a malformed push or a bad id is refused and stores nothing; both sides adding turns gives a fork with the computer's chat unchanged, the same fork on a resend, and nothing hidden in it but where it started.agent/tests/phone_chats.rs).agent/tests/chat_facts.rs).--resumeand a new session id; the turn after it resumes that session; a resend changes nothing (agent/tests/chat_claude.rs).agent/tests/phone.rs).time too far aheadand one before the computer's clock is not; a resend that overlaps the stored turns adds only the new ones; an unknownseenis refused and a resend from the start is stored; two turns of one time do not make the next push a fork; a fork keeps the calls of tools with their results; the model never sees where a chat was started (agent/tests/phone_chats.rs).agent/tests/phone_chats.rs). The manager counts an erasure that got as far as deleting and not one that found the host already erasing (agent/tests/manage_erase.rs). An own store that reads the count from inside itserasefinds it already changed, so the count may not move after the stores are erased (agent/tests/manage_erase.rs).chat-core/tests/intake.rs). Without the count of the text told before a call, that test fails.chat-core/tests/intake.rs): a message is stored only after the work under the intake is done, shown by the first record it stores and not by a pause; an answer that ends by itself gets its marker; a turn of either role stored from outside during an answer leaves it without a marker; and a turn stored right after the look the marker goes by, from a thread that works under the intake, never comes before the marker, which fails if the marker does not hold the intake.