⬆️Upgrade an On-Chain Tool Without Losing Its Nexus Identity
Package installation, Tool-pointer mutation, registry endorsement, and live rerun are separate transactions and proofs. None automatically performs another. Install consumer interfaces through the public Move Registry package records and keep Move.lock matched to the target network; use the public nexus-move-packages repository only for offline source/provenance inspection or a deployment-matched source closure.
Complete Prepare for On-Chain Development before this upgrade guide. Its resolved public dependencies, selected-network package IDs, and committed Move.lock are prerequisites for deciding whether the replacement package is compatible.
Actual actors and authority
Package upgrader
Owns the package UpgradeCap; authorizes a Sui package upgrade in that lineage.
Tool owner
Holds CloneableOwnerCap<OverTool> bound to the Tool; authorizes its package-pointer change.
ToolRegistry administrator
Holds ToolRegistryAdminCap bound to the registry; changes verified endorsement.
DAG/Task controller
The DAG owner changes graph/schema; the address or Agent controller operates Tasks.
verified = false is not a registry-wide execution pause for registered on-chain Tools. A maintenance window is operational: stop known clients from scheduling the DAG and let known Tasks reach a safe terminal/settled state.
1. Establish the baseline
Complete Build an on-chain Tool, then record:
package initial/storage IDs, version,
UpgradeCapID/owner/policy;Tool ID, FQN, module, schema, witness, package pointer, owner capability, ToolCashier relationship, and endorsement;
DAG ID/owner and its Tool/schema snapshot;
runtime state and one successful Task, Occurrence, Execution, result, and settlement.
nexus tool inspect --tool-fqn "$TOOL_FQN" --json > tool-before.json
nexus dag inspect --dag-id "$DAG_ID" --json > dag-before.json
sui client object "$PACKAGE_ID" --json > package-before.json
sui client object "$UPGRADE_CAP_ID" --json > upgrade-cap.json
sui client object "$RUNTIME_STATE_ID" --json > state-before.jsonPreserve the successful baseline input and scheduling receipt exactly. The post-pointer run must use the same normalized values, not a manually reconstructed equivalent.
2. Quiesce known work
Freeze applications and operators that schedule this FQN/DAG.
Inventory known Tasks through owned
TaskPointerobjects and recorded Task IDs.Inspect each Occurrence and its Execution.
Settle finished work, expire missed occurrences, abort only expired Executions, cancel future work, and close Tasks only after their Schedule is idle and in-flight count is zero.
Use nexus task and nexus execution. A public DAG has no reverse index that proves an unknown actor cannot schedule it, so monitor for new work throughout the window.
3. Decide whether a compatible upgrade is possible
Keep the old package when it remains compatible and no behavior change is required. Upgrade when dependency linkage, package compatibility, or an intentional implementation change requires a new package version.
Register a new Tool identity instead when the FQN, module, positional input schema, output variants, or witness contract changes incompatibly. The existing Tool's MetaSchema is immutable and the pointer operation does not rewrite it.
Verify the candidate
Before changing any pointer, verify the package lineage, UpgradeCap ownership and policy, dependency IDs and type origins, public execute signature, stored MetaSchema, witness requirements, and application-state invariants. Build, test, and dry-run the candidate as described below; stop if any check fails or remains unproven.
4. Build, test, dry-run, and install
Stop on any capability, policy, dependency, ABI, schema, witness, environment, or gas failure. Execute the same upgrade without --dry-run only after review, save its effects, and extract the unique new package storage ID from the successful published object change:
At this boundary the new package exists, but the registered Tool still points to the old package.
5. Dry-run and migrate the Tool pointer
The V2 LTS SDK target exposes migrate_on_chain_tool_package_ptb; the equivalent public Move call is useful when the CLI has no dedicated subcommand:
After the dry-run succeeds, execute the same PTB without --dry-run. The call:
requires the owner capability bound to this Tool;
rejects unregistered and HTTP Tools;
rejects the pre-upgrade package address;
preserves Tool ID, FQN, module, witness, schema, owner, registry, and ToolCashier relationship;
changes only the package pointer and resets
verifiedtofalse;emits
ToolUpdatedEvent, which identifies the Tool/FQN but not the new package address.
Always inspect the Tool after the transaction and require its package pointer to equal NEW_PACKAGE_ID. An event alone is not sufficient readback.
The same verification reset applies to every identity-bearing Tool migration: changing an off-chain URL, mutable metadata/description, or the on-chain package pointer sets the registry endorsement to verified = false. The registration-time MetaSchema remains immutable, so an incompatible schema requires a new Tool identity. Revalidate the final URL/metadata/package behavior and obtain fresh registry-admin endorsement before resuming the intended operational trust posture. This endorsement is governance/audit state; it is separate from the Tool's RegisteredKey or External result-verifier support, which governs how an off-chain result proves itself after the Tool is admitted, and neither is an Invocation-admission gate.
6. Renew endorsement
After reviewing the candidate and pointer readback, the ToolRegistry administrator may set endorsement with the active Nexus Tool package:
Execute without --dry-run only under the bound administrator capability, then inspect the same Tool again. Endorsement is governance/audit state, not traffic containment; keep client scheduling frozen until the live proof passes.
7. Capture the baseline receipt and replay the same operation
Capture the baseline Task, Occurrence, and payment state before the upgrade. Keep the original scheduling receipt with these readbacks; it is the manifest for the replay, not a reason to infer defaults:
Record these fields from the saved receipt and readbacks before constructing the replay: ORIGINAL_OPERATION_KIND (dag or agent-skill), the DAG_ID or AGENT_ID plus SKILL_ID selector, ENTRY_GROUP, FUNDING_MODE (address or agent), REFUND_RECIPIENT when address-funded, FAILURE_POLICY (continue or pause), the exact input file/context, and the original scheduling/timing arguments. Use the same configured signer, network, wallet/session, and Agent authority; those authorization facts are part of the evidence context and are not interchangeable with a different signer. Stop if any required value is absent rather than silently substituting --dag-id, --now, or a new funding source.
Build the supported nexus task schedule arguments conditionally so the replay keeps the baseline selector and policy:
If the baseline used a recurrence or another timing option, preserve the exact supported option from the CLI Task reference in the manifest and extend the SCHEDULE_MODE case before running the replay. Do not represent a different operation as equivalent merely because it reaches the same DAG.
Follow the returned Occurrence, inspect its Execution, settle it, and compare:
Tool/DAG/FQN/module/schema/witness/runtime-state identities remain stable;
the operation selector, entry group, funding mode, refund recipient, failure policy, signer/Agent authorization context, and input context match the baseline;
Tool package pointer is
NEW_PACKAGE_IDand reviewed endorsement has the intended value;normalized
OnchainToolResultvariant/payload and business-state delta match the baseline contract;reserve, consumption, settlement, and refund balance under the Task lifecycle.
Task/Occurrence/Execution IDs, transactions, checkpoints, object versions/digests, gas, and latency will differ. Record them without requiring equality.
Forward-only failure table
Upgrade dry-run
Nothing committed
Correct the candidate and rerun.
Package install
New package exists; Tool pointer remains old
Validate the installed target, then migrate the pointer; do not blindly reinstall.
Tool pointer change
New pointer committed; endorsement false
Inspect, review, endorse if appropriate, then live-test.
Endorsement
New pointer and reviewed endorsement
Keep scheduling frozen until live proof; fix forward if behavior fails.
Live rerun
Package and pointer remain committed
Recover the Task where possible and ship a forward-compatible recovery release; cross-transaction package rollback is not assumed.
Test evidence and residual gap
Move and SDK tests can prove package-local behavior and pointer-transaction invariants. They do not replace a real package upgrade plus preserved-DAG rerun against the target deployment. The live Task/Occurrence/Execution proof closes that final gap.
References and next
Last updated

