fix(dsh): recognize configured native models and pin diagnosis selection
Core regression / Python 3.12 core, intervention UI and release configuration (push) Failing after 20s
Core regression / JavaScript syntax (push) Successful in 4s
Core regression / Python 3.12 core, intervention UI and release configuration (pull_request) Failing after 20s
Core regression / JavaScript syntax (pull_request) Successful in 3s

This commit is contained in:
阿白叔 committed 2026-11-05 17:40:50 +08:00
1 parent eba935e710
commit 8837587ce9
9 files changed
+149 -36

No files matched your search

+14 -2
View File
@@ -50,7 +50,8 @@ def check_availability(data_root: Path) -> dict:
except Exception:
return _result('runtime_unavailable')
if not native:
return _result('available') | {'source': 'host', 'environment_refs': ['DSH_API_KEY']}
return _result('available') | {'source': 'host', 'environment_refs': ['DSH_API_KEY'],
'model_selection': {'provider': 'dx', 'model': env['DSH_MODEL']}}
env.update(DSH_HOME=str(home), DX_DSH_HOME=str(home), DSH_TELEMETRY_DISABLED='1')
try:
completed = subprocess.run([node, str(root / 'model_availability.mjs'), str(home)],
@@ -65,7 +66,18 @@ def check_availability(data_root: Path) -> dict:
if source not in {'native', 'host'} or not isinstance(refs, list) or len(refs) > 1 or any(
not isinstance(ref, str) or not re.fullmatch(r'[A-Za-z_][A-Za-z0-9_]*', ref) for ref in refs):
return _result('runtime_unavailable')
return _result(code) | {'source': source, 'environment_refs': refs}
checked = _result(code) | {'source': source, 'environment_refs': refs}
selection = value.get('model_selection')
if selection is not None:
if not isinstance(selection, dict):
return _result('invalid_configuration')
fields = ('provider', 'model', 'reasoningEffort') if 'reasoningEffort' in selection else ('provider', 'model')
if (not {'provider', 'model'} <= selection.keys()
or any(not isinstance(selection[key], str) or not 1 <= len(selection[key]) <= 256
or any(ord(char) < 32 for char in selection[key]) for key in fields)):
return _result('invalid_configuration')
checked['model_selection'] = {key: selection[key] for key in fields}
return checked
return _result(code)
except Exception:
# Parser/OS errors can include paths or text containing credentials.
@@ -155,6 +155,7 @@ class DshAutomation(QObject):
self._uses_cad_controls = False
self._admitted_action = None
self._observed_run_id = w._dsh_run_id
self._analysis_model_selection = deepcopy(w._dsh_status.availability.get('model_selection')) if w._dsh_status else None
self.cancel_event = Event()
# Start the shared model budget when the Harness session is ready;
# startup/session creation must not consume diagnosis time.
@@ -364,6 +365,9 @@ class DshAutomation(QObject):
if view is None or not view.is_running:
self._diagnosis_event({'request_id': request['request_id'], 'status': 'failed', 'error': 'native_harness_unavailable'})
else:
selection = getattr(self, '_analysis_model_selection', None)
if selection is not None:
request = dict(request, model_selection=selection)
view.request_diagnosis(request)
def _runtime_stopped(self):