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:
copilot-swe-agent[bot] 2026-04-11 05:52:52 +00:00 committed by GitHub
parent f51dd50cf6
commit 9467249d21
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 39 additions and 11 deletions

View File

@ -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) { if (issue.issue.includes('Notion sync failed') && attempt <= 2) {
result.action = 'will_retry_notion_sync'; // Reset AOAC-06 status to idle so next AOAC-05 cycle will re-trigger it
result.success = true; // Mark as attempted; actual retry happens in next cycle 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')) { if (issue.issue.includes('missing or corrupt')) {
// Re-create chain-status.json from template const templatePath = path.join(ROOT, 'data', 'aoac', 'chain-status.json');
const defaultStatus = readJSON(path.join(ROOT, 'data', 'aoac', 'chain-status.json')); if (!fs.existsSync(templatePath)) {
if (!defaultStatus) { // Recreate from scratch
result.action = 'cannot_repair_missing_config'; const defaultStatus = {
result.success = false; _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 { } else {
result.action = 'config_exists_no_action'; result.action = 'config_exists_no_action';
result.success = true; result.success = true;

View File

@ -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 // Generate master report
const seq = String(Math.floor(Math.random() * 1000)).padStart(3, '0'); const seq = String(Math.floor(Math.random() * 1000)).padStart(3, '0');
const masterReport = { const masterReport = {

View File

@ -108,8 +108,8 @@ async function sendAlertEmail(repairReport) {
// Use nodemailer if available, otherwise use raw SMTP via https webhook // Use nodemailer if available, otherwise use raw SMTP via https webhook
if (!createTransport) { if (!createTransport) {
console.log('⚠️ nodemailer不可用,使用GitHub Issue告警'); console.log('⚠️ nodemailer不可用,将通过GitHub Issue告警');
return { sent: false, reason: 'nodemailer_unavailable' }; return { sent: false, reason: 'nodemailer_unavailable', fallback: 'github_issue' };
} }
try { try {