Skip to content

feat(agent): expand Code Mode nestable tools and remove WorkHub - #6688

Merged
M4n5ter merged 1 commit into
rust-previewfrom
feat/code-mode-expand-nestable-tools
Nov 7, 2026
Merged

M4n5ter merged 1 commit into
rust-previewfrom
feat/code-mode-expand-nestable-tools

Conversation

@M4n5ter

@M4n5ter M4n5ter commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Summary

  1. Expand Code Mode tool nesting:
    • Mark the default product installation's ui (Plugin*) and agent (ModelList and all 17 Session* exports) service tools nestable: true in products/maka/bundle/src/installation.ts.
    • Mark built-in ScheduledTask and Bot SendUser ToolNesting::Nestable in maka-agent-native.
    • Keep only genuine provider-hosted, turn-lifecycle, stateful REPL, and blocking user-dialog tools direct-only (openai.web_search / anthropic.web_search_20250305, Bot sleep, cua_repl / cua_reset, and AskUserQuestion).
  2. Preserve JavaScript number semantics & boundary safety in maka-js-runtime:
    • Serialize tool and store() inputs synchronously via bootstrap-captured JSON.stringify before entering async op wrappers so exit() inside input getters short-circuits cleanly and non-JSON inputs (BigInt, cyclic objects, Symbol) reject before dispatch without double JSON.parse/JSON.stringify round-trips.
    • Decode op_maka_tool, op_maka_store, plugin request inputs, and Code Mode cell return values via json::decode_str / json::decode (serde_json js_numbers) so safe integers outside i32 (such as millisecond Unix timestamps passed to ScheduledTask) stay exact integers while inexact wide integers (2 ** 60) stay floats.
    • Isolate REPL bridge helper bindings inside an inner closure in maka:repl/bootstrap so facade bootstrap declarations never collide or observe internal ops.
  3. Preserve Bot resume behavior & headless native grant upgrades:
    • Populate basis.behavior in Owner::prepare_resume under ResumePurpose::Admit so queue promotions and unconsumed steering continuations retain Bot tools (SendUser, sleep) and the Bot system prompt.
    • Rebase Metadata.native by full NativeGrant equality in products/maka/cli/src/application/product/headless/publication.rs so untouched baseline routes update or prune cleanly on upgrade while user-modified grants and explicit opt-outs are preserved.
  4. Remove WorkHub, maka-graph, and orphaned orchestration/managed-session/Plan infrastructure (zero compatibility branches):
    • Delete plugins/workhub/, plugins/agent/graph/, plugins/agent/api/src/workhub*, plugins/agent/native/src/workhub*, plugins/agent/native/src/owner/graph.rs, and plugins/shared/agent-imports.ts.
    • Remove dead WorkHub port/receipt surfaces (maka-agent-ports::execution::{CreateRoot, ChildSession, RemoveSession, Message, Commands} and maka-event-log plugin_message_receipts / plugin_execution_receipts), BehaviorId / TurnOrchestration / orchestration_mode / with_behavior, PluginSession.managed / session_manager / RemovalAuthority / ManagedSession, MessageOrigin::Workhub* & retired Plan / Configuration.plans remnants, SessionKind, wh_ session namespaces, multi-agent WorkHub external-agent settings synchronization, and unused workspace dependencies across Rust crates, SQLite schema, maka-schema, generated Plugin SDK declarations, product bundle/CLI/ACP/Workbench, DEPENDENCIES.rust.tsv, tests, and EN/ZH documentation.

State Root Migration

No runtime compatibility shims or legacy schema branches are retained. To migrate an existing local runtime-rust.sqlite State Root across this PR, stop any running maka desktop/headless Host on that State Root and run the offline migration script:

curl -fsSLO https://gist.githubusercontent.com/M4n5ter/49999d99102c4695338c3736c26240bb/raw/migrate_maka_state_root.py
python3 migrate_maka_state_root.py /path/to/state-root --dry-run
python3 migrate_maka_state_root.py /path/to/state-root

