fix(approvals): merge-time fixes for the watching badge (#473)

- session.ts: a pane capture that fails now CLEARS the watching label
  (and emits watchingChanged so pages drop the badge) instead of keeping
  the last one, so a failed capture degrades toward an alert rather than
  pre-acknowledging the next real idle prompt. Test updated; invariant
  noted in architecture-invariants.
- approvals-ui.js: the header bell counts only unacknowledged items
  (pendingApprovalsCount), matching codeman tui's pendingApprovalCount();
  pinned in watching-no-alert.test.ts.
- mobile-overview.js: move the orphaned "Pill copy per state" JSDoc back
  onto MOBILE_OVERVIEW_PILL_LABEL.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Codeman maintainer
2026-09-23 11:40:03 +02:00
parent da6fa663e7
commit 0462a5d5a0
6 changed files with 40 additions and 13 deletions
+14 -1
View File
@@ -194,8 +194,21 @@ Object.assign(CodemanApp.prototype, {
document.querySelector('.btn-approvals')?.setAttribute('aria-expanded', 'false');
},
/**
* Items still waiting on a human. An acknowledged item (a human already looked, or the
* session opened it acknowledged because it is watching its own background work) keeps
* its card but arms no alert, so it must not light the bell either; this is the same
* count `pendingApprovalCount()` gives `codeman tui`.
*/
pendingApprovalsCount() {
if (!this.approvals) return 0;
let count = 0;
for (const item of this.approvals.values()) if (!item.acknowledgedAt) count++;
return count;
},
renderApprovals() {
const count = this.approvals ? this.approvals.size : 0;
const count = this.pendingApprovalsCount();
const btn = document.querySelector('.btn-approvals');
if (btn) {
// Marker-class visibility (base header rules are display !important):
+1 -1
View File
@@ -60,7 +60,6 @@ const MOBILE_OVERVIEW_RUN_MODES = [
{ mode: 'shell', label: 'Terminal / Shell', short: 'Shell' },
];
/** Pill copy per state. Kept short: a phone row has ~90px for it. */
/**
* The one word every surface puts on the watching badge, and the tooltip that says
* what the pane actually reported. Both live here so the phone overview, the desktop
@@ -69,6 +68,7 @@ const MOBILE_OVERVIEW_RUN_MODES = [
const WATCHING_BADGE_TEXT = 'watching';
const watchingBadgeTitle = (label) => 'Still running in the background: ' + label;
/** Pill copy per state. Kept short: a phone row has ~90px for it. */
const MOBILE_OVERVIEW_PILL_LABEL = {
needs: 'needs you',
error: 'error',