Repository navigation
Conversation
… take topics and a digest (#537) The commons is a lookout source of Sonny's own. Posting or replying subscribes the poster (bound to its bot ID), and the agent can unsubscribe. Any source can carry topics (NAME:TOPIC) and a digest; the commons digest is [sonny] commons_digest, 1h by default. Attach notes are gone: paid invite holders are woken by tell() and left out of the source note. Untold events and the in-flight batch are held in STORE.sources/.held/BOT.json (owner-only), written off the event loop; a replayed batch the daemon already took still starts the digest. Agents that posted earlier are subscribed once by upgrade::once, which stays retryable on any read or listing failure. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGEfzPDBTQPwZUKy2bJ
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: 30845baff3
ℹ️ 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".
| if let Some(topic) = &event.topic { | ||
| what.push_str(&format!(":{topic}")); |
There was a problem hiding this comment.
Quote untrusted topics before inserting them into source notes
When a source supplies a topic containing an embedded newline, this interpolation inserts it verbatim into the model prompt, outside the JSON quoting used for the event's text and author. Event::parse rejects colons in topics but permits newlines, and the commons reader also accepts arbitrary .jsonl filenames without applying valid_name, so a crafted topic or commons filename can inject additional prompt lines. This defeats the note's intended quoted-as-data boundary. JSON-quote topics when rendering them, and validate commons thread names when reading files rather than relying solely on validation in the posting tool.
Useful? React with 👍 / 👎.
| if std::fs::write(&partial, Value::Object(read).to_string()).is_ok() { | ||
| let _ = std::fs::rename(&partial, &path); |
There was a problem hiding this comment.
Persist pending notifications before advancing the commons cursor
If the lookout stops after this rename but before the subscriber's held events are written, the corresponding commons notifications are permanently lost. news advances read.json before returning the events; own subsequently sends them through an in-memory channel, and subscribers persist them only on a later tick through another asynchronous writer. On restart, the advanced cursor skips those posts even though no durable pending notification exists. Persist an outbox before advancing the cursor, or acknowledge cursor progress only after the notifications have been durably recorded.
Useful? React with 👍 / 👎.
A source's topic goes into the agent's note unquoted, after the source's name, and Event::parse let line breaks through, so an event could add lines of its own outside the quoted text. A topic now holds no control characters, and the commons reads only threads whose file names it could have made (valid_name), as its listing already did. Found by the Codex code review on the security-review-only PR #585 (#531). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGCrVNEpqFFEqPCMbC2
…, note topics (#587) * Read zen focus files only when plain, small and not a link Sandboxed agents may write ~/.agent/sonny/zen so `sonny zen` works from their shell, and Sonny reads every focus on its UI loop. A focus replaced by a FIFO, or a link to /dev/zero, would hold the window (and any other window that asks). focus_in now opens with O_NOFOLLOW | O_NONBLOCK, reads only a regular file, and at most 16 KiB. Found by the Codex code review on the security-review-only PR #578 (#531). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGCrVNEpqFFEqPCMbC2 * Keep the agent's home read-only for bots whose folder holds it A workspace-write bot whose folder contains ~/.agent (Sonny opened in HOME) could rewrite the scheduler's job definitions, which run outside the sandbox, or the settings that say how every bot is sandboxed. The CLI now starts the daemon with ~/.agent as a protected path, as Codex keeps ~/.codex: read-only in any root that holds it, writable only where a bot is given a folder in it by name (Sonny's zen folder). Bots in any other folder already could not write there, so nothing they do changes. Found by the Codex code review on the security-review-only PR #579 (#531). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGCrVNEpqFFEqPCMbC2 * Keep line breaks and stray commons names out of a note's topic A source's topic goes into the agent's note unquoted, after the source's name, and Event::parse let line breaks through, so an event could add lines of its own outside the quoted text. A topic now holds no control characters, and the commons reads only threads whose file names it could have made (valid_name), as its listing already did. Found by the Codex code review on the security-review-only PR #585 (#531). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGCrVNEpqFFEqPCMbC2 --------- Co-authored-by: Claude <[email protected]>
… it (#592) The commons source advanced read.json before the events it read reached any subscriber's held file, so a crash in between lost those posts (#589, from the #585 review). news() now returns the lines and the cursor it would write; the source sends them, asks the lookout whether every subscriber holds them on disk, and marks them read only on yes. The lookout writes what it holds at once for the question and answers when the writer is done; the writer keeps failed writes and tries them again, answering no while any is unwritten. Read again after a crash, an event a subscriber already holds is not held twice. Crash-injection tests abort a child process at four steps (read, in memory, on disk before the cursor, after the cursor) and check that a restarted lookout holds each post exactly once. Claude-Session: https://claude.ai/code/session_013jkdGG8Kwbo2wyYcT9yURQ Co-authored-by: Claude <[email protected]>
Do not merge. This PR exists only so Codex runs a security review over what #537 landed (tracked in #531). Its open-time review covered
5ca89b7, but later commits went unreviewed. The base is the commit before #537 merged (30845ba^) and the head is the merge commit30845ba. Once findings are fixed on main or filed, this PR gets closed and bothsecurity-review/537*branches are deleted.What to look at:
~/.agents/commons, which any agent writes. It turns posts into source notes that start other agents' turns. Check that a crafted thread or post can't name another agent, forgetold, or escape thefrom/topicfields into the prompt.STORE.sources/.held/BOT.json.upgrade::oncemigration writes subscriptions into each poster'sSTORE.lookout/BOT.json.