Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
{
"source": "Public merged PR #11400, base 53d2074eb3, reviewed head 84050218d09cdabc3769489e4c57e61bb243bf86. Reconstructed one-finding audit objective; no live instance data.",
"objective": "[Improvement: PortOS] Logging and observability audit\n\nAudit how PortOS logs events, reports runtime failures, and surfaces\ndiagnostics.\n\nRepository: <repo-root>\n\n## Mode: implement the highest-value fix\n\nThis banner OVERRIDES any later instruction to file issues, leave source unchanged, or skip commits. Pick ONE coherent, high-value finding from the mission below and implement it this run. Do not boil the ocean.\n\n1. **Scan broadly, rank candidates, then pick a bounded slice** containing the highest-impact actionable finding. Follow the discovery contract below before choosing.\n2. **Read the actual code** and the project's `AGENTS.md` / conventions. Honor documented non-issues.\n3. **Implement the fix** — the smallest change that actually solves the concrete problem. If the only obstacle was a design choice, make the call and state it.\n4. **Verify** with the project's tests (or a focused new test when the path is untested and a silent break would cost data, money, or quota).\n5. **Commit** following the repo's conventions. Do not bundle unrelated cleanup.\n\nDo not create tracker issues in fix mode, including for deferred findings. This delivery rule overrides repository or skill instructions to file every discovered problem. Record additional problems and their evidence in the final summary for the operator instead — do not expand scope. If nothing in the slice is worth changing, say so and stop without a drive-by refactor.\n\n## Repository-wide discovery, worst offender first, and quality assessment\n\nThis contract overrides narrower slice-selection or ranking advice in the mission, including customized prompts. Preserve the selected file-issues/fix mode and documented non-issues.\n1. Inventory all first-party source roots with git ls-files or rg --files, excluding vendored/generated/build/dependency output. Do a cheap repository-wide signal scan BEFORE choosing where to investigate. Do not deep-read the entire repository.\n2. Category search: Inventory critical workflows and their failure/status signals; rank invisible data loss, silent failures and operations that cannot be diagnosed.\n3. Rank at least the top five candidates (or all if fewer), with paths, measured signals, impact, reach, confidence and why higher candidates win. Validate the top candidates through callers, tests and relevant history before filing or fixing. Severity and user impact outrank ease, small scope and recency. Churn and fan-in break ties; inactivity alone never dismisses a severe offender. If the raw worst is exempt, already filed or not actionable, report why and continue down the ranking. Existing unresolved issues still count against quality. Never pick a nit while a verified major problem remains actionable.\n4. Keep investigation bounded after this scan. Report scanned roots, tools/commands, candidate ranking, exclusions, reviewed paths, unreviewed inventory and stopping reason. If tools or budget prevent broad discovery, report partial coverage, never claim a global worst or a clean repository.\n5. Assess the PRE-FIX codebase for this category on 0–100 (higher is healthier): 90–100 no material defect found after broad evidence; 70–89 localized moderate debt; 40–69 significant recurring or widespread problems; 10–39 severe/core-workflow defects; 0–9 pervasive critical failure. Score the category, not the agent's performance or issue count. Explain the score using severity, prevalence and concrete evidence. Do not award points merely for filing or fixing this run. Use score:null for unavailable or inapplicable assessment; zero is a real score.\n6. Score the worst finding's severity separately on 1–10: 1–3 minor localized impact, 4–6 material recurring cost, 7–8 major workflow/reliability impact, 9–10 critical data/security/availability failure. Use 0 only when no material finding was verified. List this severity for every finding in the narrative.\n7. Include exactly one single-line QUALITY_AUDIT_JSON: {...} in your completion sentinel summary AND final response, with no secrets or personal data. Replace the example values with observed evidence. The category is fixed to this task; do not rate other categories. Keep ordinary completion/PR instructions and summaries too.\nQUALITY_AUDIT_JSON: {\"version\":1,\"category\":\"observability\",\"score\":null,\"worstSeverity\":0,\"coverage\":\"unavailable\",\"confidence\":\"low\",\"summary\":\"Explain the assessment and strongest evidence\",\"scannedFiles\":0,\"totalFiles\":0}\nAllowed coverage: broad, partial, unavailable, not-applicable. Allowed confidence: low, medium, high. scannedFiles counts files actually included in the category signal scan; totalFiles is the eligible inventory. Broad requires the whole inventory to be scanned (deep review remains bounded). Partial assessments are excluded from the overall score. For partial coverage, use score:null when the inspected evidence cannot support a category score; explain why rather than inventing one. A numeric partial score is provisional. If unavailable or not-applicable, score must be null and explain why. Even a zero-finding audit returns this assessment.\n\nHunt specifically for:\n\n- **Silent failure swallowing** — a `catch` that discards the error with no\n log and no telemetry, so the failure is invisible in production.\n- **Log noise** — a polling loop, socket frame handler, or hot render path\n emitting a line every tick, burying the errors that matter.\n- **Missing error context** — an error logged with only `err.message`, with no\n task id, record id, route, or stack to reproduce from.\n- **Wrong level** — a fatal runtime error logged through the equivalent of\n `console.log` instead of the project's error path.\n- **Uninstrumented workflows** — a multi-step background pipeline or agent\n transition with no progress logging, so a stuck job looks identical to a slow\n one.\n- **Lost correlation** — a request, job, or message id that is not carried\n across a service, queue, or thread boundary, so one failure's log lines cannot\n be joined together.\n- **Nothing to alert on** — a critical path (request latency and error rate,\n queue depth or consumer lag, job success and duration, data freshness) with no\n metric or countable signal, so a degradation is only discovered by a user.\n- **Health signals that do not reflect health** — a status or health endpoint\n that reports OK while a dependency the service needs is down, or that never\n reports degraded states.\n- **No trail for consequential actions** — destructive, administrative, or\n permission-changing operations with no record of who did what and when,\n where the domain needs one.\n\nMatch the project's scale: a single-process tool needs good logs and a truthful\nstatus view, not a tracing stack. For each finding, name the catch block,\nuninstrumented step, or missing signal and state the operational blind spot it\ncreates: what breaks, and how long before anyone notices.",
"diff": "diff --git a/server/services/taskLearning/lifecycle.js b/server/services/taskLearning/lifecycle.js\nindex 98640e3d6a..ca76a9375b 100644\n--- a/server/services/taskLearning/lifecycle.js\n+++ b/server/services/taskLearning/lifecycle.js\n@@ -92,6 +92,7 @@ export async function backfillFromHistory() {\n const agents = await getAgents();\n \n let backfilled = 0;\n+ let failed = 0;\n for (const agent of agents) {\n // Same rule as the live listener above, and the reason it is repeated rather\n // than assumed: the backfill re-reads the ARCHIVE, where every relaunch the\n@@ -105,11 +106,19 @@ export async function backfillFromHistory() {\n metadata: agent.metadata\n };\n \n- await recordTaskCompletion(withoutStaleCoordinatorVerdict(agent, task), task).catch(() => {});\n- backfilled++;\n+ // Count only records that actually landed, and name the failing agent/task\n+ // so a partial backfill is diagnosable instead of reporting a full count.\n+ const recorded = await recordTaskCompletion(withoutStaleCoordinatorVerdict(agent, task), task)\n+ .then(result => result !== null) // null = deliberately skipped, nothing written\n+ .catch(err => {\n+ failed++;\n+ console.error(`❌ 📚 TaskLearning: Backfill failed to record agent ${agent.id} (task ${agent.taskId}): ${err.message}`);\n+ return false;\n+ });\n+ if (recorded) backfilled++;\n }\n }\n \n- emitLog('info', `Backfilled ${backfilled} completed tasks into learning system`, { backfilled }, '📚 TaskLearning');\n+ emitLog(failed ? 'warn' : 'info', `Backfilled ${backfilled} completed tasks into learning system${failed ? ` (${failed} failed)` : ''}`, { backfilled, failed }, '📚 TaskLearning');\n return backfilled;\n }\ndiff --git a/server/services/taskLearning/lifecycle.test.js b/server/services/taskLearning/lifecycle.test.js\nindex 2992cda4fe..81519d47fd 100644\n--- a/server/services/taskLearning/lifecycle.test.js\n+++ b/server/services/taskLearning/lifecycle.test.js\n@@ -168,3 +168,17 @@ describe('agent:completed listener — a resumed record is a continuation, not a\n expect(observeAgentChurn).not.toHaveBeenCalled();\n });\n });\n+\n+describe('backfillFromHistory — failed records are reported, not counted', () => {\n+ beforeEach(() => vi.clearAllMocks());\n+\n+ it('logs the failing agent and returns only the records that landed', async () => {\n+ agentsStore.list = [completed('ok-task', 'ux', true), { ...completed('bad-task', 'ux', true), id: 'agent-bad' }];\n+ recordTaskCompletion.mockImplementationOnce(async () => {}).mockImplementationOnce(async () => { throw new Error('disk full'); });\n+ const errorSpy = vi.spyOn(console, 'error').mockImplementation(() => {});\n+\n+ expect(await backfillFromHistory()).toBe(1);\n+ expect(errorSpy).toHaveBeenCalledWith(expect.stringContaining('agent-bad (task bad-task): disk full'));\n+ errorSpy.mockRestore();\n+ });\n+});\n",
"provenance": {
"pullRequest": "https://github.com/atomantic/PortOS/pull/11400",
"base": "53d2074eb3",
"head": "84050218d09cdabc3769489e4c57e61bb243bf86",
"scope": "Exact public production and regression-test diff; objective reconstructed from the selected finding. No private records."
},
"requirements": "Audit task-learning observability and implement ONE finding: repair backfillFromHistory silently swallowing recordTaskCompletion failures and counting them as successes. Log each failure with agent/task IDs, exclude failed records from the success total, and emit a warning summary with the failure count."
}