Repository navigation
feat: rework manager api for cross-major calls - #9
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe change adds shared protocol and nested-execution types, manager lifecycle handling, a WebSocket execution protocol, cross-major routing, version resolution, API schema updates, tests, documentation, and configuration changes. ChangesManager execution and protocol modernization
Estimated code review effort: 5 (Critical) | ~120 minutes Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
GenVM PR actionsTick a box to run it (the box unticks itself when handled). Actions only run while the PR has the
Full GenVM CI runs only when |
Linked executor PR(s)executor: genlayerlabs/genvm-executor#7 |
1e5b260 to
a43870a
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
Note Superseded where it disagrees with the triage comment, which carries the current Review pass 1 — hard findingsAutomated review of Determinism-focused probing found no leader/validator/sync hash divergence, but note the 1. Cross-major calls drop the caller's custom-runner grants
Scenario: contract A registers Options: either extend the envelope with a canonical, ordered representation of the 2. Legacy calldata rewriting can replace the requested method
The manager unconditionally removes Scenario: calldata Suggested direction: reject key collisions outright, and apply the legacy translation only 3.
|
|
Note Superseded where it disagrees with the triage comment, which carries the current Review pass 2 — the route is consensus-visibleSecond pass (a code review plus two independent determinism-probing agents, one driving the 1. A same-major call hashes differently depending on the route — this is the important one
The in-process path folds Measured on the same caller, same callee, same line, same code, identical result
The route is chosen by the host, not the contract. Purity of This also sits awkwardly against the claim that the result fingerprint is identical across Suggested direction: expose a canonical small-hash computation in the shared interfaces Base comparison is moot: the nested route does not exist on 2. A contract can turn an
|
|
Note Superseded where it disagrees with the triage comment, which carries the current Review pass 3 — a contract-reachable internal errorThird pass. One contract-reachable 1. FIXED — a zero fee budget aborts the transaction with
|
|
Note Superseded where it disagrees with the triage comment, which carries the current Follow-up pass — fixes applied, and two earlier claims retractedWork done after review pass 3, driven by the todo list rather than by new fuzzing. RetractionsTwo findings in pass 3 were attributed to this branch and should not have been. Both are corrected
Common cause: treating "new in the umbrella diff" as "authored by this branch" when a submodule is Fixed
The harness now compares the real execution hash
Two things this uncovered:
v0.2's 195 goldens were regenerated against the new artifact and verified over repeated full runs: Audited and cleanSwept every Incidental: Still open from pass 3The headline finding is untouched: the call route is consensus-visible — in-process folds Also unaddressed: nested-spawn breadth, The v0.2 host-fns enum question from pass 3 is withdrawn — v0.2 is legacy and slated for Tracking: GVM-331 covers the |
Triage of review passes 1-3Single status table for every finding raised in the review passes above, so none of them has to be Scope disclaimer — trusted partiesThis project trusts the host, the release manifest and the executor tarballs it names, and the LLM The bar that does apply: a contract must not be able to produce an Intended, not defects
Retracted
Fixed in this branchPass 1: attach missing the terminal event (3), non-atomic idempotency (4), Open, being addressed on this branch
Tracked elsewhere
Small items still standing
|
2a1a057 to
5296764
Compare
5296764 to
a9361a4
Compare
|
/run-e2e |
a9361a4 to
c4450a3
Compare
|
/run-e2e |
2 similar comments
|
/run-e2e |
|
/run-e2e |
There was a problem hiding this comment.
Actionable comments posted: 20
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
docs/website/src/impl-spec/appendix/manager-api.yaml (1)
263-277: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick winDocument the 404 these routes now return.
create_routeranswersnot_found()(404, JSON{"error": ...}) when the path id is not all-digits (implementation/src/manager/mod.rslines 294-296, 308-310, 327-329), but both response blocks only list200/500. Add a'404'entry so the route table matches the implementation. Also worth confirming whether the deprecatedDELETE /genvm/{genvm_id}still accepts theShutdownRequestquery parameters that the router parses — none are documented.Also applies to: 353-372
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/website/src/impl-spec/appendix/manager-api.yaml` around lines 263 - 277, Update the response definitions for both affected GenVM routes, including the block around the GenVM status response and the additional block around lines 353-372, to add a '404' response referencing the existing ErrorResponse schema. Keep the documented 200 and 500 responses unchanged, and ensure the deprecated DELETE route’s documented parameters match the ShutdownRequest query parameters parsed by create_router.implementation/src/scripting/mod.rs (1)
160-166: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick winNarrow
StdLib::OSbefore exposing it to module scripts.
StdLib::OSalso exposesos.execute,os.exit,os.getenv,os.remove,os.rename,os.tmpname, andos.setlocale; for LLM/Web modules,os.exitcan terminate the manager andos.getenvexposes provider/env state. If this is only foros.time/os.date/os.clock, nil out the others afterload_std_libs.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@implementation/src/scripting/mod.rs` around lines 160 - 166, Restrict the OS library exposed by the module scripting setup: after `load_std_libs`, remove `os.execute`, `os.exit`, `os.getenv`, `os.remove`, `os.rename`, `os.tmpname`, and `os.setlocale`, while preserving `os.time`, `os.date`, and `os.clock`. Update the initialization flow around `lua_libs` and `load_std_libs` so scripts retain only the required OS functions.
🧹 Nitpick comments (6)
implementation/src/manager/handlers.rs (1)
244-269: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winConsider capping
max_lenfor artifact reads.
ArtifactRequest.max_lenis unbounded on the handler side; a very large value could trigger a large allocation/response ifget_artifactdoesn't itself clamp it (not shown in this file). This overlaps with the "artifact/log allocation costs" item already noted as a remaining open item for this PR, so flagging here mainly as a pointer to add a cap (e.g. similar toSTATUS_WAIT_CAP) if not already enforced inrun.rs.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@implementation/src/manager/handlers.rs` around lines 244 - 269, Cap ArtifactRequest.max_len in handle_genvm_artifact before passing it to get_artifact, reusing the established artifact-read cap if one exists in the run context (otherwise add a suitable constant analogous to STATUS_WAIT_CAP). Ensure requests above the cap are clamped or rejected consistently with existing handler behavior, preventing oversized artifact allocations and responses.implementation/src/manager/mod.rs (2)
364-369: 🩺 Stability & Availability | 🔵 Trivial | 💤 Low valueConsider scoping
DefaultBodyLimit::disable()to the routes that need it.Applied as a router-wide layer, every POST (
/module/*,/log/level,/permits,/llm/check) also becomes unbounded, though only/genvm/runand/contract/detect-versioncarry large payloads. A per-routeDefaultBodyLimit::max(...)/disable()keeps the small admin endpoints bounded.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@implementation/src/manager/mod.rs` around lines 364 - 369, Scope DefaultBodyLimit::disable() to the /genvm/run and /contract/detect-version routes instead of applying it router-wide, and preserve the default body limit for /module/*, /log/level, /permits, and /llm/check. Update the router construction around the existing fallback and with_state chain using per-route layering.
185-265: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueOptional: collapse the repeated JSON-body closures.
/module/start,/module/stop,/module/restart,/log/level,/permits(POST) and/llm/checkrepeat the same parse-then-dispatch block. A small helper taking the handler fn would remove six copies.♻️ Sketch
async fn json_route<F, Fut>(ctx: sync::DArc<AppContext>, body: Bytes, handler: F) -> Response where F: FnOnce(sync::DArc<AppContext>, serde_json::Value) -> Fut, Fut: std::future::Future<Output = anyhow::Result<Response>>, { match parse_json_body(body) { Ok(body) => unwrap_all_anyhow(handler(ctx, body).await), Err(error) => bad_request(error), } }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@implementation/src/manager/mod.rs` around lines 185 - 265, Optionally reduce duplication by introducing a shared JSON route helper near the route setup that parses Bytes, returns the existing parse-error response, and dispatches the handler through unwrap_all_anyhow. Update the repeated closures for handle_module_start, handle_module_stop, handle_module_restart, handle_set_log_level, the POST permits handler, and the llm/check handler to use it while preserving their current routes and behavior.implementation/src/manager/socket.rs (2)
401-421: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low valueOptional: avoid copying the payload out of the received frame.
body[HEADER_LEN..].to_vec()copies up tomax_message_bytes(64 MiB by default) per frame.Message::Binaryalready yieldsBytes, sobody.slice(HEADER_LEN..)would hand the payload on without the allocation (decode_payloadtakes&[u8]).🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@implementation/src/manager/socket.rs` around lines 401 - 421, Update the frame-return path in the socket message handling flow to use a zero-copy slice of the received Bytes payload instead of allocating with to_vec(). Preserve the existing HEADER_LEN offset and the returned payload type expected by decode_payload, while leaving method and request validation unchanged.
569-581: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy liftError classification relies on comparing
anyhowdisplay strings.
e.to_string() == "boot_id_mismatch"ande.to_string() == "unknown_id"silently reclassify tounknown_id/malformed_framethe momentrun.rsadds context or rewords a message. Since the protocol codes are part of the documented contract (manager-socket.rst), a typed error enum (ordowncast_ref) fromrun_ctx.attach/get_artifactwould make this contract compiler-checked.Also applies to: 675-678
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@implementation/src/manager/socket.rs` around lines 569 - 581, Replace string-based anyhow error classification in the run_ctx.attach handling and the corresponding get_artifact path with typed error matching, using a shared error enum or downcast_ref. Map the typed boot_id_mismatch and unknown_id variants directly to Errors::BootIdMismatch and Errors::UnknownId, while preserving the existing fallback for other errors. Ensure added context does not change protocol classification.implementation/src/manager/run.rs (1)
922-924: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueStale, truncated doc comment above
unsafe_overrides.The preceding line still reads
/// Debug-only override: force the executor directory (a version dir under the— a sentence cut off whenreroute_tomoved intoUnsafeOverrides, which now carries its own docs. Drop it or replace it with a description of the struct field.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@implementation/src/manager/run.rs` around lines 922 - 924, Remove or replace the stale truncated doc comment immediately above the unsafe_overrides field in the relevant struct. Document unsafe_overrides itself accurately, without referencing the executor-directory behavior now owned by UnsafeOverrides documentation.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/adr/014`. manager host socket protocol.md:
- Around line 46-49: Update the fenced block containing the wire-format example
near the method_id/request_id layout to include an appropriate language
identifier, such as text, while leaving the example content unchanged.
In `@docs/contributing/howto/building/docs.md`:
- Around line 17-18: Make the shell commands in
docs/contributing/howto/building/docs.md lines 17-18 and
docs/contributing/howto/testing/integration.md line 83 shell-safe by replacing
the angle-bracket placeholders <out> and <version> with concrete values or
defined, quoted variables such as "$OUT" and "$VERSION".
In `@docs/contributing/howto/committing/git-third-party.md`:
- Around line 30-33: Update the committing instructions around the
nested-repository workflow to explicitly tell readers to return to the executor
repository root after committing inside the nested repository, before running
`git third-party save executor/third-party/wasmtime`. Preserve the existing path
and command.
In `@docs/contributing/howto/testing/python.md`:
- Around line 12-14: Update the Nix flake path in the testing command after
changing into the genlayer-py-std directory so it resolves to the
repository-root support/nix/py-test location; use the correct four-level
relative path or run the build from the repository root.
In `@docs/website/src/impl-spec/appendix/host-loop.rst`:
- Around line 131-149: Clarify the run_nested handler’s response framing around
manager_start_nested_sync: document whether failures use the standard errors/ok
prefix before the payload, matching resolve_callcontract_executor, eth_call, and
get_balance, or explicitly state that errors are encoded inside the reply
envelope. Ensure the pseudocode specifies the exact framing host implementers
must follow.
In `@docs/website/src/impl-spec/appendix/manager-api.rst`:
- Around line 9-12: Update the deprecation note in the manager API appendix to
include GET /genvm/{id}/artifact alongside the other execution endpoints,
preserving the stated one-release-train removal window and socket protocol
guidance. Also mark the corresponding artifact route as deprecated in the
manager API specification, using the existing deprecation metadata pattern.
In `@docs/website/src/impl-spec/appendix/manager-socket.rst`:
- Around line 128-135: Update the manager-socket documentation around the run
response to state that only some validation is synchronous and may cause the
request to return an internal error; do not claim the ID is always returned
immediately. Clarify that permit acquisition and process spawning continue
asynchronously, with subsequent failures reported through event notifications,
and retain the automatic event subscription behavior.
In
`@docs/website/src/spec/02-execution-environment/03-wasi_genlayer_sdk/02-gl_call.rst`:
- Around line 81-88: Update the delegation description around the “same derived
sub-VM” claim to qualify it for accepted delegations only. State that calls with
loaded custom runners are rejected, and that delegated sub-VM permissions
differ; reference the existing rules governing custom-runner rejection and
delegated permissions while preserving the equivalent observable results and
execution hashes for delegations that are accepted.
In `@executors/v0.2.x`:
- Line 1: Update the executors/v0.2.x gitlink to reference a commit reachable
from the configured remote, or fetch and publish the intended commit
2c2653992b798dd97a5362f49bb4581bd993fc18 before retaining the pointer; ensure
the final submodule reference is resolvable before merging.
In `@executors/v0.3.x`:
- Line 1: Update the gitlink for the executors/v0.3.x submodule from the
unavailable commit 96e758118e45f8edeafbe1331ef9619fe918f463 to a reachable
commit in the configured promisor remote, preserving the submodule dependency
while ensuring CI can check it out.
In `@implementation/src/manager/handlers.rs`:
- Around line 92-111: Bound the queued-execution wait in the run handler’s
`run_ctx.attach` flow with the existing `STATUS_WAIT_CAP`, applying the timeout
to each `events.changed()` await or the overall wait as consistent with
`handle_genvm_status`. Preserve normal event handling and return an appropriate
timeout error when no start event arrives within the cap.
- Around line 387-391: Build a provider-derived substitution map named
check_vars using the same config_vars context as the runtime LLM backend, then
pass check_vars to genvm_common::templater::patch_json when patching backend.
Preserve the existing DOLLAR_UNFOLDER_RE behavior and ensure config_data
placeholders are resolved before constructing the check backend.
In `@implementation/src/manager/mod.rs`:
- Around line 127-151: Introduce a bad_request response helper in the manager
module and route client-input parsing failures from parse_json_body,
parse_query, and deployment_timestamp through it instead of internal_error.
Return the appropriate 4xx response without logging these expected validation
failures at error level, while keeping internal_error for genuine handler or
server failures.
In `@implementation/src/manager/run.rs`:
- Around line 1526-1531: Update the run_nested reply-writing error path around
write_length_prefixed so that, after logging the failure, it immediately returns
from the enclosing loop/function instead of continuing to serve subsequent
requests. Preserve the existing successful-write flow and error logging.
In `@implementation/src/manager/socket.rs`:
- Around line 265-273: Update the serde_json::Value::Number handling to preserve
floating-point values instead of falling through to push_null(); encode the f64
representation using the encoder’s supported non-null representation, such as a
string, while retaining the existing i64 and u64 paths.
- Around line 50-78: Replace non-blocking control sends in async request
handling with awaited sends: add Writer::error_async using send_control_async,
and update the async reply/error call sites in
implementation/src/manager/socket.rs (lines 539, 545, 583, 603, 629, and
existing error callers) while retaining try_send only where awaiting is
impossible. No direct change is needed in
docs/website/src/impl-spec/appendix/manager-socket.rst lines 50-52 because the
documented guarantee remains correct after this code change.
- Around line 582-589: Update handle_attach so it sends the Attach response
through self.writer.send_control before subscribing with
self.subscribe(req.genvm_id, Ok(rx))?. Preserve the existing snapshot payload
and error propagation, ensuring terminal events cannot be emitted before the
attach response.
In `@install/config/genvm-manager.yaml`:
- Around line 11-12: Update the manager definition in
docs/schemas/default-config.json to declare execution_retention and
max_message_bytes alongside manifest_path and permits, using validators that
accept the configured duration and byte-limit values. Keep the schema aligned
with the defaults referenced by install/config/genvm-manager.yaml so schema
validation accepts both keys.
In `@support/scripts/check-source-text.py`:
- Around line 37-42: Update _violations() to scan the full source text rather
than only text.splitlines(), allowing the existing environment-mutation patterns
to match whitespace and newlines across multiline qualified calls, use imports,
and libc imports. Map each full-text match back to its corresponding source
line(s) so violations retain accurate reporting while continuing to detect
env::set_var, env::remove_var, libc mutation calls, and imported aliases.
In `@support/scripts/get-all-git.py`:
- Around line 155-162: Add a cross-process lock around the complete shared-cache
lifecycle in ensure_cache(), covering the existence check, repository
initialization, remote configuration, and fetch operations. Use a lock path
derived from the shared cache location returned by cache_path_for_url() or
git_common_dir(root), and ensure all callers serialize access before reading or
modifying the cache.
---
Outside diff comments:
In `@docs/website/src/impl-spec/appendix/manager-api.yaml`:
- Around line 263-277: Update the response definitions for both affected GenVM
routes, including the block around the GenVM status response and the additional
block around lines 353-372, to add a '404' response referencing the existing
ErrorResponse schema. Keep the documented 200 and 500 responses unchanged, and
ensure the deprecated DELETE route’s documented parameters match the
ShutdownRequest query parameters parsed by create_router.
In `@implementation/src/scripting/mod.rs`:
- Around line 160-166: Restrict the OS library exposed by the module scripting
setup: after `load_std_libs`, remove `os.execute`, `os.exit`, `os.getenv`,
`os.remove`, `os.rename`, `os.tmpname`, and `os.setlocale`, while preserving
`os.time`, `os.date`, and `os.clock`. Update the initialization flow around
`lua_libs` and `load_std_libs` so scripts retain only the required OS functions.
---
Nitpick comments:
In `@implementation/src/manager/handlers.rs`:
- Around line 244-269: Cap ArtifactRequest.max_len in handle_genvm_artifact
before passing it to get_artifact, reusing the established artifact-read cap if
one exists in the run context (otherwise add a suitable constant analogous to
STATUS_WAIT_CAP). Ensure requests above the cap are clamped or rejected
consistently with existing handler behavior, preventing oversized artifact
allocations and responses.
In `@implementation/src/manager/mod.rs`:
- Around line 364-369: Scope DefaultBodyLimit::disable() to the /genvm/run and
/contract/detect-version routes instead of applying it router-wide, and preserve
the default body limit for /module/*, /log/level, /permits, and /llm/check.
Update the router construction around the existing fallback and with_state chain
using per-route layering.
- Around line 185-265: Optionally reduce duplication by introducing a shared
JSON route helper near the route setup that parses Bytes, returns the existing
parse-error response, and dispatches the handler through unwrap_all_anyhow.
Update the repeated closures for handle_module_start, handle_module_stop,
handle_module_restart, handle_set_log_level, the POST permits handler, and the
llm/check handler to use it while preserving their current routes and behavior.
In `@implementation/src/manager/run.rs`:
- Around line 922-924: Remove or replace the stale truncated doc comment
immediately above the unsafe_overrides field in the relevant struct. Document
unsafe_overrides itself accurately, without referencing the executor-directory
behavior now owned by UnsafeOverrides documentation.
In `@implementation/src/manager/socket.rs`:
- Around line 401-421: Update the frame-return path in the socket message
handling flow to use a zero-copy slice of the received Bytes payload instead of
allocating with to_vec(). Preserve the existing HEADER_LEN offset and the
returned payload type expected by decode_payload, while leaving method and
request validation unchanged.
- Around line 569-581: Replace string-based anyhow error classification in the
run_ctx.attach handling and the corresponding get_artifact path with typed error
matching, using a shared error enum or downcast_ref. Map the typed
boot_id_mismatch and unknown_id variants directly to Errors::BootIdMismatch and
Errors::UnknownId, while preserving the existing fallback for other errors.
Ensure added context does not change protocol classification.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: c060afa2-a31d-471e-807d-257611a45f81
⛔ Files ignored due to path filters (23)
crates/modules-interfaces/Cargo.lockis excluded by!**/*.lock,!**/*.lockimplementation/Cargo.lockis excluded by!**/*.lock,!**/*.locksupport/tools/genvm-tool/genvm_tool/__main__.pyis excluded by!support/tools/genvm-tool/**support/tools/genvm-tool/genvm_tool/cmd_configure.pyis excluded by!support/tools/genvm-tool/**support/tools/genvm-tool/genvm_tool/cmd_docs.pyis excluded by!support/tools/genvm-tool/**support/tools/genvm-tool/genvm_tool/cmd_howto.pyis excluded by!support/tools/genvm-tool/**support/tools/genvm-tool/genvm_tool/codegen/model.pyis excluded by!support/tools/genvm-tool/**support/tools/genvm-tool/genvm_tool/codegen/rst.pyis excluded by!support/tools/genvm-tool/**support/tools/genvm-tool/genvm_tool/tests/util/watchdog.pyis excluded by!support/tools/genvm-tool/**support/tools/genvm-tool/genvm_tool/tests/util/watchdog_main.pyis excluded by!support/tools/genvm-tool/**tests/runner/genvm_tool_plugins/genvm.pyis excluded by!tests/**tests/runner/genvm_tool_plugins/integration.pyis excluded by!tests/**tests/runner/genvm_tool_plugins/ninja.pyis excluded by!tests/**tests/runner/gvm_extra/mock_host.pyis excluded by!tests/**tests/runner/origin/base_host.pyis excluded by!tests/**tests/runner/origin/host_fns.pyis excluded by!tests/**tests/runner/origin/logger.pyis excluded by!tests/**tests/runner/origin/manager_api.pyis excluded by!tests/**tests/system/cross-major-observability/test.pyis excluded by!tests/**tests/system/cross-major/test.pyis excluded by!tests/**tests/system/manager-socket/test.pyis excluded by!tests/**tests/system/permits/test.pyis excluded by!tests/**tests/templates/util.jsonnetis excluded by!tests/**
📒 Files selected for processing (75)
.claude/settings.fuzzing.json.claude/skills/agentic-fuzzing/SKILL.md.genvm-tool.pyCLAUDE.mdcrates/modules-interfaces/Cargo.tomlcrates/modules-interfaces/codegen/data/host-fns.jsoncrates/modules-interfaces/codegen/data/manager-api.jsoncrates/modules-interfaces/src/domain.rscrates/modules-interfaces/src/host_fns.rscrates/modules-interfaces/src/lib.rscrates/modules-interfaces/src/manager_api.rscrates/modules-interfaces/src/nested.rsdocs/README.mddocs/adr/014. manager host socket protocol.mddocs/adr/015. cross-major contract calls.mddocs/contributing/README.mddocs/contributing/explanation/README.mddocs/contributing/explanation/docs-layout.mddocs/contributing/explanation/executor-lines.mddocs/contributing/explanation/merge-model.mddocs/contributing/explanation/vendored-trees.mddocs/contributing/howto/README.mddocs/contributing/howto/building/build.mddocs/contributing/howto/building/docs.mddocs/contributing/howto/building/runners.mddocs/contributing/howto/committing/git-third-party.mddocs/contributing/howto/committing/runners.mddocs/contributing/howto/committing/submodules.mddocs/contributing/howto/docs/style.mddocs/contributing/howto/extending/add-host-function.mddocs/contributing/howto/extending/add-llm-provider.mddocs/contributing/howto/extending/add-wasi-function.mddocs/contributing/howto/extending/modify-runner.mddocs/contributing/howto/extending/modify-wasmtime.mddocs/contributing/howto/extending/write-a-script.mddocs/contributing/howto/genvm-tool.mddocs/contributing/howto/pr.mddocs/contributing/howto/releasing/release-build.mddocs/contributing/howto/releasing/versioning.mddocs/contributing/howto/setup.mddocs/contributing/howto/testing/README.mddocs/contributing/howto/testing/fuzzing.mddocs/contributing/howto/testing/integration.mddocs/contributing/howto/testing/python.mddocs/contributing/howto/testing/rust.mddocs/contributing/howto/write-a-script.mddocs/contributing/tutorial/README.mddocs/contributing/tutorial/first-contribution.mddocs/website/src/impl-spec/appendix/host-loop.rstdocs/website/src/impl-spec/appendix/index.rstdocs/website/src/impl-spec/appendix/manager-api.rstdocs/website/src/impl-spec/appendix/manager-api.yamldocs/website/src/impl-spec/appendix/manager-socket-consts.rstdocs/website/src/impl-spec/appendix/manager-socket.rstdocs/website/src/spec/02-execution-environment/03-wasi_genlayer_sdk/02-gl_call.rstdocs/website/src/spec/03-vm/01-startup.rstdocs/website/src/spec/03-vm/02-meta-properties.rstdocs/website/src/spec/03-vm/05-result.rstdocs/website/src/spec/04-contract-interface/04-upgradability.rstdocs/website/src/spec/appendix/constants.rstexecutors/v0.2.xexecutors/v0.3.ximplementation/Cargo.tomlimplementation/src/manager/handlers.rsimplementation/src/manager/handlers_test.rsimplementation/src/manager/mod.rsimplementation/src/manager/run.rsimplementation/src/manager/run_test.rsimplementation/src/manager/socket.rsimplementation/src/manager/socket_test.rsimplementation/src/manager/versioning.rsimplementation/src/scripting/mod.rsinstall/config/genvm-manager.yamlsupport/scripts/check-source-text.pysupport/scripts/get-all-git.py
💤 Files with no reviewable changes (2)
- docs/contributing/howto/write-a-script.md
- .claude/settings.fuzzing.json
| ``` | ||
| u16 method_id (BE) | u64 request_id (BE) | calldata(payload) | ||
| ``` | ||
|
|
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Specify a language for the fenced block.
Use a language identifier such as text for the wire-format example so Markdown tooling can validate the fence consistently.
🧰 Tools
🪛 markdownlint-cli2 (0.23.1)
[warning] 46-46: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/adr/014`. manager host socket protocol.md around lines 46 - 49, Update
the fenced block containing the wire-format example near the
method_id/request_id layout to include an appropriate language identifier, such
as text, while leaving the example content unchanged.
Source: Linters/SAST tools
| nix develop '.?submodules=1#gen-docs' --command \ | ||
| sphinx-build -q -b dirhtml docs/website/src <out> |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Make executable documentation placeholders shell-safe. Angle-bracket placeholders in bash commands are parsed as redirection operators rather than substituted values.
docs/contributing/howto/building/docs.md#L17-L18: replace<out>with a concrete directory or a defined, quoted variable such as"$OUT".docs/contributing/howto/testing/integration.md#L83-L83: replace<version>with a concrete version or a defined, quoted"$VERSION"variable.
📍 Affects 2 files
docs/contributing/howto/building/docs.md#L17-L18(this comment)docs/contributing/howto/testing/integration.md#L83-L83
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/contributing/howto/building/docs.md` around lines 17 - 18, Make the
shell commands in docs/contributing/howto/building/docs.md lines 17-18 and
docs/contributing/howto/testing/integration.md line 83 shell-safe by replacing
the angle-bracket placeholders <out> and <version> with concrete values or
defined, quoted variables such as "$OUT" and "$VERSION".
| 1. Edit, and **commit inside the nested repo** — patches come from the history | ||
| above the base commit | ||
| 2. `git third-party save executor/third-party/wasmtime`, path relative to the | ||
| current directory |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Clarify the working directory before git third-party save.
Step 1 tells the reader to commit inside the nested repository, but step 2 passes executor/third-party/wasmtime, which will not resolve if they remain there. Explicitly require returning to the executor repository root before running save.
Proposed clarification
-1. Edit, and **commit inside the nested repo** — patches come from the history
- above the base commit
-2. `git third-party save executor/third-party/wasmtime`, path relative to the
- current directory
+1. Edit, and **commit inside the nested repo** — patches come from the history
+ above the base commit, then return to the executor repository root
+2. From the executor repository root, run
+ `git third-party save executor/third-party/wasmtime`📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| 1. Edit, and **commit inside the nested repo** — patches come from the history | |
| above the base commit | |
| 2. `git third-party save executor/third-party/wasmtime`, path relative to the | |
| current directory | |
| 1. Edit, and **commit inside the nested repo** — patches come from the history | |
| above the base commit, then return to the executor repository root | |
| 2. From the executor repository root, run | |
| `git third-party save executor/third-party/wasmtime` |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/contributing/howto/committing/git-third-party.md` around lines 30 - 33,
Update the committing instructions around the nested-repository workflow to
explicitly tell readers to return to the executor repository root after
committing inside the nested repository, before running `git third-party save
executor/third-party/wasmtime`. Preserve the existing path and command.
| cd executors/v0.3.x/runners/genlayer-py-std | ||
| env_dir="$(nix build --no-link --print-out-paths path:../../support/nix/py-test)" | ||
| PYTHONPATH="$PWD/src:$PWD/src-emb" "$env_dir/bin/pytest" tests/ |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Fix the relative Nix flake path.
After cd executors/v0.3.x/runners/genlayer-py-std, ../../support/nix/py-test resolves to executors/v0.3.x/support/nix/py-test, not the repository-root support/nix/py-test. Use ../../../../support/nix/py-test or invoke the command from the repository root.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/contributing/howto/testing/python.md` around lines 12 - 14, Update the
Nix flake path in the testing command after changing into the genlayer-py-std
directory so it resolves to the repository-root support/nix/py-test location;
use the correct four-level relative path or run the build from the repository
root.
| execution_retention: 5m # finished executions are retained until ack or this TTL | ||
| max_message_bytes: 67108864 # 64 MiB manager websocket message cap |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
fd -t f 'default-config.json' -x jq '.properties.manager // .["$defs"] // .' {} | head -100
rg -n 'execution_retention|max_message_bytes' --glob '*.json'Repository: genlayerlabs/genvm-manager
Length of output: 3076
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== candidate files =="
fd -t f 'genvm-manager.yaml|default-config.json' .
echo
echo "== install/config/genvm-manager.yaml first 20 lines =="
file=$(fd -t f 'genvm-manager.yaml' . | head -n1)
if [ -n "${file:-}" ]; then
cat -n "$file" | sed -n '1,20p'
fi
echo
echo "== schema references and manager/additionalProperties occurrences =="
schema=$(fd -t f 'default-config.json' . | head -n1)
if [ -n "${schema:-}" ]; then
rg -n '"(\$id|additionalProperties|properties)"|manager|execution_retention|max_message_bytes|additionalProperties' "$schema" | sed -n '1,220p'
fi
echo
echo "== JSON path extraction if jq exists =="
if command -v jq >/dev/null 2>&1 && [ -n "${schema:-}" ]; then
jq 'def paths: path(..); def get(\$p): getpath(\$p);
{"\$id": .["$id"],
"$schema": .["$schema"],
"manager_path": paths[] as $p | select($p|map(tostring)|join(".")=="properties.manager") as $p | $p,
"manager_path_props": paths[] as $p | select($p|map(tostring)|join(".")|startswith("properties.manager.properties.")) as $p | $p,
"manager_additionalProperties": .properties.manager | getpath(paths[] | select(. as $p | ($p|map(tostring)|join("."))=="additionalProperties") // []) // null
}' "$schema" | sed -n '1,160p'
fiRepository: genlayerlabs/genvm-manager
Length of output: 2197
🏁 Script executed:
#!/bin/bash
set -euo pipefail
schema="docs/schemas/default-config.json"
echo "== manager schema lines 160-225 from $schema =="
sed -n '160,225p' "$schema" | nl -ba -v160
echo
echo "== manager properties exact names =="
python3 - <<'PY'
import json
from pathlib import Path
p = Path("docs/schemas/default-config.json")
data = json.loads(p.read_text())
manager = data.get("manager", {})
prop = manager.get("properties", {})
print(sorted(prop.keys()))
print("count:", len(prop))
keys = {"execution_retention", "max_message_bytes"}
for k in sorted(keys):
print(f"{k}:", prop.get(k))
PY
echo
echo "== remote schema existence and manager snippet =="
for url in \
"https://raw.githubusercontent.com/genlayerlabs/genvm/refs/heads/main/doc/schemas/default-config.json" \
"https://raw.githubusercontent.com/genlayerlabs/genvm/refs/heads/main/docs/schemas/default-config.json" \
"https://raw.githubusercontent.com/genlayerlabs/genvm/refs/heads/@GENVM_TAG@/doc/schemas/default-config.json" \
"https://raw.githubusercontent.com/genlayerlabs/genvm/refs/heads/@GENVM_TAG@/docs/schemas/default-config.json"
do
echo "-- $url --"
if curl -sSfI "$url" | grep -q '^HTTP/'; then
curl -sSf "$url" | sed -n '150,225p' | nl -ba -v150
else
echo "unavailable"
fi
doneRepository: genlayerlabs/genvm-manager
Length of output: 277
🏁 Script executed:
#!/bin/bash
set -euo pipefail
schema="docs/schemas/default-config.json"
echo "== manager schema lines 160-222 from $schema =="
sed -n '160,222p' "$schema"
echo
echo "== manager property names via Python =="
python3 - <<'PY'
import json
from pathlib import Path
p = Path("docs/schemas/default-config.json")
data = json.loads(p.read_text())
manager = data.get("manager", {})
prop = manager.get("properties", {})
print("manager_properties_count=", len(prop))
for k in sorted([m for m in prop if m in {"execution_retention", "max_message_bytes"} or len(m) > 20]):
print(f"{k}={prop[m] is not None}")
print("manager_additional_properties=", manager.get("additionalProperties"))
print("has_manager=", bool(manager))
PY
echo
echo "== local doc alternate file =="
ls -la doc/schemas/default-config.json 2>/dev/null || true
ls -la docs/schemas/default-config.json 2>/dev/null || true
echo
echo "== remote manifest/schema existence and manager snippets =="
python3 - <<'PY'
import json
from urllib.request import urlopen, Request
urls = [
"https://raw.githubusercontent.com/genlayerlabs/genvm/refs/heads/main/doc/schemas/default-config.json",
"https://raw.githubusercontent.com/genlayerlabs/genvm/refs/heads/main/docs/schemas/default-config.json",
"https://raw.githubusercontent.com/genlayerlabs/genvm/refs/heads/@GENVM_TAG@/doc/schemas/default-config.json",
"https://raw.githubusercontent.com/genlayerlabs/genvm/refs/heads/@GENVM_TAG@/docs/schemas/default-config.json",
]
for base in urls:
try:
req = Request(base, headers={"User-Agent": "CodeRabbit"})
with urlopen(req, timeout=15) as r:
data = json.load(r)
print(f"\n-- {base} -- status=", r.status, "size=", len(r.read(0).split()) if False else 0)
manager = data.get("manager", {})
props = manager.get("properties", {})
print("manager_exists=", bool(manager), "properties_count=", len(props), "additionalProperties=", manager.get("additionalProperties"))
for key in sorted({"threads", "execution_retention", "max_message_bytes"} & set(props.keys())):
print(f"profile_{key}=", bool(props.get(key)))
lines = base.rsplit("/", 1)[0].rsplit("/", 1)[-1].split("/", 1)[0].rsplit("/", 1)[-1]
print("path=", lines)
except Exception as e:
print(f"-- {base} -- error={type(e).__name__}: {e}")
PYRepository: genlayerlabs/genvm-manager
Length of output: 3354
Add the new manager keys to the config schema
install/config/genvm-manager.yaml references docs/schemas/default-config.json#/manager, and that manager schema only defines manifest_path/permits. Add execution_retention and max_message_bytes there, plus any schema validators required by these defaults, so schema-aware editors and CI do not reject the config.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@install/config/genvm-manager.yaml` around lines 11 - 12, Update the manager
definition in docs/schemas/default-config.json to declare execution_retention
and max_message_bytes alongside manifest_path and permits, using validators that
accept the configured duration and byte-limit values. Keep the schema aligned
with the defaults referenced by install/config/genvm-manager.yaml so schema
validation accepts both keys.
| def cache_path_for_url(root: Path, url: str) -> Path: | ||
| parsed = urlparse(url) | ||
| url_path = parsed.path if parsed.scheme else url.rsplit(':', 1)[-1] | ||
| name = Path(url_path).name or 'repo' | ||
| name = re.sub(r'\.git$', '', name) | ||
| name = re.sub(r'[^A-Za-z0-9._-]+', '-', name).strip('-') or 'repo' | ||
| digest = hashlib.sha256(url.encode()).hexdigest()[:16] | ||
| return root / '.git' / 'genvm-submodule-cache' / f'{name}-{digest}.git' | ||
| return git_common_dir(root) / 'genvm-submodule-cache' / f'{name}-{digest}.git' |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift
Serialize access to the shared submodule cache.
Using git_common_dir(root) makes one cache repository shared by linked worktrees, but ensure_cache() still performs an unlocked check/init/configure/fetch sequence. Concurrent setup can race on repository initialization, remote configuration, or fetch locks, leaving one invocation failed or consuming an incomplete cache. Add a cross-process lock around the cache lifecycle.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@support/scripts/get-all-git.py` around lines 155 - 162, Add a cross-process
lock around the complete shared-cache lifecycle in ensure_cache(), covering the
existence check, repository initialization, remote configuration, and fetch
operations. Use a lock path derived from the shared cache location returned by
cache_path_for_url() or git_common_dir(root), and ensure all callers serialize
access before reading or modifying the cache.
c4450a3 to
5eaa59b
Compare
|
/run-e2e |
1 similar comment
|
/run-e2e |
b57521d to
483a5a1
Compare
|
/run-e2e |
There was a problem hiding this comment.
Actionable comments posted: 4
♻️ Duplicate comments (2)
implementation/src/manager/mod.rs (2)
364-369: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winDisabling the body limit entirely makes every POST an unbounded memory sink.
Bytesextractors buffer the whole body, soDefaultBodyLimit::disable()lets a single client drive the manager to OOM. The WebSocket path is bounded byconfig.max_message_bytes; the HTTP path should use the same knob instead of no limit, which also preserves the JSON error shape for oversized bodies (413 only fires above the cap).🛡️ Proposed fix
- // Contract code and calldata routinely exceed the default cap, and an - // exceeded cap answers with a plain-text 413 rather than our error shape. - .layer(axum::extract::DefaultBodyLimit::disable()) + // Contract code and calldata routinely exceed axum's 2 MiB default, so + // raise the cap to the configured message size instead of removing it. + .layer(axum::extract::DefaultBodyLimit::max(app_ctx.config.max_message_bytes))🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@implementation/src/manager/mod.rs` around lines 364 - 369, Replace the unbounded DefaultBodyLimit::disable() layer in the manager router with a body limit derived from config.max_message_bytes, reusing the same cap as the WebSocket path. Preserve the existing router state and error handling so oversized HTTP requests remain bounded and return the established JSON 413 response.
127-165: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winClient input failures still return HTTP 500 and log at error level.
parse_json_body,parse_query, anddeployment_timestampfail on malformed client input, but every call site (module start/stop/restart, log/level, permits POST, genvm shutdown/status query, artifact query, llm/check, vm-error/describe query, contract/detect-version) still routes the error throughinternal_error. This returns a 500 status and logs at error level for a caller mistake, making real server faults indistinguishable from bad requests in logs and alerting.Add a
bad_requesthelper and use it for these parsing failures. Reserveinternal_errorfor genuine handler failures.♻️ Proposed helper
fn internal_error(error: anyhow::Error) -> Response { log_error!(err:ah = &error; "internal server error"); error_response(StatusCode::INTERNAL_SERVER_ERROR, format!("{:#}", error)) } + +fn bad_request(error: anyhow::Error) -> Response { + log_debug!(err:ah = &error; "rejected malformed request"); + error_response(StatusCode::BAD_REQUEST, format!("{:#}", error)) +}Also applies to: 190-193, 203-206, 216-219, 238-241, 258-261, 280-283, 297-300, 311-314, 330-333, 343-346, 356-359
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@implementation/src/manager/mod.rs` around lines 127 - 165, Update parse_json_body, parse_query, and deployment_timestamp error handling to use a new bad_request helper that returns HTTP 400 and logs client-input failures below error level. Change every affected handler call site, including module lifecycle, log level, permits, genvm, artifact, llm, vm-error, and contract endpoints, so parsing failures route through bad_request while genuine handler failures continue using internal_error.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/actions/get-src/action.yaml:
- Around line 15-21: Update the description for the nix_cache_pull_token input
to accurately state that source builds occur only when no cache credential is
available, including when no cache_pull_token is passed and the runner has no
existing /etc/nix/netrc. Remove the claim that an empty token alone always
forces source builds.
In `@docs/contributing/howto/genvm-tool.md`:
- Around line 20-27: Update the generated-output table in genvm-tool.md so the
host-fns.json row uses exact repository-relative paths and includes
docs/website/src/impl-spec/appendix/host-loop.rst alongside the Rust and Python
outputs. Replace the abbreviated …/src/... paths in the listed rows with their
complete paths, preserving the existing data-to-output mappings.
In `@docs/contributing/howto/testing/integration.md`:
- Line 20: Update the integration-testing documentation around the “stays
in-process” statement to clarify that omitting executor_routes means no explicit
route, not guaranteed in-process execution. Document that major validation still
applies and callers may delegate to a callee with an unsupported public-ABI
major via a minted major selector.
In `@implementation/src/manager/mod.rs`:
- Around line 167-178: Update the WebSocket configuration in create_router so
max_frame_size is set to ctx.config.max_message_bytes alongside
max_message_size, allowing unfragmented frames up to the configured message
limit.
---
Duplicate comments:
In `@implementation/src/manager/mod.rs`:
- Around line 364-369: Replace the unbounded DefaultBodyLimit::disable() layer
in the manager router with a body limit derived from config.max_message_bytes,
reusing the same cap as the WebSocket path. Preserve the existing router state
and error handling so oversized HTTP requests remain bounded and return the
established JSON 413 response.
- Around line 127-165: Update parse_json_body, parse_query, and
deployment_timestamp error handling to use a new bad_request helper that returns
HTTP 400 and logs client-input failures below error level. Change every affected
handler call site, including module lifecycle, log level, permits, genvm,
artifact, llm, vm-error, and contract endpoints, so parsing failures route
through bad_request while genuine handler failures continue using
internal_error.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 44cea3d5-6d9f-4947-aedd-24c93b6c0b84
⛔ Files ignored due to path filters (14)
crates/modules-interfaces/Cargo.lockis excluded by!**/*.lock,!**/*.lockimplementation/Cargo.lockis excluded by!**/*.lock,!**/*.locksupport/tools/genvm-tool/genvm_tool/cmd_configure.pyis excluded by!support/tools/genvm-tool/**tests/runner/genvm_tool_plugins/genvm.pyis excluded by!tests/**tests/runner/genvm_tool_plugins/integration.pyis excluded by!tests/**tests/runner/genvm_tool_plugins/ninja.pyis excluded by!tests/**tests/runner/gvm_extra/mock_host.pyis excluded by!tests/**tests/runner/origin/base_host.pyis excluded by!tests/**tests/runner/origin/host_fns.pyis excluded by!tests/**tests/runner/origin/manager_api.pyis excluded by!tests/**tests/system/cross-major-observability/test.pyis excluded by!tests/**tests/system/cross-major/test.pyis excluded by!tests/**tests/system/manager-socket/test.pyis excluded by!tests/**tests/system/permits/test.pyis excluded by!tests/**
📒 Files selected for processing (48)
.genvm-tool.py.github/actions/get-src/action.yaml.github/workflows/docs_nightly.yaml.github/workflows/incl_initial.yaml.github/workflows/incl_release_build_test_cell_build.yaml.github/workflows/incl_release_build_test_cell_test.yaml.github/workflows/queue_test_cell.yamlcrates/modules-interfaces/Cargo.tomlcrates/modules-interfaces/codegen/data/host-fns.jsoncrates/modules-interfaces/codegen/data/manager-api.jsoncrates/modules-interfaces/src/domain.rscrates/modules-interfaces/src/host_fns.rscrates/modules-interfaces/src/lib.rscrates/modules-interfaces/src/manager_api.rscrates/modules-interfaces/src/nested.rsdocs/adr/014. manager host socket protocol.mddocs/adr/015. cross-major contract calls.mddocs/contributing/explanation/executor-lines.mddocs/contributing/howto/building/docs.mddocs/contributing/howto/extending/add-host-function.mddocs/contributing/howto/genvm-tool.mddocs/contributing/howto/testing/integration.mddocs/website/src/impl-spec/appendix/host-loop.rstdocs/website/src/impl-spec/appendix/index.rstdocs/website/src/impl-spec/appendix/manager-api.rstdocs/website/src/impl-spec/appendix/manager-api.yamldocs/website/src/impl-spec/appendix/manager-socket-consts.rstdocs/website/src/impl-spec/appendix/manager-socket.rstdocs/website/src/spec/02-execution-environment/03-wasi_genlayer_sdk/02-gl_call.rstdocs/website/src/spec/03-vm/01-startup.rstdocs/website/src/spec/03-vm/02-meta-properties.rstdocs/website/src/spec/03-vm/05-result.rstdocs/website/src/spec/04-contract-interface/04-upgradability.rstdocs/website/src/spec/appendix/constants.rstexecutors/v0.2.xexecutors/v0.3.ximplementation/Cargo.tomlimplementation/src/manager/handlers.rsimplementation/src/manager/handlers_test.rsimplementation/src/manager/mod.rsimplementation/src/manager/run.rsimplementation/src/manager/run_test.rsimplementation/src/manager/socket.rsimplementation/src/manager/socket_test.rsimplementation/src/manager/versioning.rsimplementation/src/manager/versioning_test.rsimplementation/src/scripting/mod.rsinstall/config/genvm-manager.yaml
🚧 Files skipped from review as they are similar to previous changes (36)
- docs/website/src/spec/03-vm/02-meta-properties.rst
- docs/website/src/impl-spec/appendix/index.rst
- install/config/genvm-manager.yaml
- docs/website/src/spec/03-vm/05-result.rst
- docs/website/src/spec/appendix/constants.rst
- executors/v0.3.x
- docs/website/src/spec/04-contract-interface/04-upgradability.rst
- crates/modules-interfaces/src/lib.rs
- docs/website/src/spec/02-execution-environment/03-wasi_genlayer_sdk/02-gl_call.rst
- docs/website/src/impl-spec/appendix/manager-socket-consts.rst
- docs/contributing/howto/extending/add-host-function.md
- crates/modules-interfaces/Cargo.toml
- implementation/src/manager/socket_test.rs
- docs/website/src/impl-spec/appendix/manager-api.rst
- implementation/src/scripting/mod.rs
- crates/modules-interfaces/codegen/data/host-fns.json
- docs/website/src/spec/03-vm/01-startup.rst
- implementation/Cargo.toml
- crates/modules-interfaces/src/host_fns.rs
- .genvm-tool.py
- docs/website/src/impl-spec/appendix/host-loop.rst
- implementation/src/manager/run_test.rs
- implementation/src/manager/handlers_test.rs
- crates/modules-interfaces/src/manager_api.rs
- crates/modules-interfaces/src/nested.rs
- implementation/src/manager/versioning_test.rs
- crates/modules-interfaces/src/domain.rs
- crates/modules-interfaces/codegen/data/manager-api.json
- implementation/src/manager/socket.rs
- docs/contributing/explanation/executor-lines.md
- docs/website/src/impl-spec/appendix/manager-api.yaml
- docs/website/src/impl-spec/appendix/manager-socket.rst
- implementation/src/manager/versioning.rs
- implementation/src/manager/handlers.rs
- implementation/src/manager/run.rs
- docs/contributing/howto/building/docs.md
| `ninja -C build codegen` regenerates from data JSON; never edit an output by | ||
| hand. Host protocol data is per line, public ABI data comes from the primary one | ||
| hand. Host protocol data is shared, public ABI data comes from the primary line | ||
|
|
||
| | Data | Generated | | ||
| |---|---| | ||
| | `executors/<line>.x/executor/codegen/data/host-fns.json` | that line's `executor/crates/common/src/host_fns.rs`, `tests/runner/origin/host_fns.py` | | ||
| | `crates/modules-interfaces/codegen/data/host-fns.json` | `…/src/host_fns.rs`, `tests/runner/origin/host_fns.py` | | ||
| | `crates/modules-interfaces/codegen/data/manager-api.json` | `…/src/manager_api.rs`, `tests/runner/origin/manager_api.py`, `docs/website/src/impl-spec/appendix/manager-socket-consts.rst` | | ||
| | `executors/<primary>.x/executor/codegen/data/public-abi.json` | `tests/runner/origin/public_abi.py`, `docs/website/src/spec/appendix/constants.rst` | |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Make the codegen output table complete and exact.
Line 25 lists only Rust and Python outputs for host-fns.json, although the host protocol also generates RST output. The Rust paths also use …/src/... instead of repository-relative paths. Add the exact generated paths, including docs/website/src/impl-spec/appendix/host-loop.rst, so contributors know which files codegen updates.
Suggested table update
-| `crates/modules-interfaces/codegen/data/host-fns.json` | `…/src/host_fns.rs`, `tests/runner/origin/host_fns.py` |
-| `crates/modules-interfaces/codegen/data/manager-api.json` | `…/src/manager_api.rs`, `tests/runner/origin/manager_api.py`, `docs/website/src/impl-spec/appendix/manager-socket-consts.rst` |
+| `crates/modules-interfaces/codegen/data/host-fns.json` | `crates/modules-interfaces/src/host_fns.rs`, `tests/runner/origin/host_fns.py`, `docs/website/src/impl-spec/appendix/host-loop.rst` |
+| `crates/modules-interfaces/codegen/data/manager-api.json` | `crates/modules-interfaces/src/manager_api.rs`, `tests/runner/origin/manager_api.py`, `docs/website/src/impl-spec/appendix/manager-socket-consts.rst` |📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| `ninja -C build codegen` regenerates from data JSON; never edit an output by | |
| hand. Host protocol data is per line, public ABI data comes from the primary one | |
| hand. Host protocol data is shared, public ABI data comes from the primary line | |
| | Data | Generated | | |
| |---|---| | |
| | `executors/<line>.x/executor/codegen/data/host-fns.json` | that line's `executor/crates/common/src/host_fns.rs`, `tests/runner/origin/host_fns.py` | | |
| | `crates/modules-interfaces/codegen/data/host-fns.json` | `…/src/host_fns.rs`, `tests/runner/origin/host_fns.py` | | |
| | `crates/modules-interfaces/codegen/data/manager-api.json` | `…/src/manager_api.rs`, `tests/runner/origin/manager_api.py`, `docs/website/src/impl-spec/appendix/manager-socket-consts.rst` | | |
| | `executors/<primary>.x/executor/codegen/data/public-abi.json` | `tests/runner/origin/public_abi.py`, `docs/website/src/spec/appendix/constants.rst` | | |
| `ninja -C build codegen` regenerates from data JSON; never edit an output by | |
| hand. Host protocol data is shared, public ABI data comes from the primary line | |
| | Data | Generated | | |
| |---|---| | |
| | `crates/modules-interfaces/codegen/data/host-fns.json` | `crates/modules-interfaces/src/host_fns.rs`, `tests/runner/origin/host_fns.py`, `docs/website/src/impl-spec/appendix/host-loop.rst` | | |
| | `crates/modules-interfaces/codegen/data/manager-api.json` | `crates/modules-interfaces/src/manager_api.rs`, `tests/runner/origin/manager_api.py`, `docs/website/src/impl-spec/appendix/manager-socket-consts.rst` | | |
| | `executors/<primary>.x/executor/codegen/data/public-abi.json` | `tests/runner/origin/public_abi.py`, `docs/website/src/spec/appendix/constants.rst` | |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/contributing/howto/genvm-tool.md` around lines 20 - 27, Update the
generated-output table in genvm-tool.md so the host-fns.json row uses exact
repository-relative paths and includes
docs/website/src/impl-spec/appendix/host-loop.rst alongside the Rust and Python
outputs. Replace the abbreviated …/src/... paths in the listed rows with their
complete paths, preserving the existing data-to-output mappings.
483a5a1 to
98d3dfa
Compare
98d3dfa to
7b7f2c4
Compare
|
/run-e2e |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/adr/014`. manager host socket protocol.md:
- Around line 84-91: Update the ack protocol definition to bind acknowledgements
to the full durable run identity by including boot_id alongside genvm_id, or
explicitly validate ack requests against the connection’s current boot_id.
Ensure stale acknowledgements from a previous manager process cannot acknowledge
a newly reused genvm_id or release its retained result.
In `@docs/adr/015`. cross-major contract calls.md:
- Around line 109-116: Update the ADR’s ExecutorSelector contract so major
resolution cannot vary with manifest contents: require identical
manifests/version sets across validators, or require an explicit version
selector and reject unresolved major fallback. Preserve direct version and regex
selector behavior while ensuring the same (address, state, major) cannot route
to different executors.
In `@implementation/src/manager/versioning.rs`:
- Around line 196-217: Update the version-selection logic around the patch-chain
loop to start from the defined patch-chain base rather than the globally maximum
eligible version, advancing only through contiguous entries that satisfy
availability and matches predicates. Use checked patch increments to stop safely
at the integer maximum, and add regression tests covering missing intermediate
patches and maximum patch values.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 54952e01-4038-4410-a3b6-cc4e51e5deae
⛔ Files ignored due to path filters (14)
crates/modules-interfaces/Cargo.lockis excluded by!**/*.lock,!**/*.lockimplementation/Cargo.lockis excluded by!**/*.lock,!**/*.locksupport/tools/genvm-tool/genvm_tool/cmd_configure.pyis excluded by!support/tools/genvm-tool/**tests/runner/genvm_tool_plugins/genvm.pyis excluded by!tests/**tests/runner/genvm_tool_plugins/integration.pyis excluded by!tests/**tests/runner/genvm_tool_plugins/ninja.pyis excluded by!tests/**tests/runner/gvm_extra/mock_host.pyis excluded by!tests/**tests/runner/origin/base_host.pyis excluded by!tests/**tests/runner/origin/host_fns.pyis excluded by!tests/**tests/runner/origin/manager_api.pyis excluded by!tests/**tests/system/cross-major-observability/test.pyis excluded by!tests/**tests/system/cross-major/test.pyis excluded by!tests/**tests/system/manager-socket/test.pyis excluded by!tests/**tests/system/permits/test.pyis excluded by!tests/**
📒 Files selected for processing (42)
.genvm-tool.pycrates/modules-interfaces/Cargo.tomlcrates/modules-interfaces/codegen/data/host-fns.jsoncrates/modules-interfaces/codegen/data/manager-api.jsoncrates/modules-interfaces/src/domain.rscrates/modules-interfaces/src/host_fns.rscrates/modules-interfaces/src/lib.rscrates/modules-interfaces/src/manager_api.rscrates/modules-interfaces/src/nested.rsdocs/adr/014. manager host socket protocol.mddocs/adr/015. cross-major contract calls.mddocs/contributing/explanation/executor-lines.mddocs/contributing/howto/building/docs.mddocs/contributing/howto/extending/add-host-function.mddocs/contributing/howto/genvm-tool.mddocs/contributing/howto/testing/integration.mddocs/website/src/impl-spec/appendix/host-loop.rstdocs/website/src/impl-spec/appendix/index.rstdocs/website/src/impl-spec/appendix/manager-api.rstdocs/website/src/impl-spec/appendix/manager-api.yamldocs/website/src/impl-spec/appendix/manager-socket-consts.rstdocs/website/src/impl-spec/appendix/manager-socket.rstdocs/website/src/spec/02-execution-environment/03-wasi_genlayer_sdk/02-gl_call.rstdocs/website/src/spec/03-vm/01-startup.rstdocs/website/src/spec/03-vm/02-meta-properties.rstdocs/website/src/spec/03-vm/05-result.rstdocs/website/src/spec/04-contract-interface/04-upgradability.rstdocs/website/src/spec/appendix/constants.rstexecutors/v0.2.xexecutors/v0.3.ximplementation/Cargo.tomlimplementation/src/manager/handlers.rsimplementation/src/manager/handlers_test.rsimplementation/src/manager/mod.rsimplementation/src/manager/run.rsimplementation/src/manager/run_test.rsimplementation/src/manager/socket.rsimplementation/src/manager/socket_test.rsimplementation/src/manager/versioning.rsimplementation/src/manager/versioning_test.rsimplementation/src/scripting/mod.rsinstall/config/genvm-manager.yaml
🚧 Files skipped from review as they are similar to previous changes (39)
- docs/website/src/spec/03-vm/02-meta-properties.rst
- docs/website/src/spec/appendix/constants.rst
- docs/website/src/impl-spec/appendix/index.rst
- docs/contributing/explanation/executor-lines.md
- implementation/src/scripting/mod.rs
- install/config/genvm-manager.yaml
- implementation/src/manager/handlers_test.rs
- docs/website/src/spec/03-vm/05-result.rst
- executors/v0.3.x
- crates/modules-interfaces/src/lib.rs
- docs/website/src/impl-spec/appendix/manager-api.rst
- docs/website/src/spec/02-execution-environment/03-wasi_genlayer_sdk/02-gl_call.rst
- docs/contributing/howto/building/docs.md
- executors/v0.2.x
- docs/contributing/howto/testing/integration.md
- crates/modules-interfaces/Cargo.toml
- crates/modules-interfaces/codegen/data/manager-api.json
- implementation/src/manager/socket_test.rs
- .genvm-tool.py
- crates/modules-interfaces/src/host_fns.rs
- crates/modules-interfaces/src/manager_api.rs
- docs/contributing/howto/extending/add-host-function.md
- implementation/src/manager/run_test.rs
- docs/website/src/spec/03-vm/01-startup.rst
- crates/modules-interfaces/src/nested.rs
- docs/contributing/howto/genvm-tool.md
- implementation/Cargo.toml
- crates/modules-interfaces/codegen/data/host-fns.json
- docs/website/src/impl-spec/appendix/manager-socket-consts.rst
- docs/website/src/spec/04-contract-interface/04-upgradability.rst
- implementation/src/manager/socket.rs
- implementation/src/manager/handlers.rs
- docs/website/src/impl-spec/appendix/host-loop.rst
- docs/website/src/impl-spec/appendix/manager-api.yaml
- implementation/src/manager/mod.rs
- implementation/src/manager/versioning_test.rs
- crates/modules-interfaces/src/domain.rs
- implementation/src/manager/run.rs
- docs/website/src/impl-spec/appendix/manager-socket.rst
| - `run` allocates and returns a manager-assigned `GenVMId` **immediately**; | ||
| spawning proceeds asynchronously and outcomes arrive as events. | ||
| - `next_genvm_id` starts at 1 and resets on process start (`run.rs:277`), so a | ||
| bare id is ambiguous across manager restarts. The manager generates a random | ||
| **`boot_id`** per process start and announces it in a `hello` notification | ||
| on every connection; the durable run key is `(boot_id, genvm_id)`. `attach` | ||
| carries both and fails with `boot_id_mismatch` after a restart instead of | ||
| binding to an unrelated reused id. |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Bind ack to the full run identity.
Lines 84-91 define (boot_id, genvm_id) as the durable key, but Lines 117-123 define ack with only genvm_id. Because IDs reset after restart, a stale ack {genvm_id: 1} can acknowledge a new run that reuses ID 1 and release its retained result. Include boot_id in ack, or validate the acknowledgement against the connection's current boot_id.
Also applies to: 117-123
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/adr/014`. manager host socket protocol.md around lines 84 - 91, Update
the ack protocol definition to bind acknowledgements to the full durable run
identity by including boot_id alongside genvm_id, or explicitly validate ack
requests against the connection’s current boot_id. Ensure stale acknowledgements
from a previous manager process cannot acknowledge a newly reused genvm_id or
release its retained result.
| let mut ver = manifest | ||
| .executor_versions | ||
| .iter() | ||
| .filter(|(ver, ev)| matches(ver) && ev.available_after <= timestamp) | ||
| .map(|(ver, _)| *ver) | ||
| .max()?; | ||
|
|
||
| // Walk forward to the newest contiguous patch, but only adopt a patch | ||
| // whose time gate has already opened. Skipping `available_after` here | ||
| // would activate a future (or rc) patch prematurely, which during a | ||
| // rolling update with staged manifests causes consensus divergence. The | ||
| // patch must satisfy the same predicate: a major cannot change under a | ||
| // patch bump, but a pattern the caller wrote can stop matching. | ||
| loop { | ||
| let mut next = ver; | ||
| next.patch += 1; | ||
| match manifest.executor_versions.get(&next) { | ||
| Some(ev) if ev.available_after <= timestamp && matches(&next) => { | ||
| ver = next; | ||
| } | ||
| _ => break, | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Enforce patch continuity before selecting the maximum version.
Line 201 selects the global maximum eligible version. The loop then starts after the last eligible patch, so it cannot detect a gap. For example, available v0.3.0 and v0.3.2 entries return v0.3.2 when v0.3.1 is absent.
Line 211 can also overflow at the integer maximum. Start from the defined patch-chain base, advance with checked_add, and add gap and maximum-patch regression tests.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@implementation/src/manager/versioning.rs` around lines 196 - 217, Update the
version-selection logic around the patch-chain loop to start from the defined
patch-chain base rather than the globally maximum eligible version, advancing
only through contiguous entries that satisfy availability and matches
predicates. Use checked patch increments to stop safely at the integer maximum,
and add regression tests covering missing intermediate patches and maximum patch
values.
|
/run-e2e |
|
/run-e2e |
4 similar comments
|
/run-e2e |
|
/run-e2e |
|
/run-e2e |
|
/run-e2e |
|
❌ Merge blocked: no approving review on |
|
/genvm-force-merge |
|
|
* feat(manager): websocket run protocol and cross-major contract calls * feat(manager): run cross-major contract calls as nested runs ✨ * feat(manager): make cross-contract call resolution opt-in ✨ * feat(manager): refuse nested envelopes asserting unserviceable permissions 🔒️ * fix(manager): refuse a nested reply carrying any reported effect 🔒️🐛 * fix(manager): stop the call route from being consensus-visible 🐛🔒️ * refactor(manager): serve executions over an event-driven websocket ♻️ * fix(manager): harden the run socket protocol 🔒️🐛 * fix(manager): drop runtime env mutation and open the lua stdlib 🔒️ * chore(codegen): generate host-fns and socket ids from one definition ♻️ * refactor(harness): compare the executor execution hash directly ♻️ * test(harness): route a call across a major boundary from jsonnet ✅ * fix(manager): report consumed_result as bytes, not an integer array 🐛
f37733c to
12a0b4d
Compare
|
✅ Merged into |
Closes GVM-298
Closes GVM-318
Closes GVM-342
Changeset
Depends-On: genlayerlabs/genlayer-node#1647
Depends-On: genlayerlabs/genlayer-studio#1716
Depends-On: #9
Summary by CodeRabbit