Skip to content

refactor(core): centralize tool context runtime bindings#839

Merged
limityan merged 1 commit into
GCWing:mainfrom
limityan:yanzhn/refactor-tool-runtime-hr2
May 22, 2026
Merged

refactor(core): centralize tool context runtime bindings#839
limityan merged 1 commit into
GCWing:mainfrom
limityan:yanzhn/refactor-tool-runtime-hr2

Conversation

@limityan
Copy link
Copy Markdown
Collaborator

@limityan limityan commented May 22, 2026

Summary

  • Move ToolUseContext runtime/service bindings out of framework.rs into core-owned tool_context_runtime.rs.
  • Keep framework.rs focused on context shape, portable facts projection, and the Tool trait.
  • Centralize pipeline, manifest-description, and write-preflight ToolUseContext materialization in the same runtime binding owner.
  • Preserve existing custom_data shape, same-key overwrite order, cancellation state, runtime restrictions, workspace services, and Deep Review parent-context propagation.
  • Add boundary-script anchors so runtime coordination, workspace runtime lookup, path policy, context materialization, cancellation/post-call hooks, and checkpoint collection do not drift back into framework or execution internals.
  • Update core decomposition docs and core AGENTS guidance to describe the current owner boundary accurately.

Behavior and Boundary Notes

This remains a structure-only runtime owner closure. It does not migrate ToolUseContext, runtime service handles, concrete tools, collapsed unlock state, GetToolSpecTool, product tool registry snapshots, or product feature/build assembly out of core.

The additional tool-related cleanup only moves remaining production context construction for prompt manifest description and write preflight into the same core-owned binding module. It preserves the current field values and insertion order, including the existing context_vars overwrite behavior for manifest description custom_data.

The latest rebase to gcwing/main completed without conflicts. The latest main-side change observed in this rebase does not affect the tool-runtime plan or document assumptions.

Regression Coverage

  • remote workspace containment
  • runtime URI workspace-scope validation
  • path policy allow/block behavior
  • tool-call cancellation hook behavior
  • tool task context materialization, including existing custom_data keys and Deep Review parent metadata
  • manifest-description context materialization shape
  • write-preflight context materialization shape
  • write-preflight existing-file behavior
  • Deep Review shared-context post-call measurement path

Validation

  • rustfmt --edition 2024 --check --config skip_children=true src\crates\core\src\agentic\tools\tool_context_runtime.rs src\crates\core\src\agentic\execution\execution_engine.rs src\crates\core\src\agentic\execution\round_executor.rs src\crates\core\src\agentic\tools\framework.rs src\crates\core\src\agentic\tools\pipeline\tool_pipeline.rs src\crates\core\src\agentic\tools\mod.rs
  • node scripts\check-core-boundaries.mjs
  • $env:BITFUN_BOUNDARY_CHECK_SELF_TEST='1'; node scripts\check-core-boundaries.mjs
  • git diff --check gcwing/main..HEAD
  • cargo test -p bitfun-core tool_context_runtime -- --nocapture
  • cargo test -p bitfun-core pipeline_preserves_core_owned_tool_context_without_portable_runtime_leak -- --nocapture
  • cargo test -p bitfun-core shared_context_tests -- --nocapture
  • cargo test -p bitfun-core write_preflight -- --nocapture
  • cargo check -p bitfun-core --features product-full
  • cargo check -p bitfun-core --no-default-features

@limityan limityan force-pushed the yanzhn/refactor-tool-runtime-hr2 branch from 9b9f18f to 71476dc Compare May 22, 2026 07:27
Move ToolUseContext runtime/service helpers out of the tool framework into a core-owned runtime binding module. Centralize pipeline, manifest description, and write preflight context materialization there as well, while preserving existing custom_data, cancellation, path policy, runtime URI, remote containment, and Deep Review hook behavior behind focused regressions and boundary checks.
@limityan limityan force-pushed the yanzhn/refactor-tool-runtime-hr2 branch from 71476dc to d6a1774 Compare May 22, 2026 08:01
@limityan limityan merged commit 5ae1d35 into GCWing:main May 22, 2026
4 checks passed
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.

1 participant