Repository navigation
release: 0.8.19 - #227
Open
philbert440 wants to merge 13 commits into
Open
release: 0.8.19#227philbert440 wants to merge 13 commits into
philbert440 wants to merge 13 commits into
Conversation
…gateway (#223) * feat(gateway): record the bound address in the state dir while serving A running gateway writes gateway.json (pid, state dir, host, port, tls) beside local-owner.token and removes it on a clean stop, so other rh processes can find a gateway that bound a port the config does not name. * feat(cli): find the gateway from --gateway, RIVETHUB_GATEWAY_URL, or the running record Precedence is --gateway, then RIVETHUB_GATEWAY_URL, then the runtime record of a live gateway on this state directory, then the config. rh local --ensure keeps resolving from config alone. The owner token goes only to a loopback URL. memory ingest-bundle and receive take --gateway. * feat(capture): let memory.capture.gateway omit ca for a publicly trusted server * test(cli): satisfy the workspace lints in the gateway lookup tests * refactor(cli): move gateway target resolution out of status and drop comments Splits status.rs under the size ceiling into gateway_target.rs, removes the doc comments the branch added, and makes the gateway runtime record read log each failure instead of swallowing it. * fix(cli): let an explicit gateway beat memory.capture.gateway, refuse query and fragment URLs, treat pid 0 as dead * fix(cli): refuse a bad --gateway before queueing, and queue explicit imports apart An explicit gateway that fails to resolve now stops the import instead of spooling the batch for a later replay to the default gateway, and an explicit import spools in a directory of its own, so it never replays batches queued for the configured capture gateway. * fix(cli): key an explicit gateway's queue by its normalized URL and show it in rh capture spool
* feat: trust share bundles by key and receive a drop from this node's own drop box Trust matches the signing key, so one trust entry covers a sender whatever author name the bundle carries. rh memory receive takes a drop straight from this node's drop box with the store's once-only claim, falls back to this node's gateway when the CLI cannot use the root, and --from fetches from another address. * fix(cli): pass the gateway lookup mode to the local drop fallback, and expect the first trust label
rh memory bundle takes --owner (repeatable) or --all-owners, and --since, --until and --limit over conversation last activity, so a store that holds sessions under more than one owner id can be shared. A named session owned by someone else is refused with that owner's name.
…gned-in member (#226) rh memory share <bundle> --hub <name|host> pushes a sanitized bundle into the member's own memory on a hub this machine is signed in to, with no share code to receive. A memory:import token scope allows only that push and GET /api/me, which now reports the token's scopes and whether drops are on. rh share status --server checks a destination before anything is sent, upload and push errors say what was refused, and the share desk can push a draft to a hub.
philbert440
force-pushed
the
release/0.8.19-rc
branch
from
November 25, 2026 02:24
6711bea to
5486382
Compare
…221) * fix(security): harden RLS, taxonomy auth, proxy, and release signing * fix(memory-postgres): require schema 85 so serving waits for the RLS write hardening Migration 0085 added the write policies but SCHEMA_VERSION stayed at 84, so a runtime would serve a database that lacked them. The memory transfer test now checks against SCHEMA_VERSION, so the next migration that lands without a bump fails it. * ci: allow the CodeQL config and release signing script in the language gate * fix(security): gate unsigned releases behind REQUIRE_SIGNED_RELEASES Pin the 2026-main release public key in crates/gateway/release-keys and decode it at compile time. The signer requires an Ed25519 key whose public half matches that pin, and warns with the switch name when no key is set. REQUIRE_SIGNED_RELEASES (false for now) decides whether a release without a .sig is refused. A present signature must verify in both modes, and a duplicate, oversized, or non-UTF-8 .sig counts as a signature failure. Web discovery reads manifests newest first and checks the signature only on the release it would select, failing closed there without falling back.
… store reads (#222) rh harness connect and disconnect hermes --recall edit ~/.hermes/config.yaml through a text-level editor that re-parses the result and writes nothing unless the document equals the original plus exactly the intended change. The MCP entry sources the rh env file in a bash wrapper, so the Postgres password stays out of config.yaml. A harness rh has no store reader for now says so.
…hub (#228) * test(memory-postgres): entity pages in a shared store keep their owner's wiki home In a store that holds sessions of two people, an entity page that the entity builder writes has no owner, scope or local slug. The topic-page sync for the owner then fails with the row-level security error that stopped the hourly sweep on a shared hub. * fix(memory-postgres): write entity pages into the entity owner's wiki scope write_page stored entity pages with no home, so the insert trigger had to guess the owner. A store with sessions of more than one person has no single owner to guess, and the page row got a NULL owner. The topic-page sweep then failed on it under the owner's scope. The entity lease and publish now resolve the entity topic's wiki scope with topic_scope and the store's primary wiki owner, as the wiki builder does. The page row gets that scope, local slug and owner, and the page file goes into the scope's directory. An entity topic with no scope fails the job with a clear error. * test(rivethub): one failing topic stops the whole topic-page sweep A topic whose page slug is held by another person's row fails its sync under the owner's scope. The sweep job then fails on that topic and the other topics are not synced. * fix(workers): give a topic that fails the page sweep its own sync job sync_topic_page stopped the sweep at the first topic that failed, so one bad row stopped every topic-page sync on the store. The flagged job had an empty payload and did not name the topic. The sweep now syncs every topic and returns each failure as a SweepFailure. The worker logs each failure with the topic id and queues that topic's own sync-topic-page job. That job retries with backoff and, if it keeps failing, goes to the flagged jobs, where retry-failed can run it again. The sweep job itself then completes. An owner whose scope or listing fails no longer stops the sweep for the other owners. The job still fails after the loop so that the error is recorded. Cancellation still stops the sweep at once. * test(testkit): backfill skips legacy leaves of a session that waits for conversion The entity and wiki backfills select the legacy leaves of a session whose historical summary conversion has not finished. Conversion replaces those leaves, so the model work on them is lost. * fix(memory): hold back legacy-leaf backfill until the session's conversion completes The entity and wiki backfill queries now skip a legacy leaf when its conversation has a conversion item in a state other than complete. Released delivery anchors are still selected, so new-format summaries keep flowing during the conversion. Postgres and SQLite get the same change. The conversion items table has its primary key on conversation_id, so the check uses an index. * test(memory-postgres): entity writes and merges land on another topic's page The entity builder writes a page under the entity topic's slug, not under the page that is bound to the topic. An entity bound to phil-memory-2 overwrites the phil-memory page and takes its binding. A coco entity whose slug is phil overwrites phil's page. A merge of two coco entities binds the survivor to phil's page with the same slug and deletes phil's page with the absorbed entity's slug. A new coco entity page also gets the bare slug as its key, not a key in coco's scope. * fix(memory-postgres): write entity pages under the key the topic owns The entity builder wrote and read an entity page under the topic's slug. A topic bound to a page under another key got a second page, and a slug that matched another topic's or another person's page overwrote that page and took its binding. An entity merge had the same problem: it bound the survivor to the page with its slug, inserted a page with no scope, and deleted the page with the absorbed slug. The entity builder now resolves the page key in the entity owner's wiki scope. A page bound to the topic keeps its key. If that page is outside the owner's scope, the job fails. An unbound topic gets the scope's key for its slug, or for slug-2 through slug-9. The builder does not take a key whose page is bound to another topic, is owned by another person, is in another scope, or has the slug of a topic that is not an entity. The key is locked like other wiki writes before it is checked. The page file uses the key's local slug in the scope's directory. Merges use the same keys for both pages, and the survivor's new page row gets its scope and local slug. * test(rivethub): the topic-page sweep queues a flagged topic again A topic whose sync-topic-page job is in the flagged jobs, open or dismissed, gets a new sync job from each sweep. The new job fails, the topic is flagged again and a dismissed flag opens again. * fix(workers): leave a flagged topic out of the topic-page sweep retries The sweep queued a sync-topic-page job for each topic that failed, also when that job key was already in the flagged jobs. The new job failed, the key was flagged again at once and a dismissed flag opened again. A bad topic failed once an hour and Dismiss did not stay. FlaggedJobs has holds_key, which is true while a flagged row with that job key exists, open or dismissed. The sweep reads it as maintenance and only logs a failing topic whose key is flagged. Retry removes the flagged row, so a retried topic gets queued again if it fails again. * fix(memory-postgres): move a legacy entity page into its owner's wiki Entity pages that the old publisher wrote have no scope. The page-key resolver rejected a bound page with no scope unless the entity's home was the root wiki and the row's owner matched. An entity of a second person, or one whose legacy row had no owner, therefore failed on every rewrite and merge. A bound page with no scope now moves into the entity's home scope under the same key: the row gets the scope, owner, visibility and local slug. If another page in that scope already has the local slug, the page takes slug-2 through slug-9. A merge reads the absorbed page's file location before the move, so it removes the legacy file from the primary wiki and not a file in the new scope. * fix(memory-postgres): keep entity pages in the owner's private wiki topic_scope put an entity page in the wiki of the topic's visibility. A shared entity therefore had its page row and file in the space wiki, while the prose and facts on it can come from the owner's private sessions. Space members could read that material. On the release branch the topic-page sweep already created shared entity rows in the space, and the entity builder then wrote prose into them. topic_scope now gives an entity topic its owner's private scope, for the entity builder and the topic-page sweep alike. A bound entity page in a space scope moves into the owner's private scope on the next write, the same way a legacy page does. * fix(memory): report the page key an entity write used The entity builder recorded the topic slug as the stored page, also when the page lives under a prefixed or numbered key. The worker then queued the embedding for the slug, so it embedded another page or none. Postgres publish and apply now return the key that write_page resolved. EntityLease gains page_slug, which returns the bound page key on Postgres and the topic slug elsewhere. The worker uses it for mention notes and for sessions that were already applied, and skips the page when the entity has no bound page. * fix(memory): queue a swept topic's sync only when its key is free The sweep checked holds_key and then enqueued the topic's own sync-topic-page job in replace mode. A job could be flagged between the two calls, and replace mode took the key and the remaining attempts from a targeted job that was running. FlaggedJobs::holds_key becomes queue_unless_flagged. On Postgres it adds the job with unsafe_dedupe only if the key is not flagged, then checks the ledger again in the same transaction and rolls back if a flag landed in between. A queued or running job with the key is left as it is. SQLite does the check and the insert in one immediate transaction. The sweep no longer needs the job queue. * test(memory-postgres): moving an entity page writes into another owner's page The entity builder moves a bound page that is in a space or has no scope into the entity owner's private wiki. These tests show what the move does to pages it does not own: - A space page moved to the root wiki overwrites the file of another owner's unscoped page with the same name. That owner then reads the private note through their own row. - A legacy page owned by another person, or by nobody, is moved into the entity and its prose is read into the rewrite. - The prose read before a rewrite moves the binding and commits, so a failed rewrite leaves the row pointing at a file that does not exist. - A space page with a real file is moved and its file stays in the space. - A merge adopts an absorbed legacy page that has no owner. * fix(memory-postgres): leave an entity page outside its owner's wiki where it is Moving an entity page into the owner's private wiki was not safe. The move checked only rows in the target scope, so it could take the file of another owner's unscoped page. It adopted any page with no scope, whoever owned it, and read that page's prose. It ran in the prose read and committed before the new file existed. It left the old file in the space. The entity builder no longer moves pages. A bound page is used only when it is in the owner's scope, or has no scope while the owner's wiki is the root wiki, and the row's owner is the entity owner. A page with no scope in the root wiki has the same file either way, so legacy pages on single-person stores keep working. Any other bound page fails the entity with SlugTaken before its prose is read. The rest of the session continues, and the page row and file stay as they are. A merge with such a page fails and keeps both entities. * fix(memory-postgres): keep private entity prose out of a page shared to a space
The private half of the earlier 2026-main pin was never found, and no release or update manifest was ever signed with it. This pins the public half of the key now held in the release-signing environment, so 0.8.19 ships signed.
* fix(cli): keep the receive drop-box probe on this node and fall back past it rh memory receive asked "this node's drop box" through the gateway URL from --gateway or RIVETHUB_GATEWAY_URL, so the drop id went to whatever server that named, outside the share allowed list. The probe now locates the gateway from the config and the live runtime record only (Locate::ThisNode). A stopped local gateway, a 401, or a 404 on that probe now means the drop is not here, and the receive continues to the embedded or --from server instead of failing. The download is announced only once a server answers with the drop, so a skipped probe no longer prints "downloading from this node's drop box". * fix(rivethub): answer a refused desk push with 422 and its reason A desk push the second scan refused (prompt-injection or secret shapes), or that the share rules refused (a raw bundle, withheld or unconfirmed flags), mapped to DeskError::Failed and answered HTTP 500 with "sharing failed; the rh log names the cause". Those refusals now map to DeskError::Refused, which the share API answers with 422, reason invalid, and the refusal text that says what to redact. The desk error mapping moves to its own module to keep desk.rs under the file ceiling. * fix(cli): never discard a claimed drop before its body is saved A successful GET consumes the one-time drop. The old save step then wrote the progress line and opened a second inbox tempfile, so a broken stderr pipe or a failed open dropped the response and lost the drop. The receive now clones the inbox partial opened before the claim and streams the body into it. The progress callback returns nothing, so reporting progress can no longer fail a receive on any path. * fix(cli): fall back past the local gateway only when it refuses connections reqwest's is_connect also matches TLS handshake failures, so a running local gateway with a rejected certificate was silently skipped and the drop fetched from the embedded server. Only connection refused, found in the error source chain, now means no gateway is here; TLS and other connect errors fail the receive.
row_runs_rh treated any row whose command text contained rh mcp as the RivetHub entry. It now reuses McpServer::runs_rh_mcp, the matcher #222 added for Hermes.
#240) A failed sync or noclobber persist dropped the tempfile and lost a drop the server had already consumed. The bytes now persist as <slot>.rcv, synced with the inbox directory, and the error names the path and says if durability could not be confirmed. Receive opens the kept .age first and falls back to the .rcv copy when the primary is unreadable or fails the share code's key check, keeping both files until one opens. Only a copy that opened is promoted, with a hard link so an existing .age is never replaced, and prune treats a file another receive already removed as nothing to do. Fixes #237
…age (#236) * fix(memory): stop the topic-page sweep from blanking a fresh entity page The sweep checked page_taken without a lock and then wrote an empty page with save_topic_page. When the entity builder wrote and bound the page between the two calls, the sweep wrote the empty page over the entity's file and row. Under a scoped key such as coco-box, the sweep still wrote the empty page to the same file and then failed on rh_wiki_topics_scope_local. TopicPageStore gains create_topic_page, which writes only to a vacant key. Postgres checks for vacancy after it takes the repository lock and the slug lock. The key is vacant when no row or redirect holds it, no row in the same scope uses the same local file, and the topic is not bound to a page. SQLite runs the same check inside its immediate transaction. The sweep creates entity and work pages with this method. If the write is refused, the sweep uses the page the topic is now bound to. Fixes #230 * fix(memory): try the next page slug when a work page create is refused The sweep picked a free slug with page_taken and then called create_topic_page once. page_taken checks only the page key. In Postgres, create_topic_page also refuses when a row in the same wiki scope uses the slug as its file name, such as coco-mesh with the local name mesh. The sweep then failed with SlugConflict, and every retry picked the same slug, so the work topic never got a page. The sweep now calls create_topic_page inside the slug loop. When the create is refused and the topic is still unbound, the sweep tries the next numbered slug. * fix(memory): keep numbered page slugs within the slug length limit A work topic whose slug is already 80 characters got the numbered slug <slug>-2 when its first slug was taken. The wiki repository normalizes every slug it reads or writes to 80 characters, so <slug>-2 resolved to the file of the page that already held <slug>. The sweep then wrote an empty page over that file. SQLite also wrote the empty page over that page's row. Numbered slugs now shorten the base to leave room for the suffix, the same way the normalizer shortens a slug, so a numbered slug normalizes to itself. create_topic_page also refuses when the page file it resolves to already exists, whether or not a row points at it. The sweep then moves on to the next numbered slug. * fix(memory): check page key vacancy across every owner The topic-page sweep runs under the topic owner's scope, and row-level security hides other owners' pages from that scope. When another owner already held the key, the vacancy check in create_topic_page passed. The sweep wrote the page file and then failed on the row upsert with a row-level security error. The vacancy query now runs in a savepoint that turns on maintenance scope, so it sees every owner's keys. The query returns only a boolean. Rolling back the savepoint restores the caller's scope before the page is written. A refused create moves the sweep on to the next numbered slug. * fix(memory): refuse a page create when the wiki pull brings in its file create_topic_page checked that the page file did not exist and then called fold, which runs git pull --rebase before it writes. When the pull brought in a teammate's file at that path, the create wrote the empty page over it and committed. LockedRepository gains create. It pulls, checks for the file after the pull, and writes and commits only when the file is still absent. The Postgres and SQLite creates use it and refuse when it finds the file, so the sweep moves on to the next numbered slug. * fix(memory): write the page row before committing its file A Postgres person login is pinned to one person, and rh_scope_maintenance ignores the maintenance setting there, so the vacancy probe cannot see another owner's page. On such a login, for example a gateway topic page edit that creates the page, a hidden key looked vacant. save_locked committed the wiki file and then failed on the row upsert, leaving a committed file with no row. save_locked now writes the row before it writes the file. A create inserts the row with ON CONFLICT DO NOTHING, which sees conflicts on every unique key whatever the login can read, and refuses when the insert finds one, so the sweep moves on to the next numbered slug. An overwrite upserts the row first. The topic binding updates also run before the file write. After the commit, the row is stored again with the folded page and its git SHA. * fix(memory): reserve the page row without its unbounded article save_locked upserts the page row before the writer folds the page, so that a refused row fails before the git commit. The overwrite path used topics::store for that upsert, which writes the article as the caller passed it, before the writer bounds it and archives the rest. The generated content_tsv column is computed from search_text, so a sweep that retitled a page with a large article could fail PostgreSQL's 1 MB tsvector limit before the archive step ran. The overwrite reservation now writes only the row metadata: key, title, scope, local slug, owner and visibility. On a conflict it updates the title and updated_at and leaves the stored article and search text alone. The create claim already wrote metadata only, and both now share one insert. The bounded page is stored after the write, as before. * test(cli): replay each recorded summary into its own wiki wiki_replays_every_recorded_summary_shape deleted the page rows between replayed summaries but kept the wiki directory. Each later summary started with the previous summary's acmekit-deploys page file and no row for it. The topic-page sweep now refuses to create a page over a file that no row owns, so the topic took acmekit-deploys-2. Each replayed summary now gets a fresh wiki directory, so the files match the emptied page rows. The assertions are unchanged. * test(rivethub): fail a sweep topic by holding every slug it can try Two hub sweep tests made a topic's sync fail by having another person's row hold its page slug. The sweep now checks vacancy across every owner and moves a refused create on to the next numbered slug, so that topic gets a page and no longer fails. The tests then found no sync job of its own for the topic. The fixture now has the topic owner's own rows hold the base slug and every numbered slug up to SLUG_ATTEMPTS, which the kernel now exports. The sweep skips each held slug and fails the topic with SlugConflict, which is the failure the tests need. The assertions are unchanged.
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.
Collects the work for 0.8.19. Merge only when the user says to.
Merged so far
Find the running gateway from a runtime record, env, or --gateway #223 The CLI finds the running gateway from
--gateway, thenRIVETHUB_GATEWAY_URL, then<state_dir>/gateway.json, then the config. A gateway started withrh local --port <port>is found without editing the config.memory.capture.gateway.cais optional.feat: trust by key and receive from the node's own drop box #224 Share bundles are trusted by signing key.
rh memory receivetakes a drop straight from this node's own drop box, under the store's once-only claim and a cross-process lock, and falls back to this node's gateway.--from <host[:port]>fetches from another address.feat(cli): select bundle owners, window and limit #225
rh memory bundle --owner/--all-owners/--since/--until/--limit. A session owned by another owner is refused with that owner's name.feat(cli): push session bundles straight to a connected hub as the signed-in member #226
rh memory share <bundle> --hub <name|host>pushes a sanitized bundle into the member's own memory on a connected hub. Adds thememory:importtoken scope, scopes and drops status inGET /api/me, therh share status --serverpreflight, and desk push to a hub.fix(security): harden RLS, taxonomy auth, proxy, and release signing #221 Migration 0085 limits writes to topic aliases, decisions, entity facts, redirects and summary sources to maintenance scope or the parent row's owner (schema 85). Taxonomy writes require the owner. The plugin proxy caps sizes and strips risky upstream headers. Releases get provenance attestation and an Ed25519 signature on
SHA256SUMS, checked against a pinned key. A present signature must verify.REQUIRE_SIGNED_RELEASESstays off until a signing key exists.feat(capture): connect Hermes recall in config.yaml and stop claiming store reads #222
rh harness connect/disconnect hermes --recalledits~/.hermes/config.yamlwith a verified text-level editor, keeps the Postgres password out of it, and refuses configs that use YAML merge keys.fix(memory): keep entity and topic-page backfill running on a shared hub #228 Entity pages are written under their owner's private wiki scope and the page they are bound to, so a second person's entities no longer overwrite or duplicate another person's page, and private prose never lands in a space-visible page. A failing topic in the topic-page sweep is flagged on its own while the sweep continues. Backfill skips legacy leaves during summary conversion.
Upgrade notes
SlugTaken, rather than guessing whose they are. Assign each such row'sowner_user_idandscopeto the right person to bring it back into the entity builder.Known issues found during review and left for later: #229, #230, #231.
The docs for these are in Rivethub/rivethub-dev#9, a draft until this ships.