Skip to content

Stabilize TUI API runtime foundation#218

Merged
TraderSamwise merged 16 commits into
masterfrom
chore/next-20260622-tui-control-plane-followup
Jun 22, 2026
Merged

Stabilize TUI API runtime foundation#218
TraderSamwise merged 16 commits into
masterfrom
chore/next-20260622-tui-control-plane-followup

Conversation

@TraderSamwise

@TraderSamwise TraderSamwise commented Jun 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • stop treating transient project-service disconnects as auto-restart repairs
  • add a dedicated TUI API runtime with coalesced resource refreshes, last-good snapshots, generation checks, and disposal safety
  • hard-cut dashboard /desktop-state reads through the runtime and remove the old direct retry/refresh lock path

Verification

  • yarn typecheck
  • yarn lint
  • yarn vitest run
  • yarn build

Summary by CodeRabbit

Release Notes

  • Documentation

    • Simplified runtime recovery guidance to the normal flow: aimux restartaimux doctor versions, with advanced/debug commands moved to an optional path.
    • Clarified what the safe repair does, including dashboard reload behavior and managed tmux contract drift repair.
  • New Features

    • Automatic repair diagnostics are now recorded to repairs.jsonl in project logs and trigger quiet desktop notifications.
  • Bug Fixes

    • Improved runtime-guard key handling and overlay messaging for more consistent “please wait/reconnecting/repairing” behavior.

@vercel

vercel Bot commented Jun 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
app Ready Ready Preview, Comment Jun 22, 2026 11:16am

@TraderSamwise

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Introduces TuiApiRuntime for generation-based resource fetching with concurrency control, makes aimux restart perform explicit tmux contract repair with repairs.jsonl diagnostics logging, splits the metadata server /health and /diagnostics endpoints, adds a ContextWatcher enabled flag gated on --tmux-dashboard-internal, simplifies runtime-guard key disposition to passthrough/swallow with automatic repair spawning, and updates all documentation accordingly.

Changes

Unified Safe Repair, TuiApiRuntime, and Dashboard Auto-Repair

Layer / File(s) Summary
Repair diagnostics infrastructure
src/paths.ts, src/project-api-contract.ts, src/repair-events.ts, src/repair-events.test.ts
Adds getProjectRepairLogPathFor, a /diagnostics route entry, and the repair-events module (RepairEventAction, RepairEvent, RepairNotifier, recordRepairEvent, notifyRepair) with best-effort JSONL logging and silent desktop notification; tests verify persistence and notification shape.
TuiApiRuntime: resource fetching with concurrency control
src/multiplexer/tui-api-runtime.ts, src/multiplexer/tui-api-runtime.test.ts
New TuiApiRuntime class manages per-resource state via generation counters, coalesces concurrent requests, supports superseding in-flight refreshes, tracks stale/degraded connection state, and disposes cleanly; getOrCreateTuiApiRuntime wires it to host. Tests cover coalescing, stale-on-failure, superseding, and dispose behaviors.
Health/diagnostics endpoint split
src/metadata-server.ts, src/metadata-server.test.ts
Trims /health response to ok/projectStateDir/pid/serviceInfo; moves resources, recentSlowRequests, and plugins to /diagnostics; tests assert the split.
ContextWatcher enabled flag and Multiplexer wiring
src/context/context-bridge.ts, src/context/context-bridge.test.ts, src/multiplexer/index.ts, src/main.ts
Adds enabled option to ContextWatcher with early-return guards on all public methods; Multiplexer constructor gains contextWatcherEnabled option; disables context watching when --tmux-dashboard-internal is active; adds test for disabled write suppression.
Runtime coherence: projectRoot extraction and client-session tracking
src/runtime-coherence.ts, src/runtime-coherence.test.ts
Adds optional projectRoot to RuntimeCoherenceProcessReport; rewrites listStaleHookProcesses to parse --project from hook command lines; extends runtime report with optional clientSessions array tracking per-client contract/rebuild status; updates rebuildRequired logic to consider both host and client; tests verify parsed projectRoot and client-session rebuild reporting.
Runtime restart: contract repair, active-window restore, and diagnostics
src/runtime-restart.ts, src/runtime-restart.test.ts
Extends RuntimeRestartProjectResult with runtime status/error and runtimeRepairs summary counter; adds repairRuntimeContract helper that calls configureManagedSession and clears the rebuild marker; captures/restores active non-dashboard windows during reload; emits repair events via emitRepairDiagnostics/buildRepairEvents (control-plane, tmux-runtime-repair, project-service-ensure, dashboard-reload) and notifications; tests cover repair success, verification failure, stale-hook non-trigger, best-effort marker cleanup, and notifier resilience.
Dashboard model refresh via TuiApiRuntime
src/multiplexer/dashboard-model.ts, src/multiplexer/dashboard-model-service.test.ts, src/multiplexer/runtime-lifecycle-methods.ts
Replaces refreshDashboardModelFromService's snapshot-locking retry loop and ensureDashboardControlPlane with a single TuiApiRuntime.refreshJson call; introduces normal/forced timeout constants; adds tuiApiRuntime.dispose() in teardown; updates mock timeout values in tests.
Runtime guard: simplified disposition, auto-repair, and overlay updates
src/multiplexer/runtime-guard.ts, src/multiplexer/runtime-guard.test.ts, src/multiplexer/dashboard-control.ts, src/multiplexer/dashboard-control.test.ts, src/multiplexer/dashboard-actions-methods.ts, src/tui/screens/overlay-renderers.ts, src/multiplexer/session-launch.ts, src/multiplexer/session-launch.test.ts
Simplifies runtimeGuardKeyDisposition to passthrough/swallow only; rewrites overlay copy to reconnecting/repairing language and replaces action hints with "Please wait"; removes reloadDashboardFromGuard/restartRuntimeFromGuard action methods; adds startRuntimeGuardRepair (detached CLI spawn with dedup lock, busy overlay, success/failure transitions); triggers auto-repair from refreshRuntimeGuard; swaps stdin handler priority so overlay intercepts before guard; tests cover key swallowing, overlay text, repair spawning, failure display, lock enforcement, and priority inversion.
Documentation: simplified recovery model
AGENTS.md, README.md, docs/dev-runtime.md, docs/runtime-lifecycle.md
Updates all docs to reflect aimux restart as primary coherence repair, adds repairs.jsonl log path, demotes aimux repair/restart-runtime/dashboard-reload --open to advanced/debug, and documents aimux stop lifecycle commands.

