feat(dsh): add persistent automatic AI intervention switch
Core regression / Python core and release configuration (push) Successful in 21s
Core regression / JavaScript syntax (push) Successful in 3s
Core regression / Python core and release configuration (pull_request) Successful in 17s
Core regression / JavaScript syntax (pull_request) Successful in 3s
Core regression / Python core and release configuration (push) Successful in 21s
Core regression / JavaScript syntax (push) Successful in 3s
Core regression / Python core and release configuration (pull_request) Successful in 17s
Core regression / JavaScript syntax (pull_request) Successful in 3s
This commit is contained in:
1 parent
9316cf4fc4
commit
e28c6d0d6e
12 files changed
+292
-31
No files matched your search
@@ -35,10 +35,13 @@ def main():
|
||||
parser.add_argument('--model-settings-check', action='store_true', help='Create an isolated custom provider using a local model-list fixture')
|
||||
parser.add_argument('--file-check', action='store_true', help='Pick and upload a real local text file and ZIP in the official UI')
|
||||
parser.add_argument('--incident', action='store_true', help='Inject a read-only controlled failure and verify automatic diagnosis and Git escalation')
|
||||
parser.add_argument('--auto-intervention-check', action='store_true', help='Click the intervention switch off/on and diagnose a second taskless incident (requires --incident)')
|
||||
parser.add_argument('--outbox-only', action='store_true', help='Verify failed publication stays in local outbox without creating another real issue')
|
||||
parser.add_argument('--without-git', action='store_true', help='Simulate a client with no Git credentials or executable')
|
||||
parser.add_argument('--create-task', action='store_true', help='Create real project tasks from a live native model conversation')
|
||||
args = parser.parse_args()
|
||||
if args.auto_intervention_check and not args.incident:
|
||||
parser.error('--auto-intervention-check requires --incident')
|
||||
output = args.output.resolve()
|
||||
output.mkdir(parents=True, exist_ok=True)
|
||||
if args.file_check:
|
||||
@@ -82,7 +85,7 @@ def main():
|
||||
|
||||
report = {'driver': 'Qt QTest mouse clicks + Chromium CDP Input events', 'checks': []}
|
||||
state = {'phase': 'select', 'child': None, 'creation_step': 'input',
|
||||
'deadline': time.monotonic() + (600 if args.file_check else 420 if args.incident else 300 if args.create_task else 240 if args.live_model else 150)}
|
||||
'deadline': time.monotonic() + (840 if args.auto_intervention_check else 600 if args.file_check else 420 if args.incident else 300 if args.create_task else 240 if args.live_model else 150)}
|
||||
|
||||
def build_window(service):
|
||||
if not args.create_task:
|
||||
@@ -183,6 +186,22 @@ def main():
|
||||
window.grab().save(str(output / 'task-center.png'))
|
||||
if args.incident:
|
||||
from dx_productivity.trial_task_center.errors import TaskCenterError
|
||||
if args.auto_intervention_check:
|
||||
state['phase'] = 'toggle-disabled'
|
||||
assert window.auto_intervention_check.isChecked()
|
||||
QTest.mouseClick(window.auto_intervention_check, Qt.MouseButton.LeftButton)
|
||||
assert not window.auto_intervention_check.isChecked()
|
||||
def dismiss_disabled_error():
|
||||
modal = QApplication.activeModalWidget()
|
||||
assert isinstance(modal, QMessageBox)
|
||||
QTest.mouseClick(modal.button(QMessageBox.StandardButton.Ok), Qt.MouseButton.LeftButton)
|
||||
QTimer.singleShot(100, dismiss_disabled_error)
|
||||
window._show_error(TaskCenterError('dsh_acceptance_disabled', '关闭 AI 自动介入受控验收'))
|
||||
assert window._dsh_view is None and window._dsh_automation is None
|
||||
report['checks'].append('clicked intervention off: error remained visible without starting AI')
|
||||
QTest.mouseClick(window.auto_intervention_check, Qt.MouseButton.LeftButton)
|
||||
assert window.auto_intervention_check.isChecked()
|
||||
report['checks'].append('clicked intervention on before injecting an error')
|
||||
window._show_error(TaskCenterError('dsh_acceptance_failure',
|
||||
'DSH 自动介入受控验收:模拟不可重试错误,任务没有工程数据,不执行 CAD 写入。'))
|
||||
report['checks'].append('injected controlled failure in real error entry without opening assistant manually')
|
||||
@@ -228,12 +247,34 @@ def main():
|
||||
row = window._dsh_automation.latest
|
||||
assert row['issue_code'] == 'dsh_acceptance_failure', 'Unexpected UI error replaced controlled incident'
|
||||
assert row['status'] == ('pending_issue' if args.outbox_only else 'escalated') and row['attempts'] == 0
|
||||
if args.outbox_only:
|
||||
timeline = data / 'dsh/incidents' / row['incident_id'] / 'timeline.jsonl'
|
||||
submissions = [json.loads(line) for line in timeline.read_text(encoding='utf8').splitlines()]
|
||||
assert sum(event['stage'] == 'issue_submission' for event in submissions) >= 2, 'Resubmit did not reach the desktop publisher'
|
||||
if not args.outbox_only:
|
||||
assert row['ticket']['attachment_status'] == 'uploaded'
|
||||
if args.without_git:
|
||||
assert row['ticket']['credential_source'] == 'prefilled_issue_token'
|
||||
report['checks'].append('client without Git used only the prefilled issue reporter token')
|
||||
report['incident'] = row
|
||||
if args.auto_intervention_check:
|
||||
incidents = report.setdefault('incidents', [])
|
||||
assert row.get('session_id')
|
||||
if incidents:
|
||||
assert row['session_id'] != incidents[0]['session_id']
|
||||
assert row['incident_id'] != incidents[0]['incident_id']
|
||||
assert row['task_id'] == ''
|
||||
report['checks'].append('second taskless error created and opened a distinct native conversation automatically')
|
||||
incidents.append(dict(row))
|
||||
if len(incidents) == 1:
|
||||
state['phase'] = 'ready'
|
||||
click_navigation(window.task_center_action)
|
||||
window._task_id = None
|
||||
window._context = None
|
||||
from dx_productivity.trial_task_center.errors import TaskCenterError
|
||||
window._show_error(TaskCenterError('dsh_acceptance_failure',
|
||||
'DSH 无关联任务异常验收:新建独立诊断对话,不执行 CAD 写入。'))
|
||||
return
|
||||
report['checks'].append('real native automatic diagnosis and reflection, evidence and ' +
|
||||
('retryable local issue outbox' if args.outbox_only else 'Git issue attachment') + ' completed without CAD mutations')
|
||||
if args.create_task:
|
||||
|
||||
Reference in new issue
Block a user