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:
|
||||
|
||||
@@ -26,14 +26,18 @@ try{
|
||||
assert.match(value.automation.ticket.url,/git\.simgreek\.com\/Skyworth_Digital_Hardware\/dxdesigner-part-replacement\/issues\/\d+/);
|
||||
}
|
||||
await wait(`document.body.innerText.includes('DSH自动诊断')`);
|
||||
await wait(`document.querySelector('[data-chat-group-part="response"]')?.innerText.length>40`);
|
||||
await wait(`[...document.querySelectorAll('[data-chat-group-part="response"]')].some(e=>e.innerText.length>40)`);
|
||||
report.checks.push('native auto-created diagnostic conversation visible without manual send');
|
||||
report.checks.push(outboxOnly?'unresolved incident reflected and local outbox retained after publication unavailable':
|
||||
'unresolved incident reflected, evidence saved and real Git issue with attachment submitted');
|
||||
report.ticket=value.automation.ticket;
|
||||
if(outboxOnly){
|
||||
await wait(`[...document.querySelectorAll('button')].some(e=>e.textContent==='重新提交工单')`);
|
||||
await c.evaluate(`(()=>{window.__dshAcceptanceActions=[];const original=window.fetch;window.fetch=async(...args)=>{const response=await original(...args);if(args[0]==='/dx/action')window.__dshAcceptanceActions.push(response.status);return response;};})()`);
|
||||
const before=await c.evaluate(`fetch('/dx/context').then(r=>r.json()).then(d=>d.revision)`);
|
||||
await c.click(`[...document.querySelectorAll('button')].find(e=>e.textContent==='重新提交工单')`);
|
||||
await wait(`window.__dshAcceptanceActions.length>0`);
|
||||
assert.equal(await c.evaluate(`window.__dshAcceptanceActions.at(-1)`),200,'real resubmit action accepted');
|
||||
await wait(`fetch('/dx/context').then(r=>r.json()).then(d=>d.revision!==${JSON.stringify(before)}&&d.automation.status==='pending_issue')`);
|
||||
report.checks.push('clicked resubmit and retained pending evidence without replaying CAD');
|
||||
}else await wait(`!!document.querySelector('[data-testid="dx-auto-ticket"]')`);
|
||||
|
||||
@@ -84,6 +84,15 @@ try {
|
||||
assert.equal(response.status,409);
|
||||
}
|
||||
report.invalidActionsDenied=true;
|
||||
await writeFile(process.env.DX_DSH_CONTEXT_FILE,JSON.stringify({task_id:'',revision:'taskless-revision',
|
||||
status:'observe',automation:{task_id:'',incident_id:'a'.repeat(24)}}));
|
||||
for(const [action,expected] of [['retry_issue',200],['open_evidence',200],['retry_failed',409],['pause_task',409]]){
|
||||
const response=await fetch(base+'/dx/action',{method:'POST',headers:{...auth,'Content-Type':'application/json'},
|
||||
body:JSON.stringify({action,task_id:'',revision:'taskless-revision'})});
|
||||
assert.equal(response.status,expected,action);
|
||||
}
|
||||
report.tasklessEvidenceAndOutboxAllowed=true;
|
||||
report.tasklessEngineeringActionsDenied=true;
|
||||
report.status='passed';
|
||||
await writeFile(path.join(output,'report.json'),JSON.stringify(report,null,2));
|
||||
console.log(JSON.stringify(report));
|
||||
|
||||
Reference in new issue
Block a user