Skip to content

feat(shared): Introduce MIDSCENE_MODEL_FAMILY for unified model configuration#1456

Merged
quanru merged 17 commits into
1.0from
feat/planning-style-unified-config
Nov 18, 2025
Merged

feat(shared): Introduce MIDSCENE_MODEL_FAMILY for unified model configuration#1456
quanru merged 17 commits into
1.0from
feat/planning-style-unified-config

Conversation

@quanru

@quanru quanru commented Nov 14, 2025

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI 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.

Pull Request Overview

This PR introduces a unified MIDSCENE_PLANNING_STYLE environment variable to replace multiple MIDSCENE_USE_* variables, simplifying model configuration while maintaining backward compatibility.

  • Replaces five legacy environment variables with a single MIDSCENE_PLANNING_STYLE parameter supporting 8 planning styles
  • Implements auto-inference of planning style from model names with deprecation warnings for legacy variables
  • Adds comprehensive validation, error handling, and 39 new test cases

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
packages/shared/src/env/types.ts Adds TPlanningStyle type, PLANNING_STYLE_VALUES array, and MIDSCENE_PLANNING_STYLE constant definition
packages/shared/src/env/parse.ts Implements core parsing logic with inference, conversion, legacy detection, and validation functions
packages/shared/src/env/decide-model-config.ts Integrates new parsing logic for 'planning' intent with warning output
packages/shared/tests/unit-test/env/parse.test.ts Adds 39 test cases covering inference, conversion, legacy compatibility, and validation
packages/shared/tests/unit-test/env/modle-config-manager.test.ts Updates tests with planning style configuration and enhanced environment cleanup
packages/shared/tests/unit-test/env/decide-model.test.ts Updates test snapshots to reflect new planning style integration

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/shared/tests/unit-test/env/modle-config-manager.test.ts Outdated
Comment thread packages/shared/src/env/parse.ts Outdated
Comment thread packages/shared/src/env/decide-model-config.ts Outdated
Comment thread packages/shared/src/env/decide-model-config.ts Outdated
Comment thread packages/shared/src/env/parse.ts Outdated
Comment thread packages/shared/src/env/parse.ts Outdated
@quanru quanru force-pushed the feat/planning-style-unified-config branch from c590770 to a9ed26d Compare November 14, 2025 10:50
Replace multiple MIDSCENE_USE_* environment variables with a single
MIDSCENE_PLANNING_STYLE parameter to simplify model configuration.

## Changes

### New Environment Variable
- Added MIDSCENE_PLANNING_STYLE with supported values:
  - default (equivalent to qwen3)
  - qwen2.5, qwen3
  - doubao-1.5, doubao-1.6
  - ui-tars-1.0, ui-tars-1.5
  - gemini

### Core Features
1. Auto-inference from model name: Automatically detect planning
   style from model name if not configured
2. Legacy compatibility: Support old MIDSCENE_USE_* variables
   with deprecation warnings
3. Conflict detection: Error when both new and legacy variables
   are set
4. Comprehensive validation: Validate planning style values and
   provide clear error messages

### Implementation Details
- Added type definitions in types.ts
- Implemented parsing logic in parse.ts:
  - inferPlanningStyleFromModelName()
  - convertPlanningStyleToVlMode()
  - parsePlanningStyleFromEnv()
- Integrated into decide-model-config.ts for planning intent
- All warnings output via console.warn()

### Testing
- Added 39 new test cases covering:
  - Model name inference
  - Planning style conversion
  - Legacy variable compatibility
  - Error handling
  - All planning style values
- Updated existing tests
- All 162 tests passing

## Migration Guide

Before (deprecated):
  MIDSCENE_USE_QWEN3_VL=1
  MIDSCENE_USE_VLM_UI_TARS=DOUBAO-1.5

After (recommended):
  MIDSCENE_PLANNING_STYLE=qwen3
  MIDSCENE_PLANNING_STYLE=ui-tars-1.5

Old environment variables still work with deprecation warnings.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@quanru quanru force-pushed the feat/planning-style-unified-config branch from 8356006 to 7af6cb2 Compare November 14, 2025 11:02
…lMode

- Added non-null assertion for vlMode property
- Explicitly destructure parsed result instead of using spread operator
- vlMode is guaranteed to be non-undefined since vlModeRaw is always valid

Fixes build error: Type 'TVlModeTypes | undefined' is not assignable to
type 'TVlModeTypes'
@quanru quanru force-pushed the feat/planning-style-unified-config branch from 89ec171 to 9c0aa2a Compare November 14, 2025 11:20
- Prioritize ui-tars check before doubao
- ui-tars + 1.5 → vlm-ui-tars-doubao-1.5
- ui-tars + 1.0 → vlm-ui-tars
- ui-tars (no version) → vlm-ui-tars-doubao (Volcengine deployment)
- doubao (non-UI-TARS) → doubao-vision

This ensures models deployed on Volcengine are correctly identified.
@quanru quanru force-pushed the feat/planning-style-unified-config branch from a9ae51f to 74f2ed9 Compare November 17, 2025 02:32

Copilot AI 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.

