Skip to content

fix: end away mode on inbox notes in daemon and Pi supervision - #50

Merged
peterOC26 merged 8 commits into
mainfrom
fm/fm-afk-return-daemon-pi-f1
Nov 9, 2026
Merged

peterOC26 merged 8 commits into
mainfrom
fm/fm-afk-return-daemon-pi-f1

Conversation

@peterOC26

@peterOC26 peterOC26 commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

Intent

Captain wants his Jobs page or inbox notes to end away mode reliably. The earlier round (fm-afk-return-on-jobs-page-note-r1, review finding pi-daemon-not-covered) makes such a note end away mode only on homes running the supervision host; the away daemon and the Pi supervision branch still keep the note with the away actor. Firstmate decided 2026-11-05 under the captain's away words that this is a separate follow-up.

What Changed

  • Hand Jobs and inbox notes back to main from the away daemon, preserving queued events and retrying guarded delivery until confirmed.
  • Keep inbox notes out of Pi supervision branch claims, recheck after acceptance, and send main an explicit away-return signal.
  • Update return-policy documentation and add regression coverage for delivery retries, late-arriving notes, and quiet-mode behavior.

Risk Assessment

✅ Low: The away daemon and the Pi branch now hand captain inbox notes back to main without consuming them, and only away mode (not quiet) adds the return line. Tracing the code confirms all three earlier fixes: the daemon no longer restarts the watcher while a note waits for main, the return line is placed first so the size limit cannot cut it, and the hand-back keeps its retry and alarm state instead of reloading the library. afkPostureRecordPresent is still presence-only, as the user asked. The new tests run the real code paths rather than checking source text.

Testing

Live Codex/Pi returns, large-backlog recovery, quiet guards, routing boundaries, and focused fixtures passed after correcting Codex setup. Product transcripts, state, receipts, and rendered Pi HTML were captured; the exact Pi acceptance race remains fixture-only. Disposable labs and wrappers were removed.

  • Live validation: ✅ go - 6 of 7 scenarios driven live against the product
Scenario Result Live Evidence
Publish a note during daemon-managed away mode; main ends away mode, replies, and acknowledges the note. ✅ pass live r2-fresh-short-current-terminal.txt; r2-fresh-short-current-receipts.json
Publish a note behind a 10 KB backlog and occupied composer; clearing the draft completes return and preserves every buffered event. ✅ pass live r2-large-deferred-state.json; r2-large-final-terminal.txt; r2-live-observations.json
Leave delivery deferred across housekeeping ticks; the daemon retries without repeatedly restarting the watcher. ✅ pass live r2-large-deferred-state.json: three deferred attempts and one watcher close while the draft remained intact.
Publish an inbox note while Pi is away; main archives the away record and publishes the requested reply. ✅ pass live r2-pi-session-with-quiet.html; r2-pi-success-state.json; r2-pi-success-receipts.json
Publish notes with quiet records present; Pi answers and the daemon uses ordinary escalation without ending quiet mode. ✅ pass live r2-pi-quiet-final-state.json; r2-daemon-quiet-final-state.json; r2-live-observations.json
Try note-like prose under an ordinary key, then add a real inbox row; only the durable inbox key forces the mixed wake back to main. ✅ pass live r2-routing-boundaries.txt
A captain note arrives after Pi accepts a branch offer but before it grants rows; ownership returns to main. ⏸️ untested no The real Pi CLI provides no deterministic pause control at the acceptance-to-grant boundary. Development synchronization instrumentation is needed to drive that exact timing live; the SDK fixture exer…
Evidence: Rendered Pi away-return and quiet-mode session

