November 4, 2026
13 pull requests merged across 2 repos
Offline-Protocol/offline-protocol-sdk
Why
#685 made every node send a __MEMBER__ hello to every neighbour it discovers, every five minutes. No released build reserves that prefix. A v0.31.0 receiver:
- rejects the frame as plaintext and emits a SecurityWarning to its app under the default policy (
requireEncryption: true); - shows it to the user as a text message reading
__MEMBER__…whenrequireEncryptionis off.
Apps in the field ship v0.31.0 and earlier, so the next release cannot carry this. Nothing reads visibility yet and no binding exposes it, so reverting loses nothing shippable.
What
- Reverted (engine half of #685): the exchange module and its tests, the discovery hook,
ProtocolConfig.app_publisher_key,set_app_membership, the FFI test helper, andhkdf/hmacback to optional behindfile-store. - Kept (#684 and its review fixes):
__MEMBER__stays reserved and is consumed on receipt. The sealed layouts, the vectors, theoffline-app-member-e2e-key-v1label and the spec text stay. - ADR 0037 stays Proposed, now marked parked, with the review's reasons and four conditions for picking it up again.
- Spec: a sender MUST know the neighbour reserves
__MEMBER__, from a key-package capability, before sending it. - Test:
discovering_a_neighbour_sends_no_membership_framefails if discovery puts a membership frame on the air. Negative-controlled by injecting one.
Stack
PRs #687 to #695 are built on the reverted code and are parked with the ADR.
Verified locally
cargo clippy --workspace -- -D warningsand--no-default-featuresonoffline-protocolcargo test --workspace --lib --no-fail-fast: engine 2173, FFI 317 and sealed 102 tests pass. The one failure isno_shipped_file_names_a_relay, which reads stale.claude/worktreeson this machine only.RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps,cargo fmt --all -- --check
Two review items left over from #683, both in the Android module under bindings/react-native/android.
1. A start that throws after the bind stranded the listener
WifiDirectManager.startUnsafe binds the peer-stream listener before it moves to STARTING, but the socket only reaches serverSocket in startServerSocket. If anything threw in between (a state listener, the receiver registration, peer discovery), serverSocket was still null, so stopUnsafe had nothing to close.
Failure prevented: the stranded socket held the group port (8988) for the life of the process. Every later start in that process landed on an ephemeral port with canOwn = false, so the device never formed a Wi-Fi Direct group again until the app was killed. The failed start also stayed in STARTING with its channel, receiver and discovery up.
Fix: everything after the bind moves into startBound(p2p, listener), and startUnsafe wraps the call. On a throw it closes the listener, runs stopUnsafe() (which accepts STARTING and undoes the channel, receiver and discovery), and rethrows the original failure. A failure from the cleanup is attached as suppressed so it cannot hide the original. I used a wrapper and not "assign serverSocket right after the bind" because publishing the socket early only helps when someone calls stop() later. The wrapper unwinds the start where it failed.
2. The Wi-Fi Direct enable did not stop a STARTING manager
In ProtocolEngineHost.enableTransport, the Internet branch stopped the manager when it was RUNNING or STARTING. The Wi-Fi Direct branch stopped it only when RUNNING.
Failure prevented: start() refuses only a RUNNING manager. So an enable that found the manager in STARTING started it again over what the earlier start had brought up: a second broadcast receiver registered over the first, and a second listener bound. Fix: both branches now call one predicate, stopsBeforeEnable(state), which is true for RUNNING or STARTING. WifiDirectManager.stopUnsafe already accepts STARTING.
Tests
WifiDirectManagerStartUnwindTest(Robolectric, new): makes a LAN-only start throw from the STARTING state callback, the first thing after the bind. It then checks four things: the original exception reaches the caller, the manager ends STOPPED after passing through STOPPING, port 8988 is free again, and a freshPeerStreamListener.bind()owns the group port. Negative control: with theorigin/mainWifiDirectManager.ktit fails (expected:<STOPPED> but was:<STARTING>).TransportEnableRestartTest(new): pinsstopsBeforeEnableto exactly STARTING and RUNNING. It tests the predicate only. It cannot see which branch calls it, so it does not catch a branch that stops calling it. I found no deterministic way to get a real manager to rest in STARTING once fix 1 is in, because a failed start now unwinds itself.- Ran locally with Gradle 8.9 and JDK 17, using the standalone CI harness on a copy of the module with no sibling
node_modules: the full:offlineprotocol:testDebugUnitTestsuite, 772 tests, 0 failures. The only failures were 10PeerStreamFramingTestcases that could not find the repo's framing vectors from the scratch copy. They pass once the vectors file is next to the copy. cargo test -p offline-protocol-uniffi --lib: 316 passed. This includes the source guards that readWifiDirectManager.ktandProtocolEngineHost.kt.- Not run: anything on a device.
Step 5 of the shared-network plan, implementing the exchange of ADR 0037. Nothing is gated on visibility yet, and the UDL is untouched (step 6).
What changes
- Every node runs the exchange. On discovering a neighbour over a mesh carrier, a node sends a
__MEMBER__hello and answers the neighbour's. It always sends the same two sizes and does the same work (one identity signature, one seal), configured or not, as the ADR requires. - Members see each other.
ProtocolConfig.app_publisher_keyderivesK_app, andOfflineProtocol::set_app_membershipinstalls the node's certificate after checking its address, signature and expiry. A peer becomes visible only after its credential opens under the key for its own address, its certificate verifies for that address and is current, and its transcript signature covers this node's fresh nonce. Visibility is in memory, read byis_member_visible(crate-private), and logged. - The frames stay on the link. They go out through
send_to_neighboronly, with TTL 1 andrequires_ack = false. A receiver ignores one that arrived over another carrier, after a hop, unsigned, or addressed to someone else. This clears the owed #684 item aboutreceive.rsacknowledging consumed control frames. - No sealing key is used twice. Each pair of nonces is answered at most once, and after eight answers the exchange restarts with a fresh nonce. When a peer restarts, this node resends its hello with the same nonce, so the two sides settle instead of ping-ponging.
- #684 follow-ups. The e2e proof's HKDF label is now
offline-app-member-e2e-key-v1, apart from the signing domain, with the vectors regenerated. The chapter states the empty associated data and the per-kind certificate address check, and gains "Carriage" and "When it runs" paragraphs.
Tests
Sixteen new tests in protocol/tests/membership.rs run over the real sign, link, gate and dispatch path. Three of them build the peer's frames by hand from the chapter, with HKDF and ChaCha20-Poly1305 called directly. That pins the engine's AEAD (zero nonce, empty associated data) against an independent reading of the spec, which the vector file cannot do.
Nine guards were mutation-tested, and each mutation fails a test. The engine's own refusal of an unsigned frame is the exception: the control gate refuses the frame first, so that check is a second line of defence that can't be observed from outside.
Existing tests updated: the custody topology drains Bob's discovery hello, and two FFI Wi-Fi Direct tests look past membership frames in the slot.
Local runs:
cargo clippy --workspace -- -D warningsis clean.cargo test --workspace --no-fail-fastpasses exceptno_shipped_file_names_a_relay. That guard fails only locally, because it scans.claude/worktrees.- Rustdoc passes under
-D warnings. - Sealed and leaf no_std clippy is clean on all four bare-metal targets.
offline-protocol-webchecks forwasm32-unknown-unknown.
Known residuals
- An older build that does not reserve
__MEMBER__shows every hello to its application as text. The ADR accepts this because no fleet is deployed, and the CHANGELOG says so. - Every fresh hello costs the receiver one identity signature. A flood is bounded by the per-link limits and the eight-nonce cap, not by a dedicated rate limit.
- The certificate and visibility live in memory only. The application supplies the certificate on every launch.
Phase 1 step 4 of ADR 0037 (#680): the byte layouts of application membership, owned by offline-protocol-sealed, plus reservation of the __MEMBER__ prefix. Nothing is gated on membership yet; steps 5 to 7b build on this.
What is in it
offline-protocol-sealed::membership (codec only, as ADR 0022 requires; the crate still links SHA-256 and nothing else):
| Layout | Size | Content | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
MemberCert | 93 | `address_payload(21) \ | \ | u64be(not_after) \ | \ | publisher_sig(64)` and its signing payload | ||||
MemberFrame::Hello | 32 | `nonce(16) \ | \ | HMAC(K_app, label \ | \ | nonce \ | \ | addr_self \ | \ | addr_peer)[..16]` |
MemberFrame::Response | 173 | ChaCha20-Poly1305 of `cert \ | \ | transcript_sig` | ||||||
MemberProof | 189 | `salt(16) \ | \ | sealed credential(173), with the e2e signing payload (recipient \ | \ | kind \ | \ | SHA-256(body)`) |
The frame body is base64 of version(1) || step(1) || payload. Any other version, step or size is refused before anything runs, and the encoded length is checked before decoding. Helpers build every primitive's input: app_key_info, hello_tag_input, exchange_salt (lower address's nonce first, equal addresses refused), exchange_key_info, transcript_signing_payload and e2e_proof_signing_payload. The primitives (HKDF-SHA256, HMAC-SHA256/16, Ed25519, ChaCha20-Poly1305 with a zero nonce under a single-use key) are fixed by the spec and run by the callers.
One deviation from the ADR sketch, and why. The ADR derived one exchange key from nonce_lo || nonce_hi. Both sides send a response from those same two nonces, so a single key would seal two plaintexts under one key and one zero nonce, which leaks their XOR and the Poly1305 key. The sender's address now goes into the HKDF info, so each direction has its own key. The ADR sketch is updated to match, and the labels are versioned (offline-app-member-hello-v1 and the rest).
Decision to review: the discovery query proof. A query is gossip and has no single recipient. Its proof binds 21 zero bytes, which no address payload can be (the version byte is never zero), and the query itself is bound through SHA-256(body), which includes query_id and originator.
__MEMBER__ is reserved now, on the terms __DATA_V1__ and __CUSTODY_RECEIPT__ were. The sealed crate names it, the engine registers it (signature-gated by construction), and the receive router consumes it with no answer. ADR 0037's rollout note says a build that doesn't reserve the prefix shows the frame as text, so this release becomes the floor.
Spec: a new section, "Application membership", in docs/spec/control-messages.md, with a registry row. The vector file is listed in conformance.md and spec/README.md. There is also a CHANGELOG entry.
Verification
app-membership-v1.vectors.jsonwas generated bytools/spec-vectors/generate.py, which implements HKDF (RFC 5869) and HMAC overhashlib, independently of the Rust code. The Rust tests check every layout against it, plusK_app, both direction keys, the hello tag and the proof key, usinghkdfandhmacas dev-dependencies only.generate.py --checkreports all 11 files match.cargo test -p offline-protocol-sealed: 102 pass. Mutation check: swapping the address order in the tag input, or dropping the sender from the key info, fails 3 tests.- New engine test
a_membership_frame_is_consumed_and_never_answered: removing the router branch makes it fail. cargo test --workspace --lib: everything passes exceptoffline-protocol-web::no_shipped_file_names_a_relay. That failure is local only: every hit is inside a stale.claude/worktrees/agent checkout, not in this tree.cargo clippy --workspace -- -D warnings,cargo fmt --all -- --checkandRUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-depsare all clean.- Bare metal: sealed clippy and build on all four targets, leaf clippy on all four with
bare-metal-rng, and leaf onwasm32-wasip1, all clean.
Not in this PR
Steps 5 onward: the engine exchange state machine, the UDL and binding regeneration, the gates, the leaf provisioning frame, and the member_proof fields in the key package, Welcome and discovery payloads.
Follow-up to #681 and #682: the items their reviews left open. No wire change.
Android (#681)
- Bind before
STARTING.startUnsafethrewStartFailedafter the P2P channel, the broadcast receiver and peer discovery were up, and nothing unwound them. The engine host's enable path stops only a RUNNING manager, so the next enable registered a second receiver and leaked the channel. The bind is local, so it now runs first, with nothing to unwind. - Accept timeout at bind time.
soTimeoutwas set inside the accept task. Astop()that closed the socket before that task ran made the setter throw and emitted a spurious "Failed to start server socket" error. It is set right after the bind now, and closes the socket if the setter fails. - Docs. The rule that a device without port 8988 never creates a group is now rule 5 in the
WifiDirectGroupFormationheader and indocs/bridges/kotlin.md, along with the formation cost it brings (three to four minutes when that device is the lowest address).
Carriage rule (#682)
the_forwarding_path_never_reads_the_application_idnow coverscustody.rs, which holds third-party frames. Its one allowed read ismessage.app_id.as_str().len()inframe_footprint; any other read fails, so an app-scoped custody quota cannot slip in.- The spec now says a forwarder MUST NOT *decide* on
app_id, rather than MUST NOT *read* it, because re-encoding a frame reads the field. - The three-node test asserted only that bob sent alice some frame. It now asserts that the frame is carol's acknowledgement naming
msg_id, either inack_foror in a coalescedack_more. docs/mesh.md: "travels in clear" becomes "in the clear".
Verification
cargo test -p offline-protocol --lib the_forwarding_path_never_readsand--test mesh_forwarding a_device_running_another: both pass.- Both were mutation-tested. An added
app_idcomparison incustody.rsfails the guard, and a wrong acked id fails the test. cargo clippy -p offline-protocol -- -D warningsandcargo fmt --all -- --checkare clean.- Android unit tests in the standalone harness: 760 of 770 pass. The 10 failures are all
PeerStreamFramingTest, which cannot find the repo's vector file from a copied tree, so they are an artifact of the run location. CI runs them in the checkout. - Not run: the two-phone, two-app bench run owed since #681. It is still owed.
Step 2 of the shared-network plan (phase 0, no wire change). A second SDK app on the same Android phone had no inbound LAN streams.
Before: WifiDirectManager bound the fixed port 8988. A second SDK app on the phone failed that bind (logged, then ignored) and still advertised 8988 in its LAN NSD record. Every peer that dialled the second app reached the first one instead.
After:
PeerStreamListener.bind()takes 8988 when it is free and any free port otherwise. The LAN record carries the port that was actually bound. LAN peers already dial the port they resolve, so nothing changes on their side.- A Wi-Fi Direct group client knows only its owner's address, so it still dials 8988. A device that does not hold 8988 never creates a group (
Local.canOwn) and joins instead, so its clients never reach whichever app does hold the port. The other devices' takeover rule (TAKEOVER_FAILED_JOINS) still covers a lowest address that never creates. - The bind now happens synchronously at start, just before the accept loop is handed to the socket executor. That removes the old "stop() lands before the bind publishes" race. A start that can bind no port at all now fails (
TransportException.StartFailed) instead of advertising a port nobody is listening on.
Tests
PeerStreamListenerTest: the first listener takes the group port; a second one gets another port and reportsownsGroupPort = false.WifiDirectGroupFormationTest: a device without the group port never creates, and joins wherever it would otherwise have created.- Ran the two classes locally in a clean copy, the way the CI harness runs them: 32/32 pass. With the
canOwnrule removed, the formation test fails (negative control).
Step 1 of the shared-network plan (phase 0, no wire change). The engine is already app-blind on the forwarding path; this PR writes that down as a rule and pins it.
app_id is cleartext and unsigned (R17), so any forwarding decision based on it is one a carrier can steer. A filter that kept only "my app's frames" would split the network into one per application, when the point is that every SDK install carries everyone's traffic.
Spec (docs/spec/wire-format.md): the forwarding half of the carriage rule. The spec already said a receiver MUST NOT drop or authorize a frame by its app_id. It now also says a forwarder MUST NOT read app_id at all: it carries another application's frame exactly as it carries its own, and hands it on with the app_id it arrived with. Fairness stays per arrival link plus the own-traffic reserve, never per application.
Docs (docs/mesh.md): the same rule in the developer-facing mesh chapter.
Tests
the_forwarding_path_never_reads_the_application_id: a source guard overmesh_relay.rsandcustodian.rs(outside their test modules) and overtry_relay_messageandflush_mesh_relays_atinreceive.rs. It also asserts that each slice it reads is really forwarding code, so a slice that lost its body cannot pass vacuously.rotating_the_app_id_buys_a_neighbor_no_more_than_its_link_allows: 200 frames from one neighbour, each with a differentapp_id, stay within that link's burst.a_frame_for_an_application_this_device_does_not_run_is_carried_unchanged: the governor's release keeps the frame'sapp_id.a_device_running_another_application_carries_the_message_both_ways(tests/mesh_forwarding.rs): alice and carol run one app and bob runs another. Bob, the only path between them, carries the message out and the acknowledgement back, and every frame he hands on keeps its originalapp_id.
Verification
- Local:
mesh_relay::tests55/55,mesh_forwarding25 passed (2 ignored),cargo fmt --all -- --checkclean. - Negative control: adding an
app_idread totry_relay_messagemakes the guard fail ("receive.rs try_relay_message reads the application id on the forwarding path"). - clippy was not run locally (the machine was memory-bound); CI's clippy gate covers it.
Companion PR: #681 (Android listener port, step 2 of the same phase).
Proposes ADR 0037 for review before any code. It is the design gate (step 3) for making each application's users invisible to every other SDK application, while every node keeps carrying every application's traffic.
What it decides
- Carriage is never gated. Relay, store and forward stay app-blind, as today.
- Visibility requires proof. With a publisher key configured, a peer is reported (
NeighborDiscovered,NeighborLost,PeerRssi,presence_updated), and the automatic discovery effects run for it, only after a hop-0__MEMBER__exchange proves it holds a certificate from the same publisher. The exchange is an HMAC tag under a key derived from the publisher's public key, then an AEAD-wrapped certificate plus a transcript signature. To anyone outside the application it looks like random bytes. - A member answers no stranger. No ACK of any kind, no key package, no Welcome and no reset goes back unless the sender:
- is visible;
- was named by the application itself; or
- carries an end-to-end membership proof. This is how members several hops apart still find each other.
- Nothing names the application in the clear. The wire
app_idbecomes a constant, and the real id moves into the sealed rich payload. The BLE app tag, the Wi-Fi Direct group and the browser nearby room key are all derived from the publisher key. Service discovery bodies are sealed under the same key. This addresses R9, R15, R17 and R22. - Issuance: backend signing is the recommended mode. An embedded-key mode is available too, and its forgery residual is stated plainly. Leaves get a certificate in-session after pairing.
The ADR covers the attacker model, the alternatives rejected (cert in the identity assertion, cert in the clear, MLS per neighbour, an app_id filter or quota, a shared engine) and what would undo the decision.
Open for review
- Older SDK builds do not reserve
__MEMBER__, so they would show the hello as text. The ADR accepts this because no fleet is deployed; it becomes a capability-gated send if that changes before ship.
Settled in the ADR since the first draft:
- A member does not reveal itself to a non-member that already knows its address: step 2 is sent unconditionally, at one size and at equal cost, and the inbound gate answers nothing.
- Service, data-sync, group and every other reply path go through the one admitted predicate, which the neighbour-event emission sites ask too.
- Group invites to a member never met carry the end-to-end membership proof in the group Welcome.
- Service discovery stays carriage: fan-out goes to mesh neighbours only and every query and response is forwarded unread. Bodies are sealed, both ends carry a membership proof, and a provider answers a query once while its originator-written
issued_atis fresh. The bounded replay that remains is stated as party 2's residual.
Docs only; no code or wire change in this PR.
bahdotsh/wrkflw
The 42 commits since v0.8.0 mostly updated the root README and AGENTS.md as they went. The per-crate READMEs fell behind, and the worst was crates/wrkflw/README.md, the page crates.io shows. This PR brings them up to date before the next release.
Changes
- crates.io README: adds
gate,plan,runsandmcp. Saysautois the default runtime, not Docker, and adds Kubernetes and.gitea. Lists the CI-saving, history, Kubernetes and global flags, the environment variables, and exit code2. - Examples that didn't compile:
- The library is named
wrkflw_lib, souse wrkflw::executornever compiled. This predates the recent work. run_wrkflw_tuiandvalidate_jobshave new signatures.- executor, runtime, matrix, ui and utils READMEs, and the crate index: add result reuse and the remote cache, affected-job skipping, the job container, dependency caches,
services:, job-levelcontinue-on-errorandconcurrency, expression matrices, Kubernetes and GitLab execution. The UI README gets the Runs tab,1–8tab keys, mouse copy, themes and the current runtime cycle order. - Root README: adds the Runs tab and
1–8. GitLab support also covers running pipelines, not only validating and triggering them. Addswrkflw-runsto the crate table. - New
crates/runs/README.md: it was the only crate without one. - BREAKING_CHANGES.md: adds a missing entry for #158. An explicit
--runtime dockerorpodmanno longer falls back to the host. The entry also covers three behaviour changes from the same PR: how$GITHUB_PATHis ordered, one image pull per run, andhashFiles('dir/**')producing different cache keys. - Skill file and AGENTS.md: the skill says to run
wrkflw gatebefore pushing. Both note thatgateonly prints text. - tests/README.md: lists the reusable-workflow execution test and the security test workflows.
How this was checked
- Compared every flag in the built CLI's
--helpagainst the docs, in both directions. No documented flag is missing from the CLI. - Extracted all 14 Rust examples from the crate READMEs into a scratch crate with path dependencies on these crates.
cargo checkpasses.
Not in this PR
wrkflw gate ignores --format json: it prints text and doesn't pass the flag on to the runs it starts. That breaks AGENTS.md's promise that stdout is JSON-only. This PR documents how to work around it. The code fix needs its own PR.
What changes
- Five more agents.
copilot,grok,kiro,piandzed. Paths and entry shapes come from each tool's docs.
| Agent | Config | Entry |
|---|---|---|
| GitHub Copilot CLI | $COPILOT_HOME or ~/.copilot/mcp-config.json | mcpServers, type: local, tools: ["*"] |
| Grok Build | grok mcp add. Existing entry read from [mcp_servers.wrkflw] in $GROK_HOME or ~/.grok/config.toml | |
| Kiro CLI | $KIRO_HOME or ~/.kiro/settings/mcp.json, following Kiro's rules for KIRO_HOME | mcpServers, absolute path, env: {} |
| pi | $PI_CODING_AGENT_DIR or ~/.pi/agent/mcp.json | mcpServers |
| Zed | ~/.config/zed/settings.json on macOS, XDG on Linux, %APPDATA%\Zed on Windows | context_servers, env: {} |
- Commented JSON is edited, not refused. Zed's settings file always has comments and trailing commas, so the old parse-and-reserialise approach would have refused it for nearly everyone. Edits now go through
jsonc-parser's syntax tree. Only thewrkflwentry changes, and comments, trailing commas, key order and indentation stay as they were. This also helps VS Code'smcp.jsonand opencode's.jsoncfiles. - A named agent gets its config created.
wrkflw mcp install kiroused to reportnot foundif~/.kiro/settingsdidn't exist. Now the directory and file are created. Agents that aren't named are still only touched when found. A CLI-driven agent whose CLI is missing still reportsnot found. - Docs. The README table,
AGENTS.mdand theinstallhelp text are updated.
Not changed
- Agent detection for runs. Kiro, Grok, pi and Zed set no environment variable that marks an agent. Vercel's
detect-agentreadsCOPILOT_MODELandCOPILOT_GITHUB_TOKENfor Copilot, but people set those in their own shells too. It's the same problem that keptCURSOR_TRACE_IDout in #159. The docs tell these agents to setWRKFLW_AGENT. - Codex sessions under MCP. Codex still doesn't pass
CODEX_THREAD_IDto MCP servers (openai/codex#19937).
Testing
cargo test --workspace --all-features: 1434 passed, 0 failed.cargo clippy --workspace --all-features -- -D warningsis clean.- New unit tests cover:
- a Zed-style file with comments and trailing commas, and a rerun reporting
unchanged --forceon a commented file- named agents getting their config created
- Kiro's home detection and absolute path, and its
KIRO_HOMErules - each new agent's entry shape
COPILOT_HOME,GROK_HOMEandPI_CODING_AGENT_DIR, including~expansion- Zed's settings path
- matching Grok's TOML entry
- a dry run on a named agent that isn't installed creating nothing, not even its directory
- an entry that isn't an object is replaced under
--force - CRLF line endings are kept, including the final newline
- Release binary run against a throwaway
HOMEthat held a copy of a real Zedsettings.json: install copilot kiro pi zedadded every entry, and a second run reportedunchanged.- The Zed diff only adds the
context_serversblock, and every comment is kept. grokreportednot foundbecause it isn't installed here.wrkflw mcp install --dry-runon a real machine now also picks up Zed.
Also fixed
- A flaky executor test failed CI with
Text file busy. The fake docker CLI it writes could be run while another test's forked child still held it open for writing. The helper now waits until the script runs once before handing it over.
Not verified
- None of Copilot CLI, Grok, Kiro or pi is installed here. Their formats match their docs, but they haven't been loaded by the real agents.
--forceon Grok runsgrok mcp remove wrkflwbefore adding, like Claude Code and Codex. Grok's CLI reference documentsmcp remove, but it hasn't been run here. If the remove fails, its error is reported along with the add's.
Makes wrkflw easier to set up for coding agents before v0.9.0. The idea comes from what atuin offers agents (atuin mcp install, tagging runs by agent, and threads).
What changes
wrkflw mcp install [CLIENT...] [--dry-run] [--force]registerswrkflw mcp servewith every agent it finds, or with the ones named. Supported:claude-code,codex,cursor,windsurf,vscode,gemini,opencode,claude-desktop.- Running it again changes nothing. An entry that launches a different command is left alone unless
--forceis passed. - Claude Code and Codex are changed through
claude mcp add --scope userandcodex mcp add. Claude Code rewrites~/.claude.jsonwhile it runs, and Codex keeps TOML. - The other agents use plain JSON. Those files are written atomically and keep their key order. A file with comments is reported, not rewritten.
- The entry uses
wrkflwwhen it is onPATH, so it keeps working after upgrades. Claude Desktop gets the absolute path, because it doesn't start servers with the shell'sPATH. - More agents detected. Before, only
CLAUDECODEwas checked. Now detection also readsAI_AGENT(the part before the first_), plus the variables set by Codex, Gemini CLI, opencode, Cursor's agent and Augment.CURSOR_TRACE_IDis left out on purpose, because a person's own terminal in Cursor sets it too. - Session ids on runs. Each record gets a new
sessionfield, taken from--session,WRKFLW_SESSION,CLAUDE_CODE_SESSION_IDorCODEX_THREAD_ID. You can filter on it withruns list --session, and with the MCPlist_runstool. It also shows inrun_started,runs showand the TUI Runs tab. - The field is
#[serde(default)], so older records still load. - Under MCP, the session id inherited from the agent is ignored. The server outlives the session: Claude Code keeps the id it started with even after
/clear. MCP clients passsessiontorun_workflowinstead. - Docs. The README has a table of the agents
installsupports.AGENTS.mdand the skill explain agent and session detection.INDEX.mdis regenerated. It also picks up files from #156–#158 that were never added to the index.
Testing
cargo test --workspace: 1413 passed, 0 failed.cargo clippy --workspace --all-features -- -D warnings(the command CI runs) is clean.- Unit tests cover:
- agent and session detection, including the MCP stale-id case
- JSON editing: adding to an empty file, keeping order, unchanged, differs,
--force, dry run, refusing comments - detecting an agent by its config directory, for every agent's entry format
- Tested by hand against a throwaway
HOME, for Claude Code, Codex and Cursor: - Installing adds the entry, and running it again reports
unchanged. - An entry pointing at a different command reports
differs. With--force, it is replaced. - A real
wrkflw rununder Claude Code recordedagent: claude-codeand the right session id.
Not covered
- The VS Code, Windsurf, Gemini, opencode and Claude Desktop paths and formats come from each tool's documentation. They haven't been tested against the real apps yet.
- Codex doesn't pass
CODEX_THREAD_IDto MCP servers (openai/codex#19937), so a Codex run started through MCP records a session only when one is passed in.
Why
I ran a complex workflow through wrkflw on Docker, Podman and emulation, plus the format job from our own CI. Several things broke on real container workflows, and the default Docker mode spent most of each step asking the registry about an image it already had. That is the follow-up #156 called out.
What changes
| Fix | Before | After |
|---|---|---|
| Per-step image pulls | Docker asked the registry before every step, about 1.5s each | Each image is pulled once per run |
| Explicit runtime fallback | --runtime docker ran steps on the host when Docker took over 1s to answer, and reported success | The probe waits up to 8s for the CLI. An explicit Docker or Podman run fails if it gets no answer. Only auto falls back |
$GITHUB_PATH in containers | The next step got the host's PATH plus the entry, so cargo vanished from rust:1 | Entries go in front of the image's own PATH on Docker, Podman, the job container and Kubernetes |
Composite actions with --job-container | Their steps ran in a throwaway container, so tools they installed were gone | The action directory is copied into the job container, and the steps run there |
hashFiles('app/**') | Empty string, because the glob crate's trailing ** matches only subdirectories | Hashes every file under the directory, as GitHub does |
| Rust setup image | Broke on images with their own CARGO_HOME, such as rust:1 | Reuses the existing rustup and honours CARGO_HOME |
| Built-in Rust toolchain fallback | Ignored components and targets, so cargo fmt failed | Installs them in the job's container |
| Matrix outputs | One combination's outputs replaced another's, with a warning even without outputs | Merged per key, with a warning only when a value changes |
| Docker build errors | Shown only as "Docker stream error" | The daemon's message and the last build output |
shell: python in emulation | Failed on hosts with only python3 | Falls back to python3 |
The action metadata fetch timeout goes from 5s to 20s. The result is cached, and the fallback ignores the action's inputs, so waiting is better than giving up.
Measurements
These come from a macOS laptop on Docker 28.3.2 with an 8-step job, so they show the direction, not a benchmark.
| Scenario | Before | After |
|---|---|---|
| Default Docker mode | about 14s | about 3.4s |
--job-container | about 0.9s | unchanged |
Unchanged tree with --reuse-results | full run | 0.5s |
Testing
- New unit tests cover the PATH helpers, the job session loader,
hashFilesdirectory patterns and per-key matrix outputs. container_fidelity_test.rsruns the real binary on Docker, and skips when Docker doesn't answer. It covers PATH after a$GITHUB_PATHwrite in both modes, and a composite action's changes staying in the job container.- I checked by hand that the complex workflow passes on Docker and Podman, with and without the job container, and in emulation. The format job from our own CI passes on Docker with
rust:1andubuntu:latest. I also checked a slow Docker, which is now accepted, and a dead one, which now fails the run. cargo fmt --checkis clean. I did not get through clippy or the full workspace suite locally. The machine was overloaded, so CI is the first full run.
Not tested
- Fetching real remote action definitions. Connecting to GitHub took 15s from this machine, so those runs used the built-in fallback.
- The Kubernetes change, which uses the standard Linux PATH because the image can't be inspected there.
Why
Coding agents push often, and every push reruns every job from cold. This makes wrkflw do less on a rerun and stops failing pushes before they reach CI. Everything that changes what runs is opt-in. Without the new flags, a run behaves as before, apart from the two fidelity fixes below.
What's new
| Feature | What it does |
|---|---|
--reuse-results | Skips a job whose fingerprint already passed, and restores its outputs for dependent jobs |
--affected | Skips jobs listed in .wrkflw/affected.yml when none of their paths changed |
--job-container | Runs a job's run: steps in one container, on Docker and Podman |
--dep-cache | Mounts cargo, npm, pip and Go caches from the host |
--remote-cache, --cache-push | Share HMAC-signed results between machines |
wrkflw gate | Runs what a push would run, and --install-hook makes it a pre-push hook |
Two fidelity fixes apply without a flag:
- Services:
services:now start on Docker and Podman, with health checks. They share the job container's network namespace, so bothlocalhostand the service name work. - Concurrency: job-level
concurrency:groups are enforced within a run. The README said this was parsed, but serde was dropping the key.
Measurements
These are from a macOS laptop on Docker 28, on small scratch repositories. They show the direction, not a benchmark of a real project.
| Scenario | Before | After |
|---|---|---|
| 8-step job, 5 runs each | about 12.4s | about 0.95s with --job-container |
| Gate on an unchanged tree | full run | 0.4s |
| Two 3s jobs in one group | 3.8s, overlapping | 6.8s, serialized |
The per-step path also pulls the image on every step, so an unknown part of the job container gain comes from skipping those pulls. Fixing that on its own may be a worthwhile follow-up.
Please review closely
- Reuse safety. wrkflw can't see what a step does. It always runs jobs that read secrets, have
writepermissions, exchange artifacts or call a reusable workflow. Any other job with outside effects needscache: falsein the sidecar. Detection is by text match inuncacheable_reason. --affectedtrusts its inputs. It trusts the path lists, and it assumes the diff base was green. A path left out of a job's list won't rerun that job.- The fingerprint omits images and floating action tags. Results expire after 7 days to bound that drift.
- The signing key is symmetric. Anyone with the key and write access to the store could forge a result. The README says to keep write access to trusted CI.
Known limitations
- Services don't start in emulation, in secure emulation, on Kubernetes, or in called workflows. Those cases still log a warning.
- With services,
ports:host remaps don't apply. Steps use the port the service listens on. - Docker
uses:actions still get their own container, so they can't reach services. --preserve-containers-on-failureturns--job-containeroff.- Service containers are always removed, so
--preserve-containers-on-failuredoesn't keep them. --dep-cachemounts under/root, so it only helps images that run as root.cancel-in-progressand workflow-levelconcurrency:have no effect.- Group names compare as written, because expressions in them aren't evaluated.
- macOS and Windows runners are unchanged.
Existing issues found, not fixed here
- The Docker availability probe is flaky. It sometimes reports Docker as unavailable and falls back to emulation, which happened in testing and made one gate run fail for the wrong reason. The runtime is in the fingerprint, so this can't poison stored results.
- Emulation runs parallel jobs one after another, so it can't reveal a race between jobs.
Testing
- 1338 tests pass across the workspace, up from 1289, and CI is green on Linux, macOS and Windows. Clippy,
cargo fmt --checkandcargo check --no-default-featuresare clean. - New integration tests run the real binary against a throwaway repository, in
crates/wrkflw/tests/acceleration_test.rs. - Checked by hand on real runtimes, not in automated tests:
- Docker: job container state, exit codes, step timeouts, a dead service,
--dep-cache, gate, and a blocked push. - Docker and Podman: Postgres services and container cleanup.
- Not tested: the new features on Windows. The integration tests need a POSIX shell, so they're
#![cfg(unix)]likeagent_cli_test, and Windows CI only checks that the code builds, the unit tests pass and the binary starts. Docker and Podman behaviour was only exercised on macOS. Podman was only checked for job container state and services. The HTTP remote was only tested against a mock server.
Windows startup fix
This branch's new code pushed the main future past the 1 MiB main thread stack on Windows, so a debug build overflowed before parsing arguments. main starts under a 1 MiB limit and this branch didn't. main() now boxes that future, and startup_test.rs starts the binary on every platform, since nothing else does on Windows. The margin is limited: --help still overflows at 512 KiB.