Pull Request Overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/shared/src/env/parse.ts Outdated
Comment on lines +262 to +282
if (intent === 'planning') {
const parseResult = parsePlanningStyleFromEnv(allEnvConfig);
vlMode = parseResult.vlMode;
uiTarsVersion = parseResult.uiTarsVersion;

// Output warnings to debug log
parseResult.warnings.forEach((warning) => {
console.warn(`[Midscene] ${warning}`);
});

if (parseResult.planningStyle) {
debugLog(`Using planning style: ${parseResult.planningStyle}`);
}
} else {
// For other intents, use the old parsing logic
const parsed = parseVlModeAndUiTarsModelVersionFromRawValue(
result.vlModeRaw,
);
vlMode = parsed.vlMode;
uiTarsVersion = parsed.uiTarsVersion;
}

Copilot AI Nov 17, 2025

Copy link

Choose a reason for hiding this comment

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

This code block is duplicated almost identically at lines 319-337. Consider extracting this logic into a helper function to reduce code duplication and improve maintainability.

Suggested refactoring:

const parseVlModeForIntent = (
  intent: TIntent,
  allEnvConfig: Record<string, string | undefined>,
  result?: { vlModeRaw?: TVlModeValues }
): { vlMode?: TVlModeTypes; uiTarsVersion?: UITarsModelVersion } => {
  if (intent === 'planning') {
    const parseResult = parsePlanningStyleFromEnv(allEnvConfig);
    
    parseResult.warnings.forEach((warning) => {
      console.warn(`[Midscene] ${warning}`);
    });
    
    if (parseResult.planningStyle) {
      debugLog(`Using planning style: ${parseResult.planningStyle}`);
    }
    
    return {
      vlMode: parseResult.vlMode,
      uiTarsVersion: parseResult.uiTarsVersion,
    };
  }
  
  // For other intents, use appropriate parsing logic
  const parsed = result 
    ? parseVlModeAndUiTarsModelVersionFromRawValue(result.vlModeRaw)
    : parseVlModeAndUiTarsFromGlobalConfig(allEnvConfig);
    
  return {
    vlMode: parsed.vlMode,
    uiTarsVersion: parsed.uiTarsVersion,
  };
};

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@copilot open a new pull request to apply changes based on this feedback

Comment thread packages/shared/src/env/decide-model-config.ts Outdated
Comment thread packages/shared/tests/unit-test/env/modle-config-manager.test.ts
Comment on lines +257 to +271
/**
* Planning style values - unified model configuration approach
* Replaces the old MIDSCENE_USE_* environment variables
*
* Note: These values directly correspond to VL_MODE_RAW_VALID_VALUES
* - 'default' is equivalent to 'qwen3-vl'
* - 'qwen-vl' is Qwen 2.5
* - 'qwen3-vl' is Qwen 3
*/
export type TPlanningStyle = 'default' | TVlModeValues;

export const PLANNING_STYLE_VALUES: TPlanningStyle[] = [
'default',
...VL_MODE_RAW_VALID_VALUES,
];

Copilot AI Nov 17, 2025

Copy link

Choose a reason for hiding this comment

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

The PR description claims to support planning style values like qwen2.5, qwen3, doubao-1.5, doubao-1.6, ui-tars-1.0, and ui-tars-1.5, but the actual implementation uses different values:

PR Description (Incorrect):

  • qwen2.5 - Qwen 2.5 VL model
  • qwen3 - Qwen 3 VL model
  • doubao-1.5 - Doubao Vision 1.5
  • doubao-1.6 - Doubao Vision 1.6
  • ui-tars-1.0 - UI-TARS version 1.0
  • ui-tars-1.5 - UI-TARS version 1.5

Actual Implementation:

  • qwen-vl - Qwen 2.5 VL model
  • qwen3-vl - Qwen 3 VL model
  • doubao-vision - Doubao Vision
  • vlm-ui-tars - UI-TARS version 1.0
  • vlm-ui-tars-doubao-1.5 - UI-TARS with Doubao 1.5

The PR description needs to be updated to match the actual values defined in PLANNING_STYLE_VALUES and VL_MODE_RAW_VALID_VALUES. Additionally, there's no doubao-1.6 value in the implementation despite being mentioned in the PR description.

Copilot uses AI. Check for mistakes.
quanru and others added 3 commits November 17, 2025 17:39
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

Copilot AI commented Nov 17, 2025

Copy link
Copy Markdown
Contributor

@quanru I've opened a new pull request, #1467, to work on those changes. Once the pull request is ready, I'll request review from you.

@quanru quanru changed the title feat(shared): Introduce MIDSCENE_PLANNING_STYLE for unified model configuration feat(shared): Introduce MIDSCENE_MODEL_FAMILY for unified model configuration Nov 17, 2025
@quanru quanru force-pushed the feat/planning-style-unified-config branch from 8a23626 to 944a866 Compare November 17, 2025 12:28
@quanru quanru merged commit 2fbe8be into 1.0 Nov 18, 2025
6 checks passed
@quanru quanru deleted the feat/planning-style-unified-config branch November 18, 2025 03:20
fi3ework added a commit to fi3ework/midscene that referenced this pull request Jul 10, 2026
…ssion

@rstest/core@0.11.1 drops the pluginReact automatic JSX runtime for files
whose test environment is selected via a per-file docblock (node -> jsdom),
so their JSX compiles to classic React.createElement and throws
'React is not defined' at render time. Whole-file describe.skip until the
rstest fix lands.

Also add RSTEST-MIGRATION-WORKAROUNDS.md as the central registry of all
rstest-migration skips/workarounds (JSX runtime, externalized-dependency
mocks web-infra-dev#1456, variable dynamic imports web-infra-dev#1454), each tied to a TODO(rstest)
marker in the code.

Claude-Session: https://claude.ai/code/session_018fJUtMHskx7MtXcnWBELwE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants