<feed xmlns='http://www.w3.org/2005/Atom'>
<title>superpowers.git/tests/brainstorm-server/server.test.js, branch fix/codex-scripts-in-worktrees</title>
<subtitle>Agentic skills framework and development workflow
</subtitle>
<link rel='alternate' type='text/html' href='https://git.1991861.xyz/superpowers.git/'/>
<entry>
<title>test(brainstorm-server): wait for file events instead of sleeping</title>
<updated>2026-10-21T20:12:44+00:00</updated>
<author>
<name>Jesse Vincent</name>
<email>jesse@fsck.com</email>
</author>
<published>2026-10-21T20:12:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.1991861.xyz/superpowers.git/commit/?id=e8d28a06aa8d1fe7d46057ee804b1e2385e836df'/>
<id>e8d28a06aa8d1fe7d46057ee804b1e2385e836df</id>
<content type='text'>
On macOS, fs.watch (FSEvents) delivered events anywhere from ~100ms to
2.4s after the write on Node 26.10 / Darwin 27, and sometimes held an
event back to deliver it in a batch with a later one. The file-watching
tests slept a fixed 500ms, so they failed when an event came late, and a
late event from one test could trigger a reload or clear state/events
during another. Six tests failed on v7.0.0 and on dev, a different six
each run.

The tests now poll for the outcome with a 5s timeout, wait until the
server logs the exact screen event they caused, and drain in-flight
events with a barrier file before asserting that nothing reloaded or
that state/events survived. 15 consecutive runs pass; dropping the
server's .html/dotfile filter still fails both negative tests.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
On macOS, fs.watch (FSEvents) delivered events anywhere from ~100ms to
2.4s after the write on Node 26.10 / Darwin 27, and sometimes held an
event back to deliver it in a batch with a later one. The file-watching
tests slept a fixed 500ms, so they failed when an event came late, and a
late event from one test could trigger a reload or clear state/events
during another. Six tests failed on v7.0.0 and on dev, a different six
each run.

The tests now poll for the outcome with a 5s timeout, wait until the
server logs the exact screen event they caused, and drain in-flight
events with a barrier file before asserting that nothing reloaded or
that state/events survived. 15 consecutive runs pass; dropping the
server's .html/dotfile filter still fails both negative tests.
</pre>
</div>
</content>
</entry>
<entry>
<title>test(brainstorm-server): stop orphaning the server when a test fails</title>
<updated>2026-09-26T19:32:23+00:00</updated>
<author>
<name>Jesse Vincent</name>
<email>jesse@primeradiant.com</email>
</author>
<published>2026-09-26T19:32:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.1991861.xyz/superpowers.git/commit/?id=bccb109316827b98f7c8676db1140cedbc207394'/>
<id>bccb109316827b98f7c8676db1140cedbc207394</id>
<content type='text'>
process.exit(1) ran inside the try, so the finally that kills the
spawned server never ran. The leftover server held port 3334 and the
next run died with 'preferred port is in use'. Set process.exitCode
instead so teardown runs.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
process.exit(1) ran inside the try, so the finally that kills the
spawned server never ran. The leftover server held port 3334 and the
next run died with 'preferred port is in use'. Set process.exitCode
instead so teardown runs.
</pre>
</div>
</content>
</entry>
<entry>
<title>fix(brainstorming): preserve literal content replacement tokens (#2364)</title>
<updated>2026-09-26T19:28:21+00:00</updated>
<author>
<name>落尘</name>
<email>cuidong111@gmail.com</email>
</author>
<published>2026-09-26T19:28:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.1991861.xyz/superpowers.git/commit/?id=ddd35ab181073c792781bcdfd646d73cf48e4d44'/>
<id>ddd35ab181073c792781bcdfd646d73cf48e4d44</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Add visual companion Prime Radiant branding</title>
<updated>2026-06-16T17:09:47+00:00</updated>
<author>
<name>Drew Ritter</name>
<email>drew@primeradiant.com</email>
</author>
<published>2026-06-15T23:32:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.1991861.xyz/superpowers.git/commit/?id=b3ee712d3a68b604b3f36d872c7ec91501197dcb'/>
<id>b3ee712d3a68b604b3f36d872c7ec91501197dcb</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix server test fallback cleanup</title>
<updated>2026-06-16T17:09:45+00:00</updated>
<author>
<name>Drew Ritter</name>
<email>drew@primeradiant.com</email>
</author>
<published>2026-06-11T01:33:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.1991861.xyz/superpowers.git/commit/?id=85914fbcf89602a966989db673636f391aa355e1'/>
<id>85914fbcf89602a966989db673636f391aa355e1</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Harden root screen containment</title>
<updated>2026-06-16T17:09:45+00:00</updated>
<author>
<name>Drew Ritter</name>
<email>drew@primeradiant.com</email>
</author>
<published>2026-06-11T01:25:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.1991861.xyz/superpowers.git/commit/?id=04106797576d0caa9daecab7d4681d21addfbcf7'/>
<id>04106797576d0caa9daecab7d4681d21addfbcf7</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Harden brainstorm companion auth regressions</title>
<updated>2026-06-16T17:09:45+00:00</updated>
<author>
<name>Drew Ritter</name>
<email>drew@primeradiant.com</email>
</author>
<published>2026-06-10T21:58:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.1991861.xyz/superpowers.git/commit/?id=b17d54f839831b2345aa389e2f65f435f3a82867'/>
<id>b17d54f839831b2345aa389e2f65f435f3a82867</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>fix(brainstorm-server): fix auth-integration bugs from full-branch review</title>
<updated>2026-06-16T17:09:45+00:00</updated>
<author>
<name>Jesse Vincent</name>
<email>jesse@primeradiant.com</email>
</author>
<published>2026-06-10T02:13:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.1991861.xyz/superpowers.git/commit/?id=7fbae0252fe90778ce0c06fde3bf5f87aa396fc2'/>
<id>7fbae0252fe90778ce0c06fde3bf5f87aa396fc2</id>
<content type='text'>
A second adversarial review of the merged branch found that combining the
session-key auth with the feature work created real bugs the (vacuous) tests
missed:

- [Critical] GET /files/ (empty name) resolved to CONTENT_DIR and crashed the
  process with uncaught EISDIR — newly reachable because the query-stripping
  refactor turns /files/?key=... into /files/. Reject non-regular-file names.
- [High] --open opened a KEYLESS url, which the auth gate 403s — the headline
  feature landed on the error page. Open the keyed url.
- [High] Same-port restart regenerated the token (port persisted, token not), so
  the open tab's old cookie 403'd and never reconnected — contradicting the
  documented promise. Persist the token (BRAINSTORM_TOKEN_FILE / .last-token)
  alongside the port.
- [Medium] Token sat in world-readable server-info/server.log (0644 in /tmp).
  umask 077 in start-server.sh + mode 0600 on server-info/.last-token.
- [Medium] touchActivity() ran before the auth check, so unauthenticated requests
  defeated the idle timeout. Count activity only after authorization.
- [Low] COOKIE_NAME embedded the pre-fallback port; derive it from the actual
  bound port (also prevents a cross-server cookie-jar collision on fallback).

Tests added/strengthened (previously passed vacuously): /files/ no-crash; the
auto-open url carries the key and is reachable (200); restart reuses the same key
not just the port; unauthenticated requests don't reset the idle clock.
Full suite green (ws-protocol 32, helper 12, auth 13, server 29, lifecycle 8,
stop-server 4); restart smoke confirms same port+key and old URL -&gt; 200.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A second adversarial review of the merged branch found that combining the
session-key auth with the feature work created real bugs the (vacuous) tests
missed:

- [Critical] GET /files/ (empty name) resolved to CONTENT_DIR and crashed the
  process with uncaught EISDIR — newly reachable because the query-stripping
  refactor turns /files/?key=... into /files/. Reject non-regular-file names.
- [High] --open opened a KEYLESS url, which the auth gate 403s — the headline
  feature landed on the error page. Open the keyed url.
- [High] Same-port restart regenerated the token (port persisted, token not), so
  the open tab's old cookie 403'd and never reconnected — contradicting the
  documented promise. Persist the token (BRAINSTORM_TOKEN_FILE / .last-token)
  alongside the port.
- [Medium] Token sat in world-readable server-info/server.log (0644 in /tmp).
  umask 077 in start-server.sh + mode 0600 on server-info/.last-token.
- [Medium] touchActivity() ran before the auth check, so unauthenticated requests
  defeated the idle timeout. Count activity only after authorization.
- [Low] COOKIE_NAME embedded the pre-fallback port; derive it from the actual
  bound port (also prevents a cross-server cookie-jar collision on fallback).

Tests added/strengthened (previously passed vacuously): /files/ no-crash; the
auto-open url carries the key and is reachable (200); restart reuses the same key
not just the port; unauthenticated requests don't reset the idle clock.
Full suite green (ws-protocol 32, helper 12, auth 13, server 29, lifecycle 8,
stop-server 4); restart smoke confirms same port+key and old URL -&gt; 200.
</pre>
</div>
</content>
</entry>
<entry>
<title>test(brainstorm-server): thread session key through tests after auth merge</title>
<updated>2026-06-16T17:09:45+00:00</updated>
<author>
<name>Jesse Vincent</name>
<email>jesse@primeradiant.com</email>
</author>
<published>2026-06-10T01:33:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.1991861.xyz/superpowers.git/commit/?id=01de36703dcef42c9c5c5eafa840fb6cd8bcb29a'/>
<id>01de36703dcef42c9c5c5eafa840fb6cd8bcb29a</id>
<content type='text'>
Integrating the per-session-key auth onto the same branch as the dotfile and
lifecycle work: two tests added after the auth commit opened WebSockets without a
key (server.test.js dotfile-reload, lifecycle.test.js idle-shutdown), which the
auth gate now resets. Pass ?key=/BRAINSTORM_TOKEN in both. Full suite green:
ws-protocol 32, helper 12, auth 13, server 28, lifecycle 7, stop-server 4.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Integrating the per-session-key auth onto the same branch as the dotfile and
lifecycle work: two tests added after the auth commit opened WebSockets without a
key (server.test.js dotfile-reload, lifecycle.test.js idle-shutdown), which the
auth gate now resets. Pass ?key=/BRAINSTORM_TOKEN in both. Full suite green:
ws-protocol 32, helper 12, auth 13, server 28, lifecycle 7, stop-server 4.</pre>
</div>
</content>
</entry>
<entry>
<title>feat(brainstorm-server): gate every endpoint behind a per-session key</title>
<updated>2026-06-16T17:09:45+00:00</updated>
<author>
<name>Jesse Vincent</name>
<email>jesse@primeradiant.com</email>
</author>
<published>2026-06-09T19:22:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.1991861.xyz/superpowers.git/commit/?id=cb5bb885fd7cf00a1820f20d922df06ec02d4bed'/>
<id>cb5bb885fd7cf00a1820f20d922df06ec02d4bed</id>
<content type='text'>
The companion server is reachable by any local browser tab (default loopback
bind) and by any host that can route to it (remote --host bind). It served
screens, files, and accepted event-injecting WebSocket connections with no
authentication, so a malicious browser tab or a direct remote client could read
brainstorm content or inject events that the agent reads as the user's input
(prompt injection into a live session).

Generate a per-session secret token, carry it in the served URL as ?key=, and
mirror it into an HttpOnly SameSite=Strict per-port cookie on first load so
same-origin subresources and the WebSocket handshake authenticate automatically.
Every HTTP request and WebSocket upgrade now requires a valid key (query or
cookie, constant-time compared); unauthenticated requests get a friendly 403
explaining they need the full URL. A secret authenticates the client uniformly
across loopback, tunnel, and remote binds and defeats DNS rebinding, which a
Host/Origin allowlist cannot.

Also guard handleMessage against a null JSON payload that crashed the process.

Tests: new auth.test.js (13 cases) covering the key on /, /files/*, and WS plus
cookie bootstrap and the null-payload guard; server.test.js threads the key;
ws-protocol.test.js + auth.test.js wired into npm test.

Closes #1014
Refs #1110, #1553, #1504
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The companion server is reachable by any local browser tab (default loopback
bind) and by any host that can route to it (remote --host bind). It served
screens, files, and accepted event-injecting WebSocket connections with no
authentication, so a malicious browser tab or a direct remote client could read
brainstorm content or inject events that the agent reads as the user's input
(prompt injection into a live session).

Generate a per-session secret token, carry it in the served URL as ?key=, and
mirror it into an HttpOnly SameSite=Strict per-port cookie on first load so
same-origin subresources and the WebSocket handshake authenticate automatically.
Every HTTP request and WebSocket upgrade now requires a valid key (query or
cookie, constant-time compared); unauthenticated requests get a friendly 403
explaining they need the full URL. A secret authenticates the client uniformly
across loopback, tunnel, and remote binds and defeats DNS rebinding, which a
Host/Origin allowlist cannot.

Also guard handleMessage against a null JSON payload that crashed the process.

Tests: new auth.test.js (13 cases) covering the key on /, /files/*, and WS plus
cookie bootstrap and the null-payload guard; server.test.js threads the key;
ws-protocol.test.js + auth.test.js wired into npm test.

Closes #1014
Refs #1110, #1553, #1504
</pre>
</div>
</content>
</entry>
</feed>
