Repository navigation
feat(deps): make chrono optional behind a default feature - #1474
andreinknv wants to merge 2 commits into
Conversation
chrono is marked unmaintained by RUSTSEC-2026-0543. Use jiff for the clock and the RFC 3339 task and annotation timestamps, keeping the exact previous output (`+00:00` offset, 0/3/6/9 fractional digits), and format the request timeout message without chrono (`PT30S`, `P0D`). The new default `chrono` feature keeps `Annotations::for_resource` and `Annotations::with_timestamp` (which take `chrono::DateTime<Utc>`) and schemars' `chrono04` support. With default features disabled, rmcp no longer depends on chrono unless an `auth` feature pulls it in through oauth2.
Codex Review Summary: ✅ CompletedThis 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. |
|
@michaelneale is on triage rotation this week and is the reviewer for this one. Labels come from the PR labeler. Please review the change. Automated triage. Labels are a first pass and the assigned maintainer has the final say. |
jokemanfire
left a comment
There was a problem hiding this comment.
Verified at a95b804 from the code and a local A/B run, not the description.
What I ran (Linux, stable 1.96; Windows and MSRV not run here)
- A scratch example (not committed) that formats the same values both ways:
chrono::DateTime::to_rfc3339()vsAnnotations::with_timestamp(..).last_modified, andformat!("request timeout after {}", chrono::Duration::from_std(d).unwrap_or_default())vsServiceError::Timeout{d}.to_string(). - 14 timestamps: seconds 0, pre-epoch (
-1s + 500ms), 2099, and every fractional shape (1ns,1µs,1ms,100ms,123ms,123456µs,123456789ns,999999999ns). - 12 durations: zero, 1ns, 1µs, 1ms, 1.5s, 30s, 5400s, 86400s,
i64::MAXms exactly, one nanosecond past it, andDuration::MAX. - Result: 26/26 identical, including the 0/3/6/9 fractional-digit rule, the
+00:00offset, and the overflow quirk wherechrono::Duration::from_stdfails andunwrap_or_default()printsP0D— yourtoo_longbranch reproduces that exactly. cargo tree -p rmcp -i chrono: default features →chrono v0.4.40(direct, plus throughschemars 1.2.3);--no-default-features --features server,macros→ not in the tree at all. Your opt-out claim holds.
Code read
time::rfc3339is only reachable fromnow_rfc3339, so the sign ofsubsec_nanosecond()for pre-epoch values never reaches it; the digit selection matchesSecondsFormat::AutoSi. The#[cfg(any(client, server))]onIso8601Durationmatches whereServiceError::Timeoutexists.with_timestamp_nowno longer routes throughwith_timestamp, which is what keeps it available without thechronofeature — correct, sincewith_timestampkeeps using chrono's ownto_rfc3339and the two agree (probe above).
Two things worth settling before merge
-
Default users still trip the advisory.
chronois indefault, socargo tree -i chronostill shows it for anyone who does not adddefault-features = false. That is fine as a staged change, but it means the people who filed #1469 (plainrmcp = "3") see no difference incargo deny check advisories, and the opt-out is not documented anywhere a downstream would look. I would like the README and CHANGELOG to carry the exact snippet (default-features = falseplus the feature list they actually need) and one line on the plan to flip the default at the next major. Right now the README change is one line and does not say this. -
The flip is a hard API break, and the migration path is invisible. With the feature off,
Annotations::for_resourceandwith_timestampvanish; at the flip every caller panics at compile time with no replacement that accepts a timestamp. Cheap way to make the eventual break a non-event: add an untypedwith_last_modified_rfc3339(&str)(or ajiff-typed setter) now so non-chrono users have a supported path, and#[deprecated(note = "…")]on the chrono setters in a later release before the default changes. Not required for this PR, but it should be in the PR body as the follow-up plan.
Question: which wasm targets did you verify?
jiff's docs for Timestamp::now() say it "may also panic when SystemTime::now() itself panics. The most common context in which this happens is on the wasm32-unknown-unknown target… you should enable Jiff's js feature". This PR deletes the two target-specific chrono blocks, and CHANGELOG.md:1087 records #234 as "disable wasmbind in chrono for wasm32-unknown-unknown", so that target has been deliberately configured before. I read the old config as panicking the same way (no wasmbind), i.e. parity, but I did not build for wasm32-unknown-unknown to prove it — CI only builds examples/wasi for wasm32-wasip2, which has a real clock. One sentence in the PR body saying "wasm32-unknown-unknown behaves as before / now needs jiff/js" would close it.
None of this blocks the dependency change itself, which I could not fault: the formatting is byte-identical on everything I threw at it and the feature wiring does what it says.
Show the `default-features = false` snippet, what is unavailable without the `chrono` feature, that the `auth` features still pull chrono in through oauth2, and the plan to drop `chrono` from the default features in the next major release.
|
Thanks for checking it so thoroughly. 1. Docs. 9043cdf adds a "Building without chrono" section to the crate README, which is also the crate-level rustdoc. It covers the I left
If you'd rather have it under 2. Migration path. It's now in the PR body as a follow-up plan: a setter that needs no chrono, then deprecating the chrono setters in a later minor, then flipping the default at the next major. I can add the setter in this PR if you'd prefer it now. 3. wasm.
With rmcp's default features, AI assistance: I used an AI coding assistant (Claude Code) to run these checks and draft this reply; I reviewed the results. 🤖 Generated with Claude Code |
A chief can list MCP servers in `mcp/servers.json` in the realm, and
their tools are offered to every agent beside the built-in ones (C36,
ADR 0017).
- The server is the MCP client, through the `rmcp` crate: its client,
its transport over a reader and a writer, and its streamable HTTP client
with OAuth. pi sees each tool as one more entry of the catalogue and
calls it through the same `operation` message as `read`, so the runtime
protocol does not change.
- `mcp/` is in the realm, out of every agent's reach, so the tokens in
the list are too. An entry names a program, or the `url` of a remote
server and its `headers`. Each program runs under the sandbox with the
reach its entry declares (`fs_ro`, `fs_rw`, `net`, limits, `env`,
`inherit_env`), in its own folder `mcp/<name>/`, its working folder,
`HOME` and the one place it writes besides `fs_rw`. A server runs for as
long as it is listed, so it has no CPU limit of its own. Unknown keys
are faults.
- A changed list starts, restarts or stops servers while the server
runs; a change of `timeout_secs`, `allow` or `ask` alone restarts
nothing, and a file that is not JSON, or holds anything but `servers`,
changes no server. A changed entry keeps its tools offered while it
starts again. A server that ends starts again after 2 seconds, doubling
to 5 minutes.
- The tools a server last listed stay offered while it starts again, so
a restart changes no agent's tools and no prompt; a call meanwhile fails
at once with why it stopped. Only an entry that does not load, a server
that never started, and tools left out are named in the prompt (C15).
`tools/list_changed` lists again.
- A tool of server `github` called `create_issue` is
`mcp__github__create_issue`; other characters, or past 64, are changed
or shortened with a hash. No hand-added tool may take a name beginning
with `mcp__`. A server offers at most 128 tools; a schema that does not
compile or passes 16 KiB leaves its tool out.
- A call is classified by the gate as an added tool, marked begun so it
never runs twice, checked against its schema, and cancelled on its
timeout or a stopped turn. A server's network is the chief's, given in
its entry, and holds no call.
- A tool its server does not mark `readOnlyHint` waits for a chief in
every mode (H11's new `act` danger); the entry's `allow` and `ask`
override the server's word either way, a tool's name before `*`. Always
allows that tool for the rest of the conversation
(`session_tool_grant`).
- Every agent is offered every server's tools; `set_tools` and `/tools`
turn one off for an agent, or every tool of a server by `mcp__<server>`.
- Settings has an MCP Servers page, drawn in the UI gallery too, and
`hamlet mcp` the same acts: list, tools, add, edit, remove, restart,
sign in, and import. The server changes `servers.json` one entry at a
time, keeps the rest of the file as written, and never sends a value of
`env` or `headers`, only their names. A restart keeps the server's tools
offered.
- Import finds the servers Claude Code, Claude Desktop, Cursor and Codex
list on the server's machine (`hamlet_import`): a program by its full
path, its install folder readable when it is in the home folder,
`${NAME}` as `inherit_env`, and a remote server with its headers.
- A remote server that signs in with OAuth is signed in to from Settings
or `hamlet mcp sign-in`: the code comes back on a loopback of the
server's machine, or in the address the browser ended on, pasted back.
The tokens are kept in `mcp/.signed-in/`, refreshed there, and removed
with the server.
- An agent can ask a chief for a server with `request_mcp_server`, a new
`mcp-server` wait; allowed, the server is listed with its environment's
values empty for the chief to give, and the agent is told either way.
- The workspace moves to `reqwest` 0.13, which `rmcp`'s HTTP client
needs, on rustls with ring, installed where a client is built.
- Its result's text is scrubbed of the realm's credentials and the
server's own secrets, then cut as pi cuts a read. Images go to a model
that takes them, fitted to its limits; audio and binary resources are
named and left out.
- A server's error output goes only to the server's log, scrubbed.
Sampling, roots and elicitation are refused.
- `hamlet_os` can spawn a command with its input piped
(`Tree::spawn_piped`), and `hamlet_sandbox` confines one that keeps
running (`Env::spawn_piped`). The folder watcher of the hand-added tools
is shared with the list's.
- `deny.toml` ignores RUSTSEC-2026-0543: `rmcp` types its timestamps
with `chrono`, which is unmaintained, and has no release without it
until modelcontextprotocol/rust-sdk#1474.
- Docs: `docs/mcp.md`, C36, H11, ADR 0017, the protocol, the society,
the realm, the sandbox, the tour, the glossary.


Closes #1469.
Discussed in #1469. A downstream test there confirms that chrono drops out of the dependency tree and
cargo deny check advisoriespasses without an ignore.Motivation
chrono is marked unmaintained (RUSTSEC-2026-0543). rmcp depends on it unconditionally, so downstream
cargo deny/cargo auditruns fail on it.Changes
Annotations::with_timestamp_now, and theServiceError::Timeoutmessage now use jiff 1 (default-features = false, features = ["std"]) and a small privatetimemodule. Output is unchanged:+00:00offset, 0/3/6/9 fractional digits, andPT30S/PT1.5S/P0D.chrono. It keepsAnnotations::for_resourceandAnnotations::with_timestamp(which takechrono::DateTime<Utc>) and enablesschemars?/chrono04.default-features = falsesnippet.Compatibility
Nothing changes with default features.
cargo semver-checksreports "no semver update required" for default features and for all features exceptlocal. Withdefault-features = false, rmcp no longer depends on chrono, except throughoauth25 when anauthfeature is enabled.wasm32-unknown-unknownbehaves as before. chrono (as configured since #234) and jiff both read the clock throughstd::time::SystemTime::now(), which panics on that target, and neither pulls injs-sys. A browser build that wants a working clock can enable jiff'sjsfeature; before, the equivalent was chrono'swasmbind.Tests
ServiceError::Timeoutmessage.cargo test --all-features: 1213 passed.cargo test -p rmcp --lib --no-default-features: 208 passed.-D warningswith all features, with all features exceptlocal, and with 8 smaller feature sets, including none. Nightly fmt, nightly docs with--cfg docsrs -Dwarnings, andcargo +1.88.0 check --all-targets --all-featuresall pass.mainand on this branch: a probe that callsAnnotations::with_timestamp_nowtraps onwasm32-unknown-unknownexactly like a directSystemTime::now()call, with no imports in the module; onwasm32-wasip1both print the same timestamp format;examples/wasibuilds forwasm32-wasip2.Follow-up plan
Annotations::with_last_modifiedtaking an RFC 3339 string or ajiff::Timestamp.Annotations::for_resourceandAnnotations::with_timestamp, pointing at that setter.chronofrom the default features.AI assistance: I used an AI coding assistant (Claude Code) to write most of this change and draft this text; I reviewed and tested it.
🤖 Generated with Claude Code