Skip to content

perf(runtime): reduce Host Code Mode polling turns - #696

Merged
yyjeqhc merged 4 commits into
mainfrom
perf/host-native-execution-economy
Sep 26, 2026
Merged

yyjeqhc merged 4 commits into
mainfrom
perf/host-native-execution-economy

Conversation

@yyjeqhc

@yyjeqhc yyjeqhc commented Sep 26, 2026

Copy link
Copy Markdown
Owner

Summary

Make Host-native Code Mode the effective model-guidance default when the MCP Host is configured for it, and make normal pending Job handoff explicitly de-polling without changing canonical Job execution or recovery semantics.

This PR contains three commits:

  • fix(workflow): inherit model guidance from MCP host profile
  • perf(jobs): make pending observation continuation fallback-only
  • fix(jobs): keep passive pending guidance conditional

Effective guidance profile

work_on_project.guidance_profile now preserves omission instead of collapsing it to direct during deserialization. The effective profile follows one rule:

explicit request
    >
configured MCP Host profile
    >
Direct fallback

Therefore:

  • MCP Host direct + omitted request -> Direct
  • MCP Host host_code_mode + omitted request -> HostCodeMode
  • HostCodeMode + explicit direct -> Direct
  • Direct Host + explicit host_code_mode -> HostCodeMode
  • non-MCP/internal omission -> Direct
  • feature-gated explicit code_mode keeps existing behavior

The implementation reuses McpHostRuntimePolicy::effective_guidance_profile; it adds no second Host capability flag or environment variable. WEBCODEX_MCP_HOST_PROFILE remains the MCP Host profile source.

The same resolver feeds startup guidance, requested webcodex.workflow context projection, and model-ergonomics profile reporting. Explicit JSON null remains invalid rather than being treated as omission.

Pending Job execution economy

Canonical Job receipts, durable identity, observation tokens, Runner ownership, and passive Job-attention authority are unchanged.

Normal model-facing same-execution handoff remains sparse, but now carries a short strategy:

default                  = continue_independent_work
passive terminal         = same-scope may surface when eligible
observe continuation     = logs/details/recovery fallback
observe auto-follow      = false
blocked fallback         = wait_for_job_terminal

The exact parser-ready observe_jobs continuation is retained for recovery and explicit detail inspection; it is no longer presented as the default next action. No automatic durable wait or App continuation is created.

Review fix

Independent review found two contract issues and fixed them in 2007452f:

  1. passive_terminal_attention: true over-promised delivery even when the current call lacks the exact Window/Project/business-Session/auth eligibility required by passive attention. It now says same_scope_may_surface, preserving the existing authority boundary.
  2. One strict cargo_check pending-output fixture had not been propagated with the new required pending_strategy, causing the full tool-contract output-schema suite to fail. The fixture now represents the actual model-facing pending shape; the schema was not weakened.

Validation

Implementation session reported focused validation of 25/25 relevant tests, affected checks, fmt and diff-check, with no full root-suite rerun by design.

Independent review additionally verified:

  • webcodex-tool-contracts --lib: 239/239 passed
  • pending Job model projection focused runtime test: 1/1 passed
  • MCP Host profile workflow-context focused runtime test: 1/1 passed
  • affected cargo check --all-targets --features experimental-code-mode for webcodex and webcodex-tool-contracts: passed
  • cargo fmt --all -- --check: passed
  • git diff --check: passed

Existing unrelated test warning about ObservedRunnerRequest.login remains.

Non-goals

This PR does not:

  • change Job execution/ownership/retry semantics;
  • widen passive Job-attention authority;
  • poll the Runner for passive attention;
  • remove observe_jobs recovery;
  • automatically create terminal waits or MCP App continuations;
  • change global/non-MCP CodingGuidanceProfile::default() away from Direct;
  • add new telemetry or analytics.

@yyjeqhc
yyjeqhc merged commit 20abda5 into main Sep 26, 2026
15 of 17 checks passed
@yyjeqhc
yyjeqhc deleted the perf/host-native-execution-economy branch September 26, 2026 13:45
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