Sequence Diagram(s)

sequenceDiagram
  rect rgba(100, 149, 237, 0.5)
    Note over CLI,repairNotifier: aimux restart repair flow
  end
  participant CLI
  participant restartAimuxControlPlane
  participant repairRuntimeContract
  participant tmux
  participant emitRepairDiagnostics
  participant repairNotifier

  CLI->>restartAimuxControlPlane: RestartAimuxControlPlaneOptions
  restartAimuxControlPlane->>repairRuntimeContract: project, tmux, runtimeRebuildRequired
  repairRuntimeContract->>tmux: configureManagedSession (project + client sessions)
  repairRuntimeContract->>tmux: setSessionOption `@aimux-runtime-rebuild-required` "0"
  repairRuntimeContract-->>restartAimuxControlPlane: repaired | skipped | failed
  restartAimuxControlPlane->>emitRepairDiagnostics: result, repairNotifier
  emitRepairDiagnostics->>repairNotifier: record(control-plane-restart event)
  emitRepairDiagnostics->>repairNotifier: record(tmux-runtime-repair event)
  emitRepairDiagnostics->>repairNotifier: notify("Aimux repaired", summary)
  restartAimuxControlPlane-->>CLI: RuntimeRestartResult
Loading
sequenceDiagram
  rect rgba(144, 238, 144, 0.5)
    Note over refreshRuntimeGuard,spawn: Dashboard auto-repair flow
  end
  participant refreshRuntimeGuard
  participant shouldAutoRepairRuntimeGuard
  participant startRuntimeGuardRepair
  participant spawn
  participant host

  refreshRuntimeGuard->>shouldAutoRepairRuntimeGuard: stabilized state
  shouldAutoRepairRuntimeGuard-->>refreshRuntimeGuard: true (stale/rebuild-required)
  refreshRuntimeGuard->>startRuntimeGuardRepair: host, state
  startRuntimeGuardRepair->>host: runtimeGuardRepairing=true, dashboardBusyState="Repairing Aimux"
  startRuntimeGuardRepair->>spawn: aimux restart --project <root> (detached)
  spawn-->>startRuntimeGuardRepair: exit 0
  startRuntimeGuardRepair->>host: runtimeGuardState={kind:"ok"}, clear busy/repair flags
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