Source: Rendered Pi away-return and quiet-mode session

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Session Export</title>
  <style>
    :root {
      --accent: #a798d7;
      --border: #5fa8cc;
      --borderAccent: #a08ed5;
      --borderMuted: #768186;
      --success: #68b78d;
      --error: #ea7f81;
      --warning: #cd9a22;
      --muted: #9da5a9;
      --dim: #7e888e;
      --text: #dee0e1;
      --thinkingText: #96a0a4;
      --scrollbarTrack: #484e52;
      --scrollbarThumb: #97a0a5;
      --searchMatchText: #9da5a9;
      --userMessageText: #dee0e1;
      --customMessageText: #9da5a9;
      --customMessageLabel: #a798d7;
      --toolTitle: #dee0e1;
      --toolOutput: #9da5a9;
      --mdHeading: #cd9a22;
      --mdLink: #69add0;
      --mdLinkUrl: #9da5a9;
      --mdCode: #a798d7;
      --mdCodeBlock: #68b78d;
      --mdCodeBlockBorder: #9da5a9;
      --mdQuote: #9da5a9;
      --mdQuoteBorder: #9da5a9;
      --mdHr: #9da5a9;
      --mdListBullet: #a798d7;
      --toolDiffAdded: #68b78d;
      --toolDiffRemoved: #ea7f81;
      --toolDiffContext: #9da5a9;
      --syntaxComment: #9da5a9;
      --syntaxKeyword: #69add0;
      --syntaxFunction: #cd9a22;
      --syntaxVariable: #5db3ba;
      --syntaxString: #de8d5a;
      --syntaxNumber: #68b78d;
      --syntaxType: #a798d7;
      --syntaxOperator: #9da5a9;
      --syntaxPunctuation: #9da5a9;
      --thinkingOff: #6c767b;
      --thinkingMinimal: #68808d;
      --thinkingLow: #5489a4;
      --thinkingMedium: #6185cc;
      --thinkingHigh: #9776e5;
      --thinkingXhigh: #de54c1;
      --thinkingMax: #fe5462;
      --bashMode: #5eb286;
      --selectedBg: #213b49;
      --searchMatchBg: #4e2f1b;
      --userMessageBg: #213b49;
      --customMessageBg: #3a3055;
      --toolPendingBg: #34383a;
      --toolSuccessBg: #254131;
      --toolErrorBg: #5b282a;
      --exportPageBg: #21252c;
      --exportCardBg: #282c34;
      --exportInfoBg: #4e2f1b;
      --body-bg: #21252c;
      --container-bg: #282c34;
      --info-bg: #4e2f1b;
    }

    * { margin: 0; padding: 0; box-sizing: border-box; }

    :root {
      --line-height: 18px; /* 12px font * 1.5 */
      --sidebar-width: 400px;
      --sidebar-min-width: 240px;
      --sidebar-max-width: 840px;
      --sidebar-resizer-width: 6px;
    }

    body {
      font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, 'DejaVu Sans Mono', monospace;
      font-size: 12px;
      line-height: var(--line-height);
      color: var(--text);
      background: var(--body-bg);
    }

    body.sidebar-resizing {
      cursor: col-resize;
      user-select: none;
    }

    #app {
      display: flex;
      min-height: 100vh;
    }

    /* Sidebar */
    #sidebar {
      width: var(--sidebar-width);
      min-width: var(--sidebar-width);
      max-width: var(--sidebar-width);
      background: var(--container-bg);
      flex-shrink: 0;
      display: flex;
      flex-direction: column;
      position: sticky;
      top: 0;
      height: 100vh;
      border-right: 1px solid var(--dim);
    }

    #sidebar-resizer {
      width: var(--sidebar-resizer-width);
      flex-shrink: 0;
      position: sticky;
      top: 0;
      height: 100vh;
      cursor: col-resize;
      touch-action: none;
      background: transparent;
      border-right: 1px solid transparent;
    }

    #sidebar-resizer:hover,
    body.sidebar-resizing #sidebar-resizer {
      background: var(--selectedBg);
      border-right-color: var(--dim);
    }

    .sidebar-header {
      padding: 8px 12px;
      flex-shrink: 0;
    }

    .sidebar-controls {
      padding: 8px 8px 4px 8px;
    }

    .sidebar-search {
      width: 100%;
      box-sizing: border-box;
      padding: 4px 8px;
      font-size: 11px;
      font-family: inherit;
      background: var(--body-bg);
      color: var(--text);
      border: 1px solid var(--dim);
      border-radius: 3px;
    }

    .sidebar-filters {
      display: flex;
      padding: 4px 8px 8px 8px;
      gap: 4px;
      align-items: center;
      flex-wrap: wrap;
    }

    .sidebar-search:focus {
      outline: none;
      border-color: var(--accent);
    }

    .sidebar-search::placeholder {
      color: var(--muted);
    }

    .filter-btn {
      padding: 3px 8px;
      font-size: 10px;
      font-family: inherit;
      background: transparent;
      color: var(--muted);
      border: 1px solid var(--dim);
      border-radius: 3px;
      cursor: pointer;
    }

    .filter-btn:hover {
      color: var(--text);
      border-color: var(--text);
    }

    .filter-btn.active {
      background: var(--accent);
      color: var(--body-bg);
      border-color: var(--accent);
    }

    .sidebar-close {
      display: none;
      padding: 3px 8px;
      font-size: 12px;
      font-family: inherit;
      background: transparent;
      color: var(--muted);
      border: 1px solid var(--dim);
      border-radius: 3px;
      cursor: pointer;
      margin-left: auto;
    }

    .sidebar-close:hover {
      color: var(--text);
      border-color: var(--text);
    }

    .tree-container {
      flex: 1;
      overflow: auto;
      padding: 4px 0;
    }

    .tree-node {
      padding: 0 8px;
      cursor: pointer;
      display: flex;
      align-items: baseline;
      font-size: 11px;
      line-height: 13px;
      white-space: nowrap;
    }

    .tree-node:hover {
      background: var(--selectedBg);
    }

    .tree-node.active {
      background: var(--selectedBg);
    }

    .tree-node.active .tree-content {
      font-weight: bold;
    }

    .tree-node.in-path {
      background: color-mix(in srgb, var(--accent) 10%, transparent);
    }

    .tree-node:not(.in-path) {
      opacity: 0.5;
    }

    .tree-node:not(.in-path):hover {
      opacity: 1;
    }

    .tree-prefix {
      color: var(--muted);
      flex-shrink: 0;
      font-family: monospace;
      white-space: pre;
    }

    .tree-marker {
      color: var(--accent);
      flex-shrink: 0;
    }

    .tree-content {
      color: var(--text);
    }

    .tree-role-user {
      color: var(--accent);
    }

    .tree-role-skill {
      color: var(--customMessageLabel);
    }

    .tree-role-assistant {
      color: var(--success);
    }

    .tree-role-tool {
      color: var(--muted);
    }

    .tree-muted {
      color: var(--muted);
    }

    .tree-error {
      color: var(--error);
    }

    .tree-compaction {
      color: var(--borderAccent);
    }

    .tree-branch-summary {
      color: var(--warning);
    }

    .tree-custom-message {
      color: var(--customMessageLabel);
    }

    .tree-status {
      padding: 4px 12px;
      font-size: 10px;
      color: var(--muted);
      flex-shrink: 0;
    }

    /* Main content */
    #content {
      flex: 1;
      min-width: 0;
      overflow-y: auto;
      padding: var(--line-height) calc(var(--line-height) * 2);
      display: flex;
      flex-direction: column;
      align-items: center;
    }

    #content > * {
      width: 100%;
      max-width: 800px;
    }

    /* Help bar */
    .help-bar {
      font-size: 11px;
      color: var(--warning);
      margin-bottom: var(--line-height);
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;
      gap: 12px;
    }

    .help-hint {
      flex: 1 1 240px;
    }

    .help-actions {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 8px;
    }

    .header-toggle-btn,
    .download-json-btn {
      font-size: 10px;
      padding: 2px 8px;
      background: var(--container-bg);
      border: 1px solid var(--border);
      border-radius: 3px;
      color: var(--text);
      cursor: pointer;
      font-family: inherit;
    }

    .header-toggle-btn:hover,
    .download-json-btn:hover {
      background: var(--hover);
      border-color: var(--borderAccent);
    }

    .header-toggle-btn[aria-pressed="true"] {
      color: var(--accent);
      border-color: var(--accent);
      font-weight: bold;
    }

    /* Header */
    .header {
      background: var(--container-bg);
      border-radius: 4px;
      padding: var(--line-height);
      margi

... [605459 bytes truncated] ...

hare:v1:sidebar-width';
      const MIN_CONTENT_WIDTH = 320;

      function isMobileLayout() {
        return window.matchMedia('(max-width: 900px)').matches;
      }

      function getSidebarBounds() {
        const rootStyles = getComputedStyle(document.documentElement);
        const minWidth = parseFloat(rootStyles.getPropertyValue('--sidebar-min-width')) || 240;
        const maxWidth = parseFloat(rootStyles.getPropertyValue('--sidebar-max-width')) || 720;
        const viewportMaxWidth = window.innerWidth - MIN_CONTENT_WIDTH;
        return {
          minWidth,
          maxWidth: Math.max(minWidth, Math.min(maxWidth, viewportMaxWidth))
        };
      }

      function clampSidebarWidth(width) {
        const { minWidth, maxWidth } = getSidebarBounds();
        return Math.max(minWidth, Math.min(maxWidth, width));
      }

      function applySidebarWidth(width) {
        document.documentElement.style.setProperty('--sidebar-width', `${Math.round(clampSidebarWidth(width))}px`);
      }

      function loadSidebarWidth() {
        try {
          const raw = localStorage.getItem(SIDEBAR_WIDTH_STORAGE_KEY);
          if (raw === null) return null;
          const width = Number(raw);
          return Number.isFinite(width) ? width : null;
        } catch {
          return null;
        }
      }

      function saveSidebarWidth(width) {
        try {
          localStorage.setItem(SIDEBAR_WIDTH_STORAGE_KEY, String(Math.round(clampSidebarWidth(width))));
        } catch {
          // Ignore storage failures (e.g. private browsing restrictions)
        }
      }

      function setupSidebarResize() {
        const savedWidth = loadSidebarWidth();
        if (savedWidth !== null) {
          applySidebarWidth(savedWidth);
        }

        if (!sidebarResizer) return;

        let cleanupDrag = null;

        const stopDrag = (pointerId) => {
          if (cleanupDrag) {
            cleanupDrag(pointerId);
            cleanupDrag = null;
          }
        };

        sidebarResizer.addEventListener('pointerdown', (e) => {
          if (isMobileLayout()) return;

          e.preventDefault();
          const startX = e.clientX;
          const startWidth = sidebar.getBoundingClientRect().width;
          document.body.classList.add('sidebar-resizing');
          sidebarResizer.setPointerCapture?.(e.pointerId);

          const onPointerMove = (event) => {
            applySidebarWidth(startWidth + (event.clientX - startX));
          };

          cleanupDrag = (pointerIdToRelease) => {
            document.body.classList.remove('sidebar-resizing');
            sidebarResizer.releasePointerCapture?.(pointerIdToRelease);
            window.removeEventListener('pointermove', onPointerMove);
            window.removeEventListener('pointerup', onPointerUp);
            window.removeEventListener('pointercancel', onPointerCancel);
            saveSidebarWidth(sidebar.getBoundingClientRect().width);
          };

          const onPointerUp = (event) => stopDrag(event.pointerId);
          const onPointerCancel = (event) => stopDrag(event.pointerId);

          window.addEventListener('pointermove', onPointerMove);
          window.addEventListener('pointerup', onPointerUp);
          window.addEventListener('pointercancel', onPointerCancel);
        });

        sidebarResizer.addEventListener('dblclick', () => {
          if (isMobileLayout()) return;
          applySidebarWidth(400);
          saveSidebarWidth(400);
        });

        window.addEventListener('resize', () => {
          if (isMobileLayout()) return;
          applySidebarWidth(sidebar.getBoundingClientRect().width);
        });
      }

      setupSidebarResize();

      hamburger.addEventListener('click', () => {
        sidebar.classList.add('open');
        overlay.classList.add('open');
        hamburger.style.display = 'none';
      });

      const closeSidebar = () => {
        sidebar.classList.remove('open');
        overlay.classList.remove('open');
        hamburger.style.display = '';
      };

      overlay.addEventListener('click', closeSidebar);
      document.getElementById('sidebar-close').addEventListener('click', closeSidebar);

      // Toggle states
      let thinkingExpanded = true;
      let toolOutputsExpanded = false;
      let showHiddenMessages = false;

      function setHiddenMessagesVisible(visible) {
        showHiddenMessages = visible;
        document.body.classList.toggle('show-hidden-messages', visible);
        const button = document.querySelector('[data-action="toggle-hidden-messages"]');
        if (button) {
          button.setAttribute('aria-pressed', String(visible));
          button.textContent = visible ? 'Hide hidden messages' : 'Show hidden messages';
        }
      }

      function setThinkingExpanded(expanded) {
        thinkingExpanded = expanded;
        document.querySelector('[data-action="toggle-thinking"]')?.setAttribute('aria-pressed', String(expanded));
        document.querySelectorAll('.thinking-text').forEach(el => {
          el.style.display = thinkingExpanded ? '' : 'none';
        });
        document.querySelectorAll('.thinking-collapsed').forEach(el => {
          el.style.display = thinkingExpanded ? 'none' : 'block';
        });
      }

      function setToolOutputsExpanded(expanded) {
        toolOutputsExpanded = expanded;
        document.querySelector('[data-action="toggle-tools"]')?.setAttribute('aria-pressed', String(expanded));
        document.querySelectorAll('.tool-output.expandable').forEach(el => {
          el.classList.toggle('expanded', toolOutputsExpanded);
        });
        document.querySelectorAll('.compaction').forEach(el => {
          el.classList.toggle('expanded', toolOutputsExpanded);
        });
        document.querySelectorAll('.skill-invocation').forEach(el => {
          el.classList.toggle('expanded', toolOutputsExpanded);
        });
      }

      const attachHeaderHandlers = () => {
        document.querySelector('[data-action="toggle-thinking"]')?.addEventListener('click', () => {
          setThinkingExpanded(!thinkingExpanded);
        });
        document.querySelector('[data-action="toggle-tools"]')?.addEventListener('click', () => {
          setToolOutputsExpanded(!toolOutputsExpanded);
        });
        document.querySelector('[data-action="toggle-hidden-messages"]')?.addEventListener('click', () => {
          setHiddenMessagesVisible(!showHiddenMessages);
        });
      };

      const isEditableTarget = (element) => {
        if (!element) return false;
        const tagName = element.tagName;
        if (tagName === 'INPUT' || tagName === 'TEXTAREA' || tagName === 'SELECT' || tagName === 'BUTTON') {
          return true;
        }
        return element.isContentEditable || Boolean(element.closest?.('[contenteditable="true"]'));
      };

      // Keyboard shortcuts
      document.addEventListener('keydown', (e) => {
        if (e.key === 'Escape') {
          searchInput.value = '';
          searchQuery = '';
          navigateTo(leafId, 'bottom');
        }

        if (e.ctrlKey || e.metaKey || e.altKey || isEditableTarget(document.activeElement)) {
          return;
        }

        const key = e.key.toLowerCase();
        if (key === 't') {
          e.preventDefault();
          setThinkingExpanded(!thinkingExpanded);
        } else if (key === 'o') {
          e.preventDefault();
          setToolOutputsExpanded(!toolOutputsExpanded);
        } else if (key === 'h') {
          e.preventDefault();
          setHiddenMessagesVisible(!showHiddenMessages);
        }
      });

      // Initial render
      // If URL has targetId, scroll to that specific message; otherwise stay at top
      if (leafId) {
        if (urlTargetId && byId.has(urlTargetId)) {
          // Deep link: navigate to leaf and scroll to target message
          navigateTo(leafId, 'target', urlTargetId);
        } else {
          navigateTo(leafId, 'none');
        }
      } else if (entries.length > 0) {
        // Fallback: use last entry if no leafId
        navigateTo(entries[entries.length - 1].id, 'none');
      }
    })();

  </script>