The script creates a timestamped runtime-rust.sqlite.bak.<UTC> backup via SQLite's online backup API before committing, drops retired plugin_message_receipts / plugin_execution_receipts tables and plugin_sessions.managed, cleans retired WorkHub/coordinator/Plan configuration & grant entries, normalizes persisted CollaborationMode / MessageBasis / MessageOrigin / scheduled-task ExecutionTemplate records, updates _sqlx_migrations version 1's SHA-384 checksum, and verifies PRAGMA foreign_key_check + PRAGMA quick_check inside a single atomic transaction.

Verification

  • node scripts/ci.mjs check format — passed
  • node scripts/ci.mjs check licenses — passed
  • node scripts/ci.mjs check notices — passed
  • node scripts/ci.mjs check tooling-tests — passed (256 pass, 0 fail)
  • node scripts/ci.mjs run product — passed
  • node scripts/ci.mjs run contracts — passed (schema:generate check, plugin-sdk acceptance types, bundle tsc, maka-workbench ui_types + tsc)
  • node scripts/ci.mjs run bridge — passed (including maka-computer-use unit & REPL integration suites)
  • node --test products/maka/workbench/tests/bot-transcript.test.mjs — passed (20/20)
  • cargo clippy --locked -p maka-js-runtime -p maka-agent-facts -p maka-agent-ports -p maka-tool-catalog -p maka-agent-authority -p maka-scheduler -p maka-goal --all-targets -- -D warnings — passed
  • cargo nextest run --locked -p maka-js-runtime -p maka-agent-facts -p maka-agent-ports -p maka-presentation -p maka-event-log -p maka-tool-catalog -p maka-tools -p maka-agent-engine -p maka-scheduler -p maka-goal -p maka-acp -p maka-agent-api -p maka-processes-native -p maka-host-runtime — passed
  • cargo nextest run --locked -p maka-agent-native --lib -E 'test(code_mode) | test(session_tools) | test(scheduler) | test(bot) | test(checkpoints) | test(fork) | test(external) | test(terminal) | test(metrics) | test(skills) | test(file_browsing) | test(queue) | test(execution) | test(goal) | test(approval_park) | test(recall)' — passed
  • cargo test --locked -p maka-cli --bin maka — passed (57/57, including expanded publication::tests)
  • cargo test --locked -p maka-cli --test integration product_composition — passed
  • cargo test --locked -p maka-cli --test integration external_agents_ui_consent_native_catalog_cache_and_failure_isolation — passed
  • Offline migrate_maka_state_root.py dry-run, real migration, backup creation, and idempotent re-run against pre-PR 0001_runtime.sql fixture — passed
  • Did not run macOS/Windows native shell suites locally on Linux.

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: Antigravity — codebase census, 3-agent adversarial review & convergence, implementation of Code Mode tool nesting and maka-js-runtime numeric/boundary fixes, Bot resume & headless native-grant rebase fixes, full removal of WorkHub/maka-graph and orphaned orchestration/managed-session/Plan infrastructure across Rust/TypeScript/docs, offline State Root migration script & verification, and local test suites.

Checklist

  • Tests cover the change and fail without it
  • Format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary and State Root Migration above
  • No

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed the persisted message-origin compatibility path at ba714994235b153e441cf491b6071bee6174a060. This is a scoped finding, not a complete review of the 125-file change.

[P2] Preserve a migration/read path for existing WorkHub message origins. plugins/agent/facts/src/message.rs:35 removes WorkhubTask and WorkhubGraph from the serde-tagged MessageOrigin enum. The previous production notification writers emit these values (workhub/tasks/notifications.rs and workhub/tasks/graph/notifications.rs), so a Root that has run this feature can already contain {"kind":"workhub_task","taskId":"…"} or {"kind":"workhub_graph","graphId":"…"} in its durable messages. Removing the service does not rewrite those records.

The retained readers still deserialize them into this enum: platform/event-log/src/transcript/navigation.rs:236 (decode_origin), transcript/history.rs:696 (row header), and transcript/source.rs:250 (source lookup) propagate the serde error. Consequently, reading an affected old history row or its navigation/source metadata fails after upgrading. Please supply an explicit migration or retain a read representation for historical provenance, with a regression that writes the former variants and reads them using the upgraded history path. Replacing old fixture origins with BotWorker does not exercise that upgrade.

