Skip to content

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

fix(cos): keep the Learning card's skipped count inside the card on mobile

Adam Eivyf98e47ac2059
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 48e42138d1..33a5c98c20 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -2,6 +2,7 @@
## Fixed
+- The Chief of Staff status panel's Learning card no longer spills its skipped-task count outside the card on mobile. The "(3 skipped)" note used to sit beside the success rate on one line, where it was too wide to fit a narrow card and rendered past the border; it now sits on its own line under the percentage and truncates if it can't fit.
- [issue-2669] Sharing, Messages, and Calendar screens no longer show two stacked error toasts when a share/subscribe/export/save/sync action fails — the custom-catch callers now pass `{ silent: true }` so only their own toast fires, not the shared `request()` helper's default one too. Swept the Messages/calendar/sharing feature area (both ConfigTabs, InboxTab, ReviewTab, ShareToButton, and the Sharing page) and threaded a backward-compatible `options` arg into the affected API wrappers (`evaluateMessages`, `enableGmailApi`, `getGoogleAuthUrl`, `create/updateMessageAccount`, `create/updateCalendarAccount`, `updateSubcalendars`, `saveGoogleAuthCredentials`, `start/runGoogleAutoConfig`, `confirmDailyReviewEvent`).
- Creative Director projects that use the Antigravity provider no longer get stuck on "Planning." The agent now reliably receives its instructions instead of launching and sitting idle at an empty prompt (it waits for Antigravity's input box to be ready before sending, the same way the Claude provider does), so planning actually runs to completion.
- A Creative Director project no longer wedges in "Planning" when its agent is interrupted or crashes mid-run. The stuck run is now cleaned up as soon as the dead agent is detected, so the project can retry on its own instead of waiting for the next server restart.
diff --git a/PLAN.md b/PLAN.md
index 2533fa32ea..fc84d7aed1 100644
--- a/PLAN.md
+++ b/PLAN.md
@@ -88,6 +88,10 @@ by `/do:replan --issues`:
- [ ] **Handle `agy` + non-empty `extraArgs` so the prompt stays the LAST argv token.** `agy --print` takes the prompt as its VALUE, so `ensureAntigravityPrintArgs` puts `--print` last and `prepareAntigravityPrompt` (via `prepareCliPrompt`, `server/lib/antigravity.js` / `server/lib/cliProviderArgs.js`) splices the prompt right after it. But `cliProviderRun.js` builds `[...buildCliArgs(provider), ...extraArgs]`, so for an antigravity provider with a non-empty `extraArgs` the delivered argv becomes `… --print "<PROMPT>" <extraArg…>` — the prompt is still `--print`'s value (correct), but any trailing extraArgs become positional args agy may reject. Low risk today (no caller passes `extraArgs` for an antigravity provider), but if one is added, either strip/relocate the trailing `--print` marker so extraArgs precede it, or have `prepareAntigravityPrompt` move `--print <prompt>` to the very end after splicing. Deferred from the agy prompt-delivery fix — the shipped paths (CD plan via runner/direct, Run Prompt, ask, vision) pass no extraArgs and are validated end-to-end.
+### CoS stat-card follow-ups
+
+- [ ] **Retire or wire up `StatCard`'s dead `activeLabel` prop, and de-dup the two hand-rolled Learning cards.** `activeLabel` (`client/src/components/cos/StatCard.jsx:1`, rendered at :59-63 and interpolated into `ariaLabel` at :2) has **zero callers** across the client — no `activeLabel=` usage and no spread props into `<StatCard>`. It is also only honored by the *default* variant: the `compact` (:6-27) and `mini` (:29-46) variants silently drop it, so a future caller passing it to a compact card would get nothing. Either delete the prop + its render branch, or make the compact/mini variants honor it. Related: the two Learning cards (`client/src/pages/ChiefOfStaff.jsx` ~512-537 compact, ~832-858 ascii `mini`) are hand-rolled buttons rather than `StatCard`s precisely because StatCard supports neither `onClick` nor a status-driven border color nor a sub-label on the compact variant — and they duplicate the same `status === 'critical' ? … : 'warning' ? …` color ternaries three times each. Wiring the sub-label through (an `activeLabel`-style slot honored by all variants) plus `onClick`/border-tone props would let both collapse onto StatCard. Deferred from the mobile-overflow fix (which only restructured the compact card's value/label stacking): removing or re-speccing a prop on a shared component used by every CoS stat card is a distinct refactor deserving its own PR + tests, and the overflow fix must not ride on it.
+
### Creative Director agents should not push code (deferred — needs a distinct completion contract)
- [ ] **Suppress `/simplify` + `/do:push` + PR in CD agent completions WITHOUT breaking their API output contract.** CD plan/treatment/evaluation agents persist their real output via an HTTP call in the task BODY (e.g. `PATCH http://localhost:5555/api/creative-director/{id}/plan` — see the plan prompt), and use the `.agent-done` sentinel only as a *done-signal* (a short markdown summary that PortOS's 2s poll consumes to finalize the run). They run on `main` (`useWorktree:false`, `configCodingOnMain:true`) and make no repo changes, so the trailing `/simplify` → `/do:push` completion is both pointless and dangerous (a `/do:push` on main could commit stray working-tree files). The fix must remove `/simplify`+`/do:push`+PR from the CD completion while KEEPING (a) the sentinel done-signal handshake and (b) the task-body PATCH as the output channel. **Do NOT reuse `discardWorktree`** — codex review (2026-07-16) correctly flagged that it routes to `buildProgrammaticOutputCompletionSection`, whose wording ("your *only* output channel is the `.agent-done` sentinel; write your result there in the payload format from your instructions") directly contradicts the PATCH and could make the agent write the plan to the sentinel instead of PATCHing → plan never persists → project stalls/re-enqueues. `readOnly:true` is also wrong ("read data and report findings only" contradicts the PATCH, and the CLI read-only path emits no sentinel). The correct fix is a NEW completion contract (e.g. a `apiOutput`/`noRepoOutput` metadata flag) that emits: "This task persists its output via the API/tool calls described above and makes no repo changes — do NOT run `/simplify`, `/do:push`, `/do:pr`, `git commit/push`, or open a PR; when done write a short summary to the sentinel to signal completion." Thread the flag through the completion selection in `server/services/agentPromptBuilder.js` (lines ~1137-1160 light path + the full-context path ~790, and whichever of `buildTuiCompletionSection`/`buildCliCompletionSection` CD actually reaches — confirm via a regenerated CD prompt fixture) and add a test asserting the CD prompt contains the sentinel step but NO `/do:push`/`/do:pr`/`/simplify`. Deferred from this PR because it needs a carefully-designed prompt-contract change + fixture test, not a rushed flag reuse.
diff --git a/client/src/pages/ChiefOfStaff.jsx b/client/src/pages/ChiefOfStaff.jsx
index ff953d36e0..223b684efa 100644
--- a/client/src/pages/ChiefOfStaff.jsx
+++ b/client/src/pages/ChiefOfStaff.jsx
@@ -525,14 +525,16 @@ export default function ChiefOfStaff() {
}`} />
<div className="flex-1 min-w-0 text-left">
<div className="text-[10px] text-gray-500">Learning</div>
- <div className="text-sm font-bold text-white flex items-center gap-2">
+ {/* Stacked, not a flex row: as flex items these keep min-width:auto,
+ so on a narrow card the skipped label can't shrink and spills out. */}
+ <div className="text-sm font-bold text-white truncate">
{learningSummary?.overallSuccessRate != null ? `${learningSummary.overallSuccessRate}%` : 'No data'}
- {learningSummary?.skipped > 0 && (
- <span className="text-[9px] text-port-error font-normal">
- ({learningSummary.skipped} skipped)
- </span>
- )}
</div>
+ {learningSummary?.skipped > 0 && (
+ <div className="text-[9px] text-port-error font-normal truncate">
+ {learningSummary.skipped} skipped
+ </div>
+ )}
</div>
</button>
{status?.running ? (
diff --git a/client/src/pages/ChiefOfStaff.test.jsx b/client/src/pages/ChiefOfStaff.test.jsx
index 4b3a06eb5d..735a2661cc 100644
--- a/client/src/pages/ChiefOfStaff.test.jsx
+++ b/client/src/pages/ChiefOfStaff.test.jsx
@@ -1,5 +1,5 @@
import { describe, it, expect, vi, beforeEach } from 'vitest';
-import { render, screen, waitFor, fireEvent, act } from '@testing-library/react';
+import { render, screen, waitFor, fireEvent, act, within } from '@testing-library/react';
import { MemoryRouter, Routes, Route } from 'react-router-dom';
// Regression coverage for #2519 — the page-level Force Evaluate handler must
@@ -113,6 +113,78 @@ describe('ChiefOfStaff handleForceEvaluate', () => {
});
});
+// The Learning stat card's skipped-count label used to sit in a `flex` row
+// beside the success-rate value. Flex items default to min-width:auto, so on a
+// narrow (mobile) card the label could not shrink below its min-content width
+// and rendered outside the card's border. jsdom does no layout, so these guards
+// pin the containment contract that keeps it inside: the label is its own block
+// under the value (not a flex sibling), and it truncates.
+describe('ChiefOfStaff Learning card skipped label', () => {
+ const summaryWithSkipped = {
+ overallSuccessRate: 84,
+ skipped: 3,
+ status: 'warning',
+ totalCompleted: 20,
+ };
+
+ const renderAt = (tab) => render(
+ <MemoryRouter initialEntries={[`/cos/${tab}`]}>
+ <Routes>
+ <Route path="/cos/:tab" element={<ChiefOfStaff />} />
+ </Routes>
+ </MemoryRouter>,
+ );
+
+ // The page renders more than one Learning card (the compact card in the CoS
+ // panel, plus the `mini` card in the ascii-mode stats bar — Tailwind-`hidden`,
+ // but jsdom applies no CSS so it is still queryable). Never index into a
+ // document-order match list: on the pre-fix markup the compact card read
+ // "(3 skipped)", so an exact-text lookup silently drifted to the mini card and
+ // asserted against the wrong element. Scope to each card and hold every
+ // variant to the contract instead.
+ const learningCards = async () => {
+ const cards = await screen.findAllByRole('button', { name: /Learning/ });
+ expect(cards.length).toBeGreaterThan(0);
+ return cards;
+ };
+
+ it('stacks the skipped label under the value instead of in a flex row', async () => {
+ api.getCosLearningSummary.mockResolvedValue(summaryWithSkipped);
+ renderAt('config');
+
+ for (const card of await learningCards()) {
+ const value = within(card).getByText('84%');
+ const label = within(card).getByText(/skipped/);
+ // The value element holds the rate and nothing else — a parenthetical
+ // tucked beside it inside one flex row is what overflowed.
+ expect(value.textContent).toBe('84%');
+ // Stacked in the card's text column: same parent, which must not lay its
+ // children out as a row. Exact token match — the column legitimately
+ // carries `flex-1` (a flex-child property, not `display:flex`), which
+ // must not trip this guard.
+ expect(label.parentElement).toBe(value.parentElement);
+ expect(value.parentElement.classList.contains('flex')).toBe(false);
+ }
+ });
+
+ it('truncates the skipped label so it clips inside the card', async () => {
+ api.getCosLearningSummary.mockResolvedValue(summaryWithSkipped);
+ renderAt('config');
+
+ for (const card of await learningCards()) {
+ expect(within(card).getByText(/skipped/).classList.contains('truncate')).toBe(true);
+ }
+ });
+
+ it('omits the skipped label entirely when nothing was skipped', async () => {
+ api.getCosLearningSummary.mockResolvedValue({ ...summaryWithSkipped, skipped: 0, status: 'good' });
+ renderAt('config');
+
+ expect(await screen.findAllByText('84%')).not.toHaveLength(0);
+ expect(screen.queryByText(/skipped/)).not.toBeInTheDocument();
+ });
+});
+
// #2654: the banner is now prop-driven, refreshed only through fetchData. There
// is deliberately no on-demand insights refresh: /cos/actionable-insights runs a
// health check that AUTO-RESTARTS errored processes and re-emits cos:health:check,