Possibly related PRs

  • TraderSamwise/aimux#179: Modifies the same runtime-guard key-handling path in session-launch.ts and dashboard-control.ts around guarded runtime reload/repair behavior that this PR rewrites.
  • TraderSamwise/aimux#199: Establishes the coherent aimux restart flow in runtime-restart.ts that this PR extends with runtime repair status, runtimeRepairs counter, and repairs.jsonl diagnostics.
  • TraderSamwise/aimux#215: Directly modifies runtime-guard.ts and dashboard-control.ts in the same guard probing/refresh subsystem that this PR rewrites with auto-repair spawning.

Poem

🐇 Hop hop, the runtime drifts no more,
A restart command that heals the core,
Repairs get logged in repairs.jsonl,
No more tearing tmux down with zeal!
The guard now waits and spawns with care,
"Please wait"—a bunny's gentle prayer.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 5.17% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: introducing and stabilizing a TUI API runtime foundation as the core refactoring across the codebase.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/next-20260622-tui-control-plane-followup

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
src/multiplexer/tui-api-runtime.ts (1)

145-154: 🧹 Nitpick | 🔵 Trivial | 💤 Low value

Consider adding a typed interface for the host parameter.

Using any for host loses type safety and makes the contract implicit. A minimal interface would document the expected shape and catch misuse at compile time.