I reproduced both failures using the old/new production enum declarations and the actual retained decode_origin function in an isolated Rust/serde harness. Each value serializes and round-trips with the old enum, then fails the new reader with unknown variant; retained Bot/Goal and absent-origin controls pass. The harness removes the schema derive and uses an equivalent Invocation dependency; it is not a full application/database restart test. I am not claiming that every Root fails to open.

This head currently has no checks, and an actual merge with rust-preview 34f6721cf97659f011d740f712a0d3fa58a80a13 reports conflicts in owner.rs and owner/skills.rs. The author’s reported suites remain author results: I have not executed the V8/native tool-nesting suites or validated the complete WorkHub removal and upgrade.


Automated review notice: This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.

@M4n5ter
M4n5ter force-pushed the feat/code-mode-expand-nestable-tools branch from ba71499 to 7320edc Compare November 7, 2026 09:58

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rechecked database upgrade and historical message decoding at 7320edc8c1d48c497465b7e6d73d03b8437ed389. These are scoped compatibility findings; I have not completed the expanded 206-file review.

[P1] Existing Rust Roots are rejected by the changed migration-1 checksum. The changes to platform/event-log/migrations/0001_runtime.sql remove a persisted column and two receipt tables from the already-applied migration. schema.rs still supplies only version 1, and opening a database calls migration::run; that runner rejects an applied migration whose SQL bytes have changed. This affects an existing Root created by current rust-preview, including one that has never used WorkHub. See the inline finding for the reproduction and required forward upgrade path.

I compiled the production migration.rs unchanged in an isolated harness using the repository's rusqlite 0.41.0 and sha2 0.11.1, with the complete SQL from current base 34f6721c and this head. Installing/reopening the old schema succeeds, and installing/reopening a fresh new schema succeeds. Running the new migration list on the old database fails with migration 1 was previously applied with a different checksum. Its rollback preserves the original ledger and releases the savepoint. Only the crate-level error enum is supplied by the harness; this is an execution of the actual SQLite migration logic, not a full application restart test.

[P2] The previously reported historical-origin failure remains. This head still removes WorkhubTask and WorkhubGraph while retained history, navigation and source readers deserialize their stored JSON into MessageOrigin. I reran the old/new production enum declarations and actual retained decode_origin: both old variants round-trip with the old enum and fail the new reader with unknown variant; Bot, Goal and absent-origin controls pass. Fixing the schema upgrade alone will not migrate those message origins. This result is limited to affected historical records and does not by itself establish a failure for every Root.

The previous textual merge conflicts are resolved: an actual merge with 34f6721cf97659f011d740f712a0d3fa58a80a13 succeeds. CI 42361978253 is still running at this check; its preliminary successes do not establish the final result. I have not executed the full V8/native tool-nesting, Bot-resume or native-grant upgrade suites, validated all removed infrastructure, or upgraded a real user's database. The author-reported tests remain author results.


Automated review notice: This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.

scope_id TEXT NOT NULL,
fingerprint TEXT NOT NULL,
managed INTEGER NOT NULL CHECK(managed IN (0, 1)),
authority_session_id TEXT,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Keep the applied migration immutable and add a forward upgrade

This changes the bytes of migration 1, which an existing Rust Root has already recorded in _sqlx_migrations. schema::initialize_connection still passes only version 1 to migration::run, and migration.rs:112 rejects its changed SHA384 checksum before the Root opens. I ran that production module with the full old/new schemas: old→old and fresh new→new pass; old→new returns migration 1 was previously applied with a different checksum. No WorkHub data is needed to reproduce it.

Please preserve the old migration and provide a new version that removes the obsolete column/tables, or an explicit validated offline upgrade, with an old-Root reopen regression. Fresh-database tests cannot cover this path.