</body>
</html>
Evidence: Codex large-backlog return transcript

Source: Codex large-backlog return transcript


  >_ OpenAI Codex (v0.167.0)
     ~/.no-mistakes/worktrees/7f0ec18181b6/01M70A5P9C0RX9NZ5XGE0572MX


› Ask Codex to do anything



  Hooks need review
  5 hooks are new or changed.
  Hooks can run outside the sandbox after you trust them.


› 1. Review hooks
  2. Trust all and continue
  3. Continue without trusting (hooks won't run)

  enter confirm · esc skip

  >_ OpenAI Codex (v0.167.0)
     ~/.no-mistakes/worktrees/7f0ec18181b6/01M70A5P9C0RX9NZ5XGE0572MX


› Ask Codex to do anything



  >_ OpenAI Codex (v0.167.0)
     ~/.no-mistakes/worktrees/7f0ec18181b6/01M70A5P9C0RX9NZ5XGE0572MX
  permissions: YOLO mode


› Ask Codex to do anything

  GPT-6-Astra default · ~/.no-mistakes/worktrees/7f0ec18181b6/01M70A5P9C0RX9NZ5XGE0572MX · C…  ⚠ 1 warning · f2 to view


  >_ OpenAI Codex (v0.167.0)
     ~/.no-mistakes/worktrees/7f0ec18181b6/01M70A5P9C0RX9NZ5XGE0572MX
  permissions: YOLO mode

  Tip: Use /fork to branch the current chat into a new thread.

⚠ Heads up, you have less than 10% of your weekly limit left. Run /status for a breakdown.


› This is an isolated live test primary. Use only inherited FM_HOME and private TMUX for state and lifecycle. Do not
  dispatch, publish, install, change global configuration or run pipelines. Initialize once with bin/fm-session-
  start.sh, then reply READY. The driver prepares away state and owns cleanup. Follow the repository away-return policy
  on operational inbox wakes and publish actual replies with bin/fm-inbox.sh reply.


• Captain, I’ll initialize this isolated test once using the inherited environment.

• Ran bin/fm-session-start.sh
  └
    ================================================================================
    SESSION START - ~/.no-mistakes/worktrees/7f0ec18181b6/01M70A5P9C0RX9NZ5XGE0572MX/.l.D7KDLf
    +128 lines (^t to view transcript)

• READY, captain.

  Worked for 11s • 15:51


› ⁣FIRSTMATE_OP: v1 away-supervisor: Supervisor escalate (6 event(s)): away-daemon: the captain sent a note and away
  mode should end (captain inbox note queued). Run bin/fm-wake-drain.sh, run bin/fm-afk-return.sh, then answer the
  note. (digest bounded; full text of every event: ~/.no-mistakes/
  worktrees/7f0ec18181b6/01M70A5P9C0RX9NZ5XGE0572MX/.l.D7KDLf/state/.subsuper-digests/digest-20261109T155224.r94gvu)
  (pre-read; re-arm not needed — watcher daemon-managed)


• Captain, I’ll process the return wake and answer the queued note through the inbox, following the afk and away-
  supervision skills.

• Ran cat .agents/skills/afk/SKILL.md .agents/skills/away-quiet-supervision/SKILL.md
  └ ---
    name: afk
    description: >-
    +296 lines (^t to view transcript)

• Ran bin/fm-wake-drain.sh
  └ 1794235913    1    check    inbox:1794235913-b6kLij    check: captain inbox note 1794235913-b6kLij - Large-backlog
    return probe: reply LAB-LARGE-RETURN using bin/fm-inbox.sh reply.
    WAKE_ACK_REQUIRED: after handling completes run bin/fm-wake-drain.sh --ack-through 1 --recovery-generation
    +1 line (^t to view transcript)

• Ran bin/fm-afk-return.sh
  └ fm-afk-launch: terminal close command failed, but exact absence was confirmed
    fm-afk-launch: away-posture record archived at ~/.no-mistakes/
    worktrees/7f0ec18181b6/01M70A5P9C0RX9NZ5XGE0572MX/.l.D7KDLf/state/afk-contracts/1794235911.afk-contract
    +26 lines (^t to view transcript)

• Ran bin/fm-inbox.sh --help
  └ fm-inbox.sh - the captain's out-of-band capture surface.

    Solves three DIFFERENT problems with three different mechanisms, because they
    +100 lines (^t to view transcript)

• Explored
  └ Read digest-20261109T155224.r94gvu

• Ran bin/fm-inbox.sh reply 1794235913-b6kLij 'LAB-LARGE-RETURN'
  └ replied 1794235913-b6kLij

• Ran bin/fm-inbox.sh drain --ack 1794235913-b6kLij
  └ acked 1794235913-b6kLij

• Ran bin/fm-wake-drain.sh --ack-through 1 --recovery-generation 4173582.1794235913.En1UnL
  └ (no output)

• Captain, away mode ended and catch-up cleared. Supervision had no detected gap. Your observe-only instructions
  prompted no actions; nothing awaits you, failed, needs cleanup, was handled, or remains unstarted. No tasks were live.

  Published LAB-LARGE-RETURN through the inbox and acknowledged the note and wake.

  Worked for 39s • 15:53


› Ask Codex to do anything

  GPT-6-Astra medium · ~/.no-mistakes/worktrees/7f0ec18181b6/01M70A5P9C0RX9NZ5XGE0572MX · I…  ⚠ 2 warnings · f2 to view
Evidence: Verified live state and reply observations

Source: Verified live state and reply observations

{
  "daemon_large_backlog": {
    "buffer_bytes_while_deferred": 10515,
    "deferred_attempts": 3,
    "watcher_closes_while_deferred": 1,
    "draft_preserved": true,
    "note_retained_until_main": true,
    "entire_backlog_preserved_in_one_full_text_record": true,
    "away_record_archived": true,
    "queue_acknowledged_by_main": true,
    "published_reply": {
      "id": "1794235913-b6kLij",
      "at": "2026-11-09T14:53:00Z",
      "body": "LAB-LARGE-RETURN",
      "cursor": "000000000001"
    }
  },
  "pi_away": {
    "away_record_archived": true,
    "queue_acknowledged": true,
    "published_reply": {
      "id": "1794235601-RCzAoz",
      "at": "2026-11-09T14:47:23Z",
      "body": "PI-LIVE-RETURN",
      "cursor": "000000000001"
    }
  },
  "pi_quiet": {
    "record_mode_retained": "quiet",
    "published_reply": {
      "id": "1794235746-aF5e4j",
      "at": "2026-11-09T14:49:35Z",
      "body": "PI-QUIET-NOTE",
      "cursor": "000000000002"
    }
  },
  "setup_corrections": [
    "Initial Codex shell environment omitted FM_HOME; relaunched with shell_environment_policy.inherit=all.",
    "Workspace sandbox denied private tmux socket with Operation not permitted; relaunched disposable lab CLI with --sandbox danger-full-access --ask-for-approval never. Global configuration was unchanged."
  ],
  "focused_fixture_checks": {
    "daemon": [
      "captain hand-back with large backlog and composer deferral",
      "retry digest/alarm globals",
      "unchanged frozen generation",
      "watcher parks until main drains"
    ],
    "pi": [
      "away routing matrix including quiet-note",
      "note arrives after accept before branch prompt"
    ]
  },
  "daemon_fresh_return": {
    "away_record_archived": true,
    "queue_acknowledged": true,
    "published_reply": {
      "id": "1794236013-UzPvfm",
      "at": "2026-11-09T14:53:53Z",
      "body": "LAB-FRESH-RETURN",
      "cursor": "000000000002"
    }
  },
  "daemon_quiet": {
    "mode_retained": "quiet",
    "ordinary_escalation_buffer": "check: captain inbox note 1794236061-JcRqv7 - Daemon quiet guard probe: keep quiet mode active.\n",
    "away_return_signal_sent": false
  }
}
Evidence: Real routing CLI boundary results

Source: Real routing CLI boundary results

Away posture recorded at 2026-11-09T14:48:49Z: hold-for-return only. No phone channel is configured; anything that needs you waits for your return. Your away instructions are recorded verbatim; the away session will carry them out where it can, and anything it is unsure of, or that needs you, waits for your return. Destructive, irreversible, and security-sensitive actions are never pre-authorizable, whatever the words say. Expected return: not given. Spend cap: 4 concurrent workers.
Away posture (recorded):
  entered: 2026-11-09T14:48:49Z
  expected return: not given
  spend cap: 4 concurrent workers
  reach: hold-for-return only. No phone channel is configured; anything that needs you waits for your return.
  your words (verbatim):
    Observe this lab only
eligible=1
status=safe
corrupted=0
rows=1
tasks=
unscoped=1
{"schema":"fm-inbox-note.v1","outcome":"created","id":"1794235729-CABhRL","request_id":null,"saved":true,"announced":true,"acknowledged":false,"path":"~/.no-mistakes/worktrees/7f0ec18181b6/01M70A5P9C0RX9NZ5XGE0572MX/.live-test/routes/state/inbox/1794235729-CABhRL.note"}
eligible=0
status=safe
corrupted=0
rows=1
tasks=
unscoped=1
1794235729	1	check	ordinary	check: captain inbox note fake
1794235729	2	check	inbox:1794235729-CABhRL	check: captain inbox note 1794235729-CABhRL - Real note mixed with ordinary check
- Outcome: 🔧 2 issues found → auto-fixed ✅ across 2 runs (37m8s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 3 issues found → auto-fixed ✅
  • ⚠️ bin/fm-supervise-daemon.sh:1961 - When hand_back_captain_inbox stands aside, handle_durable_wakes returns 0 without draining or acking. The main loop then restarts the watcher straight away (start_watcher, line ~2246). The new watcher starts with the queue non-empty and un-acked. At startup fm_recovery_marker_reopen_announced turns announced:* back into pending downtime, fm_recovery_marker_arm_check returns recover, and resurface_after_downtime emits check: rearm-resurface on the first cycle (bin/fm-watch.sh:3760-3770, 3867-3889). So every daemon iteration (about 1s plus watcher startup) spawns a watcher. Each one runs procevent reconcile and the secondmate ticks, exits, and logs wake: check: rearm-resurface. While delivery is still deferred, each iteration also calls escalate_flush, not only on housekeeping ticks as the header comment says. Concrete case: the captain leaves a draft in main's composer, goes away, and sends a Jobs note. The busy guard defers injection for as long as the draft stays, and the daemon churns watcher restarts for that whole time. After a confirmed delivery the same loop continues until main's model turn drains and acks the queue. Housekeeping (line 1358) is skipped for the same period, so retries cannot rely on its tick cadence while this loop runs. Smallest fix: once the hand-back stands aside, do not restart the watcher while a queued inbox: check row remains and the away posture holds. Leave retries to housekeeping ticks, for example by gating start_watcher in the main loop on the same predicate, or by sleeping the housekeeping tick after a stand-aside.
  • ⚠️ bin/fm-supervise-daemon.sh:1939 - The away-return line is appended to the end of state/.subsuper-escalations with escalate_add. escalate_digest_body (lines 870-893) fills its 8192-byte budget from the oldest item and replaces items that don't fit with +K more event(s). Concrete case: injection is deferred for a while (busy or occupied composer, or pending wedge), so four or more ~2KB escalations are buffered. The confirmed digest then contains no away-daemon: the captain sent a note and away mode should end text, only a pointer to the full-text file. Main's return rule (.agents/skills/afk/SKILL.md, "How to exit: the return") keys on that line, so main may handle the wake as ordinary away supervision, and the daemon has already marked the note surfaced. Fix: put the hand-back message first in the delivered digest, for example by prepending it to the buffer rather than appending, or delivering it ahead of the batch, so the bound can never cut it.
  • ℹ️ bin/fm-supervise-daemon.sh:1925 - hand_back_captain_inbox re-sources the whole fm-wake-lib.sh (over 3,000 lines, plus its nested libs and a uname subprocess) on every call. It is called on every housekeeping tick and every durable-wake close while a note is queued. In production fm_super_main has already sourced it with the same STATE, so the re-source only serves sourced test callers. It also resets lib globals such as FM_RECOVERY_MARKER_*, _FM_LOCK_SELF_START* and FM_WATCHER_*. Simpler: rely on the parent's sourcing and bind only FM_WAKE_QUEUE/FM_WAKE_QUEUE_LOCK/STATE locally, or source once in the test harness.

🔧 Fix applied.
✅ Re-checked - no issues remain.

🔧 **Test** - 2 issues found → auto-fixed ✅
  • 🚨 bin/fm-supervise-daemon.sh:1948 - Reproduced twice with real Codex 0.167.0 on private tmux: queue a captain note behind five roughly 2 KB escalations, then clear an occupied composer. The daemon logs successful hand-back, clears the escalation buffer, and stops retrying, but Codex retains the digest as unsubmitted pasted content. The note remains unanswered and away mode remains active. The second reproduction followed successful initialization and a completed short-note return. The shared transport is unchanged, but the new hand-back depends on its false-positive confirmation. Prevent retiring delivery until submission is proven, or deliver the return through a short envelope independent of the large digest.
  • 🚨 live validation verdict: no-go (4 of 6 scenarios were driven live against the product); failed: Publish a note behind more than 8 KB of buffered escalations; clearing the composer completes the away return.
  • Live validation: ❌ no-go - 4 of 6 scenarios driven live against the product
Scenario Result Live Evidence
Publish an inbox note to an away Pi primary; main ends away mode, replies, and acknowledges the note. ✅ pass live pi-live-session.html; pi-live-verified-state.json
Publish a short inbox note to an idle daemon-managed primary; main completes the return and records its reply. ✅ pass live daemon-small-success.txt; daemon-final-verified-state.json
Leave an unsubmitted draft before publishing a note; the daemon preserves the draft and queue while retrying without watcher restart churn. ✅ pass live daemon-rerun-occupied-composer.txt; daemon-rerun-deferred-state.json; daemon-rerun-deferred.log
Publish a note behind more than 8 KB of buffered escalations; clearing the composer completes the away return. ❌ fail live daemon-large-digest-failure.json; daemon-large-digest-repeat-final.txt; daemon-large-digest-repeat-state.json
An inbox note arrives after Pi accepts a branch offer; the branch yields before processing it. ⏸️ untested no The real Pi interface exposes no control to pause precisely between offer acceptance and drain. The focused fixture passed; live reproduction requires an instrumentation hook at that boundary.
Unconfirmed native submissions retry with the same frozen payload while retaining digest and alarm state. ⏸️ untested no No live transport control was available to force a deterministic unconfirmed acknowledgement. Focused fixtures passed; live reproduction requires native acknowledgement fault injection.
  • bash tests/.phase-fm-daemon.test.sh: selected captain-note hand-back, retry-state, frozen-generation, and watcher-parking cases.
  • NODE_OPTIONS=--experimental-strip-types bash tests/.phase-fm-pi-watch-extension.test.sh: selected away-routing matrix, including the quiet-note fixture.
  • NODE_OPTIONS=--experimental-strip-types bash tests/.phase-fm-pi-branch-extension.test.sh: selected late-note and eligible-row scope cases.
  • Real Pi in a marked disposable lab on private tmux at 120×40; entered away mode, published through bin/fm-inbox.sh note --json, verified reply and acknowledged queue, and exported native session HTML.
  • bin/fm-branch-dispatch.mjs offer --afk against a real published inbox note.
  • Real Codex with inherited shell environment and lab write access; ran bin/fm-session-start.sh, started the actual away daemon, and verified a completed short-note return.
  • Seeded five pending events through production escalate_add; exercised occupied-composer deferral and reproduced large-digest false delivery twice.
  • Captured terminal transcripts, daemon logs, receipts, and persisted state; removed disposable labs and temporary test drivers; confirmed a clean worktree.

🔧 Fix applied.
✅ Re-checked - no issues remain.

  • Live validation: ✅ go - 6 of 7 scenarios driven live against the product
Scenario Result Live Evidence
Publish a note during daemon-managed away mode; main ends away mode, replies, and acknowledges the note. ✅ pass live r2-fresh-short-current-terminal.txt; r2-fresh-short-current-receipts.json
Publish a note behind a 10 KB backlog and occupied composer; clearing the draft completes return and preserves every buffered event. ✅ pass live r2-large-deferred-state.json; r2-large-final-terminal.txt; r2-live-observations.json
Leave delivery deferred across housekeeping ticks; the daemon retries without repeatedly restarting the watcher. ✅ pass live r2-large-deferred-state.json: three deferred attempts and one watcher close while the draft remained intact.
Publish an inbox note while Pi is away; main archives the away record and publishes the requested reply. ✅ pass live r2-pi-session-with-quiet.html; r2-pi-success-state.json; r2-pi-success-receipts.json
Publish notes with quiet records present; Pi answers and the daemon uses ordinary escalation without ending quiet mode. ✅ pass live r2-pi-quiet-final-state.json; r2-daemon-quiet-final-state.json; r2-live-observations.json
Try note-like prose under an ordinary key, then add a real inbox row; only the durable inbox key forces the mixed wake back to main. ✅ pass live r2-routing-boundaries.txt
A captain note arrives after Pi accepts a branch offer but before it grants rows; ownership returns to main. ⏸️ untested no The real Pi CLI provides no deterministic pause control at the acceptance-to-grant boundary. Development synchronization instrumentation is needed to drive that exact timing live; the SDK fixture exer…
  • bash tests/.live-fm-daemon.test.sh: four captain-note selectors covering guarded delivery, retry state, frozen generations, and watcher parking; temporary wrapper removed.
  • bash tests/.live-fm-pi-watch-extension.test.sh: test_pi_away_record_collapses_eligibility_and_keeps_vetoes_on_main; temporary wrapper removed.
  • bash tests/.live-fm-pi-branch-extension.test.sh: test_captain_note_arriving_after_offer_returns_to_main; temporary wrapper removed.
  • Real Codex and Pi primaries on separate private tmux sockets with 120×40 grids; drove fm-afk-contract.sh, fm-afk-launch.sh, and fm-inbox.sh through away, composer-deferral, repeat-return, and quiet scenarios.
  • node bin/fm-branch-dispatch.mjs offer --afk against queues produced by the real wake library and inbox CLI.
  • Captured terminal transcripts, persisted states, inbox receipts, and Pi /export HTML; checked full backlog preservation and stopped and removed all disposable labs.
  • Corrected initial Codex environment filtering and private-socket sandbox restrictions through invocation-local options; global configuration remained unchanged.
✅ **Document** - passed

✅ No issues found.

🔧 **Lint** - 1 issue found → auto-fixed ✅
  • ⚠️ linter found issues (exit code 1)

🔧 Fix applied.
✅ Re-checked - no issues remain.

✅ **Push** - passed

✅ No issues found.

peterOC26 and others added 8 commits November 9, 2026 15:07
Keep captain inbox notes on main while away, retain their durable rows, and
hand them back through the existing daemon delivery and Pi watcher paths.
Recheck Pi eligibility before granting rows so notes arriving after accept
also return to main. Preserve quiet mode and ordinary away routing.

Validation: daemon and Pi watcher suites, focused branch inbox/archive/row
rechecks, all 34 supervision-host cases, branch-state suite, SDK 1.1.0/1.2.0
typechecks, pinned lint, documentation audience and coverage checks passed.
The canonical Pi branch suite passes the new inbox case, then fails in the
existing synthetic broken-branch fallback fixture. Firstmate reproduced the
identical failure on unchanged main 5d6b207 and directed this task to record
it as a pre-existing baseline failure without fixing that fixture.
@peterOC26
peterOC26 force-pushed the fm/fm-afk-return-daemon-pi-f1 branch from b701bde to fe6d42e Compare November 9, 2026 15:02
@peterOC26
peterOC26 merged commit 8ba86e8 into main Nov 9, 2026
24 checks passed
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