interface TuiApiRuntimeHost {
  tuiApiRuntime?: TuiApiRuntime;
  tuiApiConnectionState?: TuiApiConnectionState;
  getFromProjectService: (path: string, opts?: { timeoutMs?: number }) => Promise<unknown>;
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/multiplexer/tui-api-runtime.ts` around lines 145 - 154, The `host`
parameter in the `getOrCreateTuiApiRuntime` function uses the `any` type, which
eliminates type safety and makes the expected structure implicit. Replace the
`any` type annotation with a typed interface that documents the required
properties of the host object including tuiApiRuntime, tuiApiConnectionState,
and the getFromProjectService method. This will provide compile-time type
checking and make the function's contract explicit.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/repair-events.test.ts`:
- Around line 14-28: The test uses a fixed `/tmp/aimux-repair-project` path for
projectRoot, which causes data from previous test runs to persist and
contaminate subsequent test runs. Replace the hardcoded projectRoot string with
a unique temporary directory generated per test execution. Additionally, update
the assertion logic to read and validate the last line of the JSONL file instead
of the first line, since prior runs may have written earlier lines that would
interfere with the test expectations.

In `@src/runtime-restart.ts`:
- Around line 539-542: The restoreActiveWindows() call is only executed on the
success path, meaning if resolveDashboard() or relinkDashboardToClientSessions()
throws an error, active window restoration is skipped. Wrap the
resolveDashboard() and relinkDashboardToClientSessions() calls in a try-finally
block so that restoreActiveWindows() is always called with the captured
activeWindows, even when an error occurs during the dashboard reload or relink
operations.
- Around line 688-694: The "Runtime repaired:" section is filtering only by
runtimeRebuildRequired status, but this can include projects with failed
repairs. Modify the filter condition in the for loop that iterates over
result.projects to check both that entry.runtimeRebuildRequired is true AND that
entry.runtime.status equals "repaired", ensuring only successfully repaired
projects are displayed under the "Runtime repaired:" heading.

---

Nitpick comments:
In `@src/multiplexer/tui-api-runtime.ts`:
- Around line 145-154: The `host` parameter in the `getOrCreateTuiApiRuntime`
function uses the `any` type, which eliminates type safety and makes the
expected structure implicit. Replace the `any` type annotation with a typed
interface that documents the required properties of the host object including
tuiApiRuntime, tuiApiConnectionState, and the getFromProjectService method. This
will provide compile-time type checking and make the function's contract
explicit.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5348c154-5a58-4af4-80d9-c0a5ed5d5add

📥 Commits

Reviewing files that changed from the base of the PR and between c582dc3 and 0623979.

📒 Files selected for processing (31)
  • AGENTS.md
  • README.md
  • docs/dev-runtime.md
  • docs/runtime-lifecycle.md
  • src/context/context-bridge.test.ts
  • src/context/context-bridge.ts
  • src/main.ts
  • src/metadata-server.test.ts
  • src/metadata-server.ts
  • src/multiplexer/dashboard-actions-methods.ts
  • src/multiplexer/dashboard-control.test.ts
  • src/multiplexer/dashboard-control.ts
  • src/multiplexer/dashboard-model-service.test.ts
  • src/multiplexer/dashboard-model.ts
  • src/multiplexer/index.ts
  • src/multiplexer/runtime-guard.test.ts
  • src/multiplexer/runtime-guard.ts
  • src/multiplexer/runtime-lifecycle-methods.ts
  • src/multiplexer/session-launch.test.ts
  • src/multiplexer/session-launch.ts
  • src/multiplexer/tui-api-runtime.test.ts
  • src/multiplexer/tui-api-runtime.ts
  • src/paths.ts
  • src/project-api-contract.ts
  • src/repair-events.test.ts
  • src/repair-events.ts
  • src/runtime-coherence.test.ts
  • src/runtime-coherence.ts
  • src/runtime-restart.test.ts
  • src/runtime-restart.ts
  • src/tui/screens/overlay-renderers.ts
💤 Files with no reviewable changes (1)
  • src/multiplexer/dashboard-actions-methods.ts

Comment thread src/repair-events.test.ts
Comment on lines +14 to +28
const projectRoot = "/tmp/aimux-repair-project";

recordRepairEvent({
ts: "2026-06-22T00:00:00.000Z",
projectRoot,
action: "tmux-runtime-repair",
reason: "runtime contract drift",
status: "repaired",
details: { currentDaemonPid: 123 },
});

const path = getProjectRepairLogPathFor(projectRoot);
expect(existsSync(path)).toBe(true);
const [line] = readFileSync(path, "utf8").trim().split("\n");
expect(JSON.parse(line!)).toMatchObject({

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Use a unique temp project root per test run.

This test writes to a fixed path and reads the first JSONL line, so prior runs can leak data and make assertions non-hermetic. Use a per-test temp directory and assert the last line written.

Proposed fix
-import { existsSync, readFileSync } from "node:fs";
+import { existsSync, mkdtempSync, readFileSync } from "node:fs";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
@@
   it("records repair events in the project repair log", () => {
-    const projectRoot = "/tmp/aimux-repair-project";
+    const projectRoot = mkdtempSync(join(tmpdir(), "aimux-repair-project-"));
@@
-    const [line] = readFileSync(path, "utf8").trim().split("\n");
-    expect(JSON.parse(line!)).toMatchObject({
+    const lines = readFileSync(path, "utf8").trim().split("\n");
+    expect(JSON.parse(lines.at(-1)!)).toMatchObject({
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const projectRoot = "/tmp/aimux-repair-project";
recordRepairEvent({
ts: "2026-06-22T00:00:00.000Z",
projectRoot,
action: "tmux-runtime-repair",
reason: "runtime contract drift",
status: "repaired",
details: { currentDaemonPid: 123 },
});
const path = getProjectRepairLogPathFor(projectRoot);
expect(existsSync(path)).toBe(true);
const [line] = readFileSync(path, "utf8").trim().split("\n");
expect(JSON.parse(line!)).toMatchObject({
import { existsSync, mkdtempSync, readFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
const projectRoot = mkdtempSync(join(tmpdir(), "aimux-repair-project-"));
recordRepairEvent({
ts: "2026-06-22T00:00:00.000Z",
projectRoot,
action: "tmux-runtime-repair",
reason: "runtime contract drift",
status: "repaired",
details: { currentDaemonPid: 123 },
});
const path = getProjectRepairLogPathFor(projectRoot);
expect(existsSync(path)).toBe(true);
const lines = readFileSync(path, "utf8").trim().split("\n");
expect(JSON.parse(lines.at(-1)!)).toMatchObject({
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/repair-events.test.ts` around lines 14 - 28, The test uses a fixed
`/tmp/aimux-repair-project` path for projectRoot, which causes data from
previous test runs to persist and contaminate subsequent test runs. Replace the
hardcoded projectRoot string with a unique temporary directory generated per
test execution. Additionally, update the assertion logic to read and validate
the last line of the JSONL file instead of the first line, since prior runs may
have written earlier lines that would interfere with the test expectations.

Comment thread src/runtime-restart.ts
Comment on lines +539 to +542
const activeWindows = captureActiveNonDashboardWindows(projectRoot, tmux);
const resolved = resolveDashboard(projectRoot, tmux, { forceReload: true, openInHostSession: true });
relinkDashboardToClientSessions(projectRoot, tmux, resolved.dashboardTarget);
restoreActiveWindows(tmux, activeWindows);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Always restore active non-dashboard windows, even on dashboard reload errors.

restoreActiveWindows(...) currently runs only on the success path. If reload/relink throws, focus restoration is skipped and clients can be left on an unintended window.

Proposed fix
-      try {
-        const activeWindows = captureActiveNonDashboardWindows(projectRoot, tmux);
+      const activeWindows = captureActiveNonDashboardWindows(projectRoot, tmux);
+      try {
         const resolved = resolveDashboard(projectRoot, tmux, { forceReload: true, openInHostSession: true });
         relinkDashboardToClientSessions(projectRoot, tmux, resolved.dashboardTarget);
-        restoreActiveWindows(tmux, activeWindows);
         result.dashboard.status = "reloaded";
         result.dashboard.sessionName = resolved.dashboardSession.sessionName;
         result.dashboard.target = resolved.dashboardTarget;
       } catch (error) {
         result.dashboard.status = "failed";
         result.dashboard.error = errorMessage(error);
+      } finally {
+        restoreActiveWindows(tmux, activeWindows);
       }

Also applies to: 546-549

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/runtime-restart.ts` around lines 539 - 542, The restoreActiveWindows()
call is only executed on the success path, meaning if resolveDashboard() or
relinkDashboardToClientSessions() throws an error, active window restoration is
skipped. Wrap the resolveDashboard() and relinkDashboardToClientSessions() calls
in a try-finally block so that restoreActiveWindows() is always called with the
captured activeWindows, even when an error occurs during the dashboard reload or
relink operations.

Comment thread src/runtime-restart.ts
Comment on lines 688 to 694
if (result.summary.runtimeRebuildRequired > 0) {
lines.push("");
lines.push("Runtime rebuild required:");
lines.push("Runtime repaired:");
for (const project of result.projects.filter((entry) => entry.runtimeRebuildRequired)) {
lines.push(` ${project.projectRoot}`);
}
lines.push("Control plane repair completed without killing agents.");
lines.push("The dashboard will show a rebuild warning; manual command:");
lines.push(" aimux restart-runtime --project-root <project> --open");
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

The “Runtime repaired” section can report failed repairs as repaired.

This block is gated by runtimeRebuildRequired, so projects with runtime.status === "failed" still appear under “Runtime repaired:”. Consider filtering by runtime.status === "repaired" or renaming the heading to avoid incorrect operator output.

Proposed fix (status-accurate sections)
-  if (result.summary.runtimeRebuildRequired > 0) {
+  const repairedRuntime = result.projects.filter(
+    (entry) => entry.runtimeRebuildRequired && entry.runtime.status === "repaired",
+  );
+  const failedRuntime = result.projects.filter(
+    (entry) => entry.runtimeRebuildRequired && entry.runtime.status === "failed",
+  );
+
+  if (repairedRuntime.length > 0) {
     lines.push("");
     lines.push("Runtime repaired:");
-    for (const project of result.projects.filter((entry) => entry.runtimeRebuildRequired)) {
+    for (const project of repairedRuntime) {
+      lines.push(`  ${project.projectRoot}`);
+    }
+  }
+
+  if (failedRuntime.length > 0) {
+    lines.push("");
+    lines.push("Runtime repair failed:");
+    for (const project of failedRuntime) {
       lines.push(`  ${project.projectRoot}`);
     }
   }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (result.summary.runtimeRebuildRequired > 0) {
lines.push("");
lines.push("Runtime rebuild required:");
lines.push("Runtime repaired:");
for (const project of result.projects.filter((entry) => entry.runtimeRebuildRequired)) {
lines.push(` ${project.projectRoot}`);
}
lines.push("Control plane repair completed without killing agents.");
lines.push("The dashboard will show a rebuild warning; manual command:");
lines.push(" aimux restart-runtime --project-root <project> --open");
}
const repairedRuntime = result.projects.filter(
(entry) => entry.runtimeRebuildRequired && entry.runtime.status === "repaired",
);
const failedRuntime = result.projects.filter(
(entry) => entry.runtimeRebuildRequired && entry.runtime.status === "failed",
);
if (repairedRuntime.length > 0) {
lines.push("");
lines.push("Runtime repaired:");
for (const project of repairedRuntime) {
lines.push(` ${project.projectRoot}`);
}
}
if (failedRuntime.length > 0) {
lines.push("");
lines.push("Runtime repair failed:");
for (const project of failedRuntime) {
lines.push(` ${project.projectRoot}`);
}
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/runtime-restart.ts` around lines 688 - 694, The "Runtime repaired:"
section is filtering only by runtimeRebuildRequired status, but this can include
projects with failed repairs. Modify the filter condition in the for loop that
iterates over result.projects to check both that entry.runtimeRebuildRequired is
true AND that entry.runtime.status equals "repaired", ensuring only successfully
repaired projects are displayed under the "Runtime repaired:" heading.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant