Skip to content

refactor: make tool surface policy explicit and sink inactive continuations - #772

Merged
yyjeqhc merged 9 commits into
mainfrom
refactor/tool-surface-policy-and-naming
Sep 29, 2026
Merged

yyjeqhc merged 9 commits into
mainfrom
refactor/tool-surface-policy-and-naming

Conversation

@swjnxyf

@swjnxyf swjnxyf commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

This branch makes Adaptive Runtime model-surface policy explicit, removes inactive fresh-turn continuation descriptors from the ordinary Host surface, and clarifies that accepted input aliases are ergonomic model-turn savings rather than API compatibility.

The branch was rebased onto ced97978cb250c1d3b01434c2585d27c9ecda931 (#770) before the independent review:

  • reviewed branch base: ced97978cb250c1d3b01434c2585d27c9ecda931
  • head: 47e6ca9dd585455a0d04bda3191ed423c9ea2f4c
  • 8 commits, worktree clean at review

While review/validation was running, main advanced once more to d4626687b53f30dfd1b555bd84a860e819375db5 (#771). The branch is therefore currently behind main by one commit. A read-only merge-tree check found no conflict markers, and GitHub reports the PR as mergeable. Per repository rules, no second rebase/history rewrite was performed without a new explicit request.

What changes

Explicit Direct policy

ToolDefinition now owns one optional:

ToolAdaptiveDirectPolicy {
    rank,
    reason,
}

with ToolDirectReason::{CoreWorkflow, HostIntegration, Presentation, Continuation}.

Rank and reason can no longer drift as independent metadata. The policy remains presentation/routing-only: it does not affect category, authority, effect, risk, approval, idempotency, Runner capability, or model-facing output/schema.

Current default Direct surface has no Continuation entries. Dedicated descriptors are justified as:

  • CoreWorkflow: ordinary high-frequency coding/runtime primitives
  • HostIntegration: Host-native integration that a generic gateway cannot reproduce
  • Presentation: explicit MCP App presentation entries
  • Continuation: reserved for future fresh-turn continuation exposure when the Host supports it reliably

Inactive continuation surface is sunk

  • wait_for_job_terminal: Direct -> Gateway
  • wait_for_agent_events: Direct -> Gateway
  • present_agent_continuation: Direct -> ModelHidden
  • present_job_terminal_continuation: Direct -> ModelHidden

Durable Job/Agent wait state, ToolCalls, handlers, authorization, keyed replay, resources, and hidden App protocol remain intact.

The two presentation tools are deliberately not routed through call_runtime_tool: their App resource association requires their dedicated descriptor when/if they are re-admitted.

present_work_result and present_goal_plan remain Direct Presentation tools. import_conversation_files_to_project remains Direct HostIntegration.

ModelWorkflowPolicy / WEBCODEX_MCP_APP_RESUME_MODE remain guidance/delivery policy and do not dynamically change tools/list or ToolDefinition routing.

Generated SuggestedToolCall projections now follow the current canonical route on both schema and value sides:

  • wait edges project through call_runtime_tool
  • unavailable continuation-presentation edges are removed fail-closed
  • MCP-added Job continuation suggestions also check canonical Direct policy

Recommended flows retain the canonical recipes internally but ordinary discovery omits flows containing hidden model operations.

Ergonomic input aliases

argv -> args for structured process calls is documented and implemented as model-turn-economy normalization, not compatibility:

  • alias only -> canonicalize
  • canonical only -> accept
  • canonical + identical alias -> canonicalize
  • canonical + different alias -> reject ambiguity
  • unknown spellings remain rejected

The canonical ToolCall keeps only args. The stable input_normalization=argv_to_args observation remains.

Retired endpoint name

Default Adaptive Runtime no longer registers/parses attach_agent_endpoint; the canonical name is rotate_agent_continuation_endpoint.

The old name is retained only under the frozen legacy-gpt-actions feature because that adapter is a concrete consumer. This is an intentionally narrow legacy exception and should disappear with GPT Actions rather than become a pattern for new aliases.

Model-surface measurement

Deterministic compact tools/list measurements on the reviewed rebased HEAD:

profile Apps count compact bytes
anonymous off 22 58,959
anonymous on 40 78,863
scoped off 23 60,900
scoped on 41 80,804
admin off 29 69,788
admin on 47 89,692

These are serialized result bytes, not token counts or RPC-envelope sizes.

Compared with the branch's recorded pre-change baseline, ordinary advertised tool count drops by four per profile while the 18 App-only protocol descriptors remain present when Apps are enabled.

Independent review

The branch was independently reviewed after the user rebased it onto #770.

Review focus:

No production-code blocker or correctness issue was found, so no artificial review-fix commit was added.

One known bounded exception remains: a build with legacy-gpt-actions still compiles the old endpoint ToolDefinition/ToolCall spelling so the frozen adapter can parse it. The default Adaptive build does not expose it. Fully adapter-localizing this retiring alias would add structure only for a feature scheduled for removal.

Validation

Post-rebase review validation:

  • webcodex-tool-contracts: 255 passed
  • webcodex --lib: 3098 passed, 0 failed, 3 ignored
  • model surface focused: 28 passed
  • Agent continuation App focused: 10 passed
  • Job terminal continuation App focused: 4 passed
  • webcodex-tool-contracts --features legacy-gpt-actions: 256 passed
  • root legacy GPT Actions routing focused: 2 passed
  • compact tools/list serialization budget: passed
  • cargo fmt --all -- --check: passed
  • git diff --check origin/main...HEAD: passed

The full root library run is after the #770 rebase, so #770's typed Job-query/post-record projection changes are included in this evidence. #771 merged after that run; its overlap with this branch was checked read-only and GitHub currently reports the PR mergeable, but this branch has not been rebased/retested on top of #771.

No full workspace/release/E2E run was performed.

No deployment or Server/Runner restart was performed.

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