- Enable `nestable: true` across the default installation's `ui` (`Plugin*`) and `agent` (`ModelList`, `Session*`) service tools, and switch `ScheduledTask` and Bot `SendUser` to `ToolNesting::Nestable`, while keeping protocol-hosted web search, Bot `sleep`, `cua_repl`/`cua_reset`, and `AskUserQuestion` direct-only.
- Preserve JavaScript numeric semantics across `maka-js-runtime` tool, scratch-store, plugin-request, and cell-return boundaries: serialize tool/store inputs synchronously in JS before entering async ops so `exit()` and non-JSON values short-circuit cleanly, decode JSON strings with `serde_json` `js_numbers` (`json::decode_str`) so safe integers outside `i32` stay exact integers while wide integers like `2 ** 60` stay floats, and isolate REPL bridge helpers from facade bootstrap bindings.
- Populate Bot `behavior` in `Owner::prepare_resume` so queue promotions and unconsumed steering continuations retain Bot tools and system prompt, and rebase headless `NativeGrant`s by full grant equality during CLI product upgrades.
- Remove `maka-graph`, `workhub`, `coordinator*` composition paths, `maka-agent-ports`/`maka-event-log` plugin execution/message receipts, `BehaviorId`/`TurnOrchestration`/`orchestration_mode`, `PluginSession.managed`/`RemovalAuthority`/`ManagedSession`, retired `Plan` and `Configuration.plans` remnants, and unused workspace dependencies across Rust crates, SQLite schema, generated Plugin SDK, product bundle, CLI, ACP, Workbench, tests, and EN/ZH documentation.

Generated-by: Antigravity
@M4n5ter
M4n5ter force-pushed the feat/code-mode-expand-nestable-tools branch from 7320edc to be54d7a Compare November 7, 2026 10:38
@M4n5ter
M4n5ter merged commit 4f3f3ea into rust-preview Nov 7, 2026
2 checks passed
@M4n5ter
M4n5ter deleted the feat/code-mode-expand-nestable-tools branch November 7, 2026 10:38

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked the documented offline upgrade for final head be54d7a783df026d0271e3e6db7b8caca5dca878, merged as 4f3f3eaa89e2b1f9d36ecf79cc3e920fffc3b909. I read the 12-file follow-up delta and the complete 756-line linked migration script. This remains a scoped compatibility review, not a complete review of all 212 changed files.

The new offline path addresses the previously reported schema-checksum and retired-origin failures in ordinary-path fixtures. Both script checksum constants match the actual previous/final SQL. Using the supplied CLI and the complete previous schema, I checked dry-run rollback, a real migration with its default backup, preservation of unrelated package bytes/revision and message text, logical idempotence with an explicit no-backup rerun. A direct call with a controlled late failure also rolls back the preceding DDL and data changes. The production migration runner accepts the migrated fixture, and the retained origin decoder accepts the rewritten origin values. These are disposable SQLite/controlled JSON fixtures; I have not validated a real user's complete Root or restarted the full application. Existing Roots still require the documented offline migration before opening the new runtime.

[P2] Encode the backup source URI before migrating paths containing # or ?. In the migration script, backup_database opens f"file:{source_path}?mode=ro" with uri=True. A valid pathname containing URI syntax is therefore interpreted as a different SQLite URI. The CLI can report successful backup and migration while the backup is not the database being changed.

I reproduced this with disposable State Root directories named has#fragment and has?query. The unmodified CLI exits successfully and migrates the target to the 102-table new schema, but each purported backup contains zero tables, rather than the 104-table previous database. In another direct-filename check, a runtime-rust.sqlite#copy target is migrated while its backup contains a marker from the neighboring runtime-rust.sqlite, which the target never contained. An ordinary Unicode pathname backs up correctly. Replacing only the backup source construction with source_path.resolve().as_uri() + "?mode=ro" makes the same special-path controls preserve the complete old schema and ledger. Please use an encoded, read-only source URI and add a backup-content regression before recommending this destructive offline upgrade for those paths.

CI is now terminal, and the previous pending status is obsolete. The final-head run 42364787862 fails the parent/child desktop permission journey after 76.215 seconds; the merged run 42364822430 fails the same journey after 74.262 seconds. Both logs report no single control labelled “Approve child decision.” This journey was already failing on the preceding Rust base, and I have not established its cause. The earlier 7320edc8 run was cancelled. I did not execute the complete native/V8/upgrade suites locally, and these findings do not complete the remaining removal and lifecycle review.


Automated review notice: This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants