Skip to content

Sonny's promises out of the box: Mermaid and math in QuickJS, bubblewrap on Linux, a name-scan test - #488

Merged
lydakis merged 6 commits into
mainfrom
claude/project-thread-2xth8y
Oct 31, 2026
Merged

lydakis merged 6 commits into
mainfrom
claude/project-thread-2xth8y

Conversation

@lydakis

@lydakis lydakis commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner

Three gaps from the Sonny-vs-person audit, where Sonny promised something on first run that the install didn't bring.

Mermaid and math drawn by Sonny's own QuickJS

sonny/src/js.rs spawned node or bun per picture, and neither the formula nor install.sh installs them, so on a clean machine every diagram said "needs node or bun on PATH". Now each vendored bundle (Pele, MathJax) is a js::Engine: rquickjs (already linked for exec) on its own thread, loaded once on the first picture that needs it, then reused, so later pictures only render (0.5 to 35 ms in the bench, against 88 to 146 ms for a cold load). It works from any thread and keeps one copy of each bundle per process.

  • The five-second limit is now an interrupt handler on the runtime, so nothing has to be killed. A job that fails (a throw, out of time, out of memory) drops the engine, and the next job loads the bundle again in case it was left half-changed.
  • I left bytecode out. With a long-lived context the parse happens once per process, and precompiling would put rquickjs in a build script.
  • The drawing tests no longer skip when node is missing, and two new js::tests cover reuse, reloading after a failure, and the time limit. FEATURES.md row updated.

bubblewrap (and ripgrep) on Linux

  • install.sh installs whichever of bubblewrap and ripgrep is missing with apt, dnf, pacman, zypper or apk (through sudo when not root, retrying apt after an apt-get update on fresh images). When it can't, it prints what to install. SONNY_PACKAGES=0 leaves the system's packages alone. I checked this on Ubuntu 24.04, where it installed bubblewrap 0.9.0. README updated.
  • Homebrew on Linux (George picked this approach in the thread): the agent formula gets on_linux do depends_on "bubblewrap" end and sets AGENT_BWRAP to that bubblewrap's opt_bin/bwrap at build time. The daemon (src/sandbox.rs) checks that build-time path first, then the system folders. It still never searches PATH, so a sandboxed command can't plant a bwrap. The precedent is Flatpak's --with-system-bubblewrap. Without this change, Linuxbrew's bwrap sits under its own prefix and the daemon would never find it. The rendered formula passes ruby -c, and the formula tests cover it. docs/RUST_PROTOTYPE.md updated.

A name-scan test for shipped skills and roles

sonny/tests/shipped_text_names_no_service.rs works like tests/daemon_knows_no_client.rs, one layer up. It fails when anything in sonny/skills or sonny/agents names a service (GitHub, Slack, Linear, Google, S3, …), a host (*.com, .io, .dev, .ai, …) or a web address. The SVG namespace is allowed, and file names like setup.sh don't count. Main passes it today. The rule is also in AGENTS.md.

🤖 Generated with Claude Code

The vendored Pele and MathJax bundles ran in a node or bun process per
picture, which neither the formula nor install.sh installs. Each bundle
now loads once, on the first picture that needs it, into a QuickJS engine
on its own thread (rquickjs, already linked for exec); later pictures
only render. An interrupt handler keeps the five-second limit, and an
engine whose job failed is loaded again for the next.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGG8fnU69QW3VW23RGg
Like tests/daemon_knows_no_client.rs one layer up: what Sonny ships for
its agents names nothing of the person's world (services, hosts, web
addresses); the person brings those through memory, their own skills,
MCP and the lookout.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGG8fnU69QW3VW23RGg
…manager

The daemon's default sandbox runs commands in bubblewrap and Sonny's
agents search code with ripgrep; the Homebrew formula brings ripgrep, but
a tarball install brought neither. install.sh now installs what is
missing with apt, dnf, pacman, zypper or apk (through sudo when not
root), says what to install when it cannot, and SONNY_PACKAGES=0 leaves
the system alone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGG8fnU69QW3VW23RGg
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-31T04:34:43.772186Z da65139 New commits
🔒 Security Review ✅ Completed 2026-10-31T04:37:43.199696Z da65139 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@lydakis lydakis self-assigned this Oct 31, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b5c82b70a2

ℹ️ 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".

Comment thread sonny/src/js.rs Resolved
Comment thread sonny/src/math.rs Resolved
… its path in

The daemon looks for bwrap only in system folders, never on PATH, so a
Linuxbrew bubblewrap under its own prefix was never found. A build may now
fix one more place with AGENT_BWRAP, as Flatpak's --with-system-bubblewrap
does, and the agent formula sets it to its bubblewrap's opt path on Linux.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGG8fnU69QW3VW23RGg
@lydakis lydakis changed the title Sonny: Mermaid and math in its own QuickJS, install.sh brings bubblewrap, a name-scan test for shipped text Sonny's promises out of the box: Mermaid and math in QuickJS, bubblewrap on Linux, a name-scan test Oct 31, 2026
…'s stack

A persistent engine kept what a process per picture threw away: each
formula made a TeX input and registered a handler that MathJax keeps for
good, so the heap grew about 70 MB per thousand formulas. The entry now
makes one adaptor, handler and document, as MathJax's server examples do,
and resets tags per formula as MathJax.texReset() does (bundle rebuilt
with esbuild 0.24.2, which reproduces the old bundle byte for byte from
the old entry). A thousand formulas now hold the heap flat at 14 MB.

The engine's thread gets twice the stack QuickJS may use, so recursion
that never ends throws instead of overflowing the thread and ending Sonny.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGG8fnU69QW3VW23RGg
@lydakis
lydakis merged commit 5de88ab into main Oct 31, 2026
5 checks passed
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.

2 participants