fix: address code review feedback for AOAC repair and dashboard logic
Agent-Logs-Url: https://github.com/qinfendebingshuo/guanghulab/sessions/2c37ba8a-8fe8-4d88-aa5a-2783f65e1266 Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com>
This commit is contained in:
parent
f51dd50cf6
commit
9467249d21
|
|
@ -143,19 +143,37 @@ function attemptRepair(issues, attempt) {
|
|||
}
|
||||
}
|
||||
|
||||
// Repair strategy: re-trigger chain from break point
|
||||
// Repair strategy: re-trigger Notion sync on next AOAC-05 cycle
|
||||
if (issue.issue.includes('Notion sync failed') && attempt <= 2) {
|
||||
result.action = 'will_retry_notion_sync';
|
||||
result.success = true; // Mark as attempted; actual retry happens in next cycle
|
||||
// Reset AOAC-06 status to idle so next AOAC-05 cycle will re-trigger it
|
||||
const cs = readJSON(CHAIN_STATUS_PATH);
|
||||
if (cs && cs.agents && cs.agents['AOAC-06']) {
|
||||
cs.agents['AOAC-06'].status = 'idle';
|
||||
writeJSON(CHAIN_STATUS_PATH, cs);
|
||||
result.action = 'reset_aoac06_for_retry';
|
||||
result.success = true;
|
||||
} else {
|
||||
result.action = 'cannot_reset_aoac06';
|
||||
result.success = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Repair strategy: regenerate missing config
|
||||
// Repair strategy: recreate missing chain-status from default template
|
||||
if (issue.issue.includes('missing or corrupt')) {
|
||||
// Re-create chain-status.json from template
|
||||
const defaultStatus = readJSON(path.join(ROOT, 'data', 'aoac', 'chain-status.json'));
|
||||
if (!defaultStatus) {
|
||||
result.action = 'cannot_repair_missing_config';
|
||||
result.success = false;
|
||||
const templatePath = path.join(ROOT, 'data', 'aoac', 'chain-status.json');
|
||||
if (!fs.existsSync(templatePath)) {
|
||||
// Recreate from scratch
|
||||
const defaultStatus = {
|
||||
_meta: { system: 'AGE OS Agent Chain (AOAC) v1.0', recreated: new Date().toISOString() },
|
||||
agents: {},
|
||||
chain_health: 'unknown',
|
||||
last_full_cycle: null,
|
||||
total_cycles: 0,
|
||||
total_repairs: 0
|
||||
};
|
||||
writeJSON(templatePath, defaultStatus);
|
||||
result.action = 'recreated_chain_status';
|
||||
result.success = true;
|
||||
} else {
|
||||
result.action = 'config_exists_no_action';
|
||||
result.success = true;
|
||||
|
|
|
|||
|
|
@ -205,6 +205,16 @@ function main() {
|
|||
}
|
||||
}
|
||||
|
||||
// In scheduled/auto mode, also generate dashboard for full daily review
|
||||
if (fs.existsSync(dashGen) && mode !== 'event') {
|
||||
try {
|
||||
execFileSync('node', [dashGen], { cwd: ROOT, timeout: 60000, stdio: 'inherit' });
|
||||
console.log('✅ 定时仪表盘同步更新');
|
||||
} catch (err) {
|
||||
console.error('⚠️ 定时仪表盘更新失败:', err.message);
|
||||
}
|
||||
}
|
||||
|
||||
// Generate master report
|
||||
const seq = String(Math.floor(Math.random() * 1000)).padStart(3, '0');
|
||||
const masterReport = {
|
||||
|
|
|
|||
|
|
@ -108,8 +108,8 @@ async function sendAlertEmail(repairReport) {
|
|||
|
||||
// Use nodemailer if available, otherwise use raw SMTP via https webhook
|
||||
if (!createTransport) {
|
||||
console.log('⚠️ nodemailer不可用,使用GitHub Issue告警');
|
||||
return { sent: false, reason: 'nodemailer_unavailable' };
|
||||
console.log('⚠️ nodemailer不可用,将通过GitHub Issue告警');
|
||||
return { sent: false, reason: 'nodemailer_unavailable', fallback: 'github_issue' };
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
|
|||
Loading…
Reference in New Issue