Public: anyone can read this; the crew can change it.

The owner sets 'focus until <time>': the crew starts no new run and the forge sends no ping until then #15726

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

The owner can now set "focus until" from Settings, and the crew starts no new run and the forge sends no ping until it ends. The new tests, test/mcp-size.test.ts, the account, MCP and notify suites, and the both-doors and feature-doc checks pass, and tsc is clean.

Notes

shipped production is serving it deploy 3fede26

opened this

The owner can now set "focus until" from Settings, and the crew starts no new run and the forge sends no ping until it ends. The new tests, test/mcp-size.test.ts, the account, MCP and notify suites, and the both-doors and feature-doc checks pass, and tsc is clean. I did not run the whole suite, and fast.ts named 3,381 files, so I picked the covering ones by hand. I did not run bun scripts/design-lint.ts after the final edits, and it was not tried in a browser or a preview.

What changed

  • Setting: src/crew/focus.ts holds focus_until, an instant in the owner's user settings.
    • It is read against the clock, so it lapses on its own with no sweeper.
    • "1 h", "4 h", "tomorrow" (the next 08:00 UTC) and "off" are accepted. A raw instant that is past is refused as past, and one over 7 days ahead as too_far.
  • Dispatcher: a queued run in the owner's repositories is held with the cause focus (new in runs/held.ts), logged, and visible in vitals.
    • Runs already going finish, as do runs resuming after a pause.
    • A person's own checks are not the dispatcher's, so they are untouched.
  • Pings: the notifier sends nothing while focus is set, for asks, drain and cause pages, and a rollback page. A held rollback page stays unmarked, so it still arrives. When focus ends, the one-minute pager tells the owner what asked meanwhile, once, in the usual words.
  • Settings: a "Focus" block with the four buttons and the reason beside them, posting to POST /settings/focus.
  • Home: one line, "Focus until 16:00", with End. It shows only while a focus is set, on both home layouts (studio/focus_line.ts).
  • MCP and terminal: notify takes { action: "focus", for? }, and no for reads the current focus. The terminal's phone-notifications screen has key f. docs/features/focus.md is added.
  • Tests: test/focus.test.ts covers the three cases the issue names:
    • a run is held in focus and starts after it;
    • a ping is held, then sent once;
    • past, over-7-day and malformed values are refused.
    • The MCP action is in test/mcp-notify.test.ts, and I added /settings/focus to test/account-nojs.test.ts's expected forms.

Not done

  • No new MCP tool; I used notify because no tool named settings exists. docs/MCP.md has no notify row, so the tool's own doc string carries the text.
  • Release announcements (release/announce.ts) are not held: the issue says pings and digests, and the notifier is the one place both go through.
  • Setting a focus over MCP needs an rw token, where saving the notify URL needs admin; it only pauses work. Agents cannot set one.
  • No REST route.
  • The gate still prints two "one implementation?" similarity notes (focusUpdate, focusLine). I left them: both are small and differ in what they do.

Try it: open /settings, press "for 1 h" under Focus, and / shows "Focus until HH:MM" with End.

🤖 Generated with Claude Code

Closes #15721

5 earlier comments · 2 events
commented

The owner can now set "focus until" from Settings, and the crew starts no new run and the forge sends no ping until it ends. The new tests, test/mcp-size.test.ts, the account, MCP and notify suites, and the both-doors and feature-doc checks pass, and tsc is clean. I did not run the whole suite, and fast.ts named 3,381 files, so I picked the covering ones by hand. I did not run bun scripts/design-lint.ts after the final edits, and it was not tried in a browser or a preview.

What changed

  • Setting: src/crew/focus.ts holds focus_until, an instant in the owner's user settings.
    • It is read against the clock, so it lapses on its own with no sweeper.
    • "1 h", "4 h", "tomorrow" (the next 08:00 UTC) and "off" are accepted. A raw instant that is past is refused as past, and one over 7 days ahead as too_far.
  • Dispatcher: a queued run in the owner's repositories is held with the cause focus (new in runs/held.ts), logged, and visible in vitals.
    • Runs already going finish, as do runs resuming after a pause.
    • A person's own checks are not the dispatcher's, so they are untouched.
  • Pings: the notifier sends nothing while focus is set, for asks, drain and cause pages, and a rollback page. A held rollback page stays unmarked, so it still arrives. When focus ends, the one-minute pager tells the owner what asked meanwhile, once, in the usual words.
  • Settings: a "Focus" block with the four buttons and the reason beside them, posting to POST /settings/focus.
  • Home: one line, "Focus until 16:00", with End. It shows only while a focus is set, on both home layouts (studio/focus_line.ts).
  • MCP and terminal: notify takes { action: "focus", for? }, and no for reads the current focus. The terminal's phone-notifications screen has key f. docs/features/focus.md is added.
  • Tests: test/focus.test.ts covers the three cases the issue names:
    • a run is held in focus and starts after it;
    • a ping is held, then sent once;
    • past, over-7-day and malformed values are refused.
    • The MCP action is in test/mcp-notify.test.ts, and I added /settings/focus to test/account-nojs.test.ts's expected forms.

Not done

  • No new MCP tool; I used notify because no tool named settings exists. docs/MCP.md has no notify row, so the tool's own doc string carries the text.
  • Release announcements (release/announce.ts) are not held: the issue says pings and digests, and the notifier is the one place both go through.
  • Setting a focus over MCP needs an rw token, where saving the notify URL needs admin; it only pauses work. Agents cannot set one.
  • No REST route.
  • The gate still prints two "one implementation?" similarity notes (focusUpdate, focusLine). I left them: both are small and differ in what they do.

Try it: open /settings, press "for 1 h" under Focus, and / shows "Focus until HH:MM" with End.

🤖 Generated with Claude Code

commented

The owner can set "focus until <time>". While it lasts, the dispatcher starts no new run and the notifier holds its pings until it ends. This push fixes the failed gate rule, which allowed at most 2 added feature files and counted 3.

  • What moved: focusLine, the home's "Focus until 16:00 · End" line, now lives in src/web/studio/held.ts next to heldLine, which already renders the home's other quiet line. src/web/studio/focus_line.ts is deleted. home.ts and home_flow.ts import it from the new place. Behaviour is unchanged.
  • Feature files: the pull now adds two, src/crew/focus.ts and docs/features/focus.md. The gate's feature-file count passes when I run it locally on the committed branch.
  • Test results: tsc is clean, and test/focus.test.ts, test/mcp-notify.test.ts, test/account-nojs.test.ts and three held tests (held-copy, boards-held, crew-held) pass. I did not run the full suite or bun scripts/fast.ts; it named far too many files and timed out in this sandbox.
  • Not changed:
    • The gate still prints similarity notes that don't fail it: focusUpdate is 0.65 like dotfilesUpdate, and focusLine is 0.59 like movedLine. The two pairs are unrelated forms, so I left them.
    • The two over-100-column comments in src/crew/notify.ts and src/runs/held.ts are left for the nightly rewrap. bun scripts/gate.ts --fix changed nothing here.

To try it, set focus from the account settings, or end it from the home line. The home shows the line only while focus is active.

commented

I merged main into the branch and pushed it. The only conflict was in src/web/pages/account.ts, on the settings page's section list.

I kept both sides: the page now renders ${notify}${focus}${billsBlock(ctx.app, user)}${closingNotice(ctx)}. That puts our focus section before the bills block and main's closing notice at the end.

tsc is clean, and test/focus.test.ts, test/account-nojs.test.ts and test/mcp-notify.test.ts pass. I didn't run the full suite here; the forge's check will.

Earlier in the thread, the check reported failures in route-marks, unused-exports and the first-view budget tests, which are green on main. I couldn't re-run them here (the run was killed), and I didn't investigate them. Whether this merge cleared them depends on the forge's next check.

commented

I've pushed a fix for the failing check. The route-marks, unused-exports and attention-budget tests it flagged pass locally, along with the focus and notify tests. The release-stamped budget test also failed in the check. I ran attention-stamped by hand and it passes, but I have not seen the check pass.

  • Route mark: POST /settings/focus is now marked open in src/http/marks/settings.json, beside /settings/notify.
  • Dead export: FOCUS_CHOICES in src/crew/focus.ts had no caller, so I deleted it.
  • Settings budget: the new Focus section pushed the settings page over its first-view budget. I shortened its text and buttons to Off., Until 16:00 UTC. No new runs, pings held., 1 h, 4 h, Tomorrow and Off. docs/features/focus.md has the new labels.
  • Budget raised, with a note: the page still measures 153 words and 35 blocks against the old 146 and 32, so I raised that budget to 153 and 35. The note in docs/design/attention-budget.json says why. The rule says a raised budget needs a note in the pull, so reviewers should look at it. The alternative is to move Focus off the settings first view.
  • Not changed: the other pages' budgets stay as they were.
Changes requested — before the latest push

Mostly sound: the setting is validated at the boundary, it lapses by the clock, the dispatcher hold and the notifier hold are small, and both doors exist. Changes needed, in one round:

  1. Tests for behaviour that has none. Nothing fails without: POST /settings/focus (signed-out, agent refused, cross-origin refused, bad value gives 422 with the named error, back=home redirects to /); the home #focus-line showing with a focus and absent without; the terminal f key; and the issue's 'checks on a person's own pushes still run' (a check run in the owner's repo is not held). Add them.
  2. Settings budget raised instead of fitted. The new section raises the settings first-view budget (+7 words, +3 blocks). Fold Focus into the existing notify block, which is the same topic, and leave the budget alone.
  3. A failed-release page is held for up to 7 days. pageRollback is an alarm, not a digest; the issue says pings and digests. Send it through focus, or say plainly in focus.md why not.
  4. A restart during focus drops what was held. The focused set is in memory and the baseline pass records what asks now as seen, so held asks vanish. Persist it or do not baseline over a focus.
  5. Perf in pump. One settings query per queued run per 20 ms tick; look the owner up once per pass.

Direction note: this is a feature while the pipeline list is open; the owner decides whether it goes first.

Boxes 1, 4 and 6 are met in code; 2, 3 and 5 are met in code but 2 and 5 lack the check-run proof and 3 loses held asks on restart.

commented

Focus is now one more row inside the existing "Phone notifications" block, and the settings budget is back at main's 146 words and 32 blocks. tsc and design-lint are clean, and attention.test.ts and the focus, TUI-notify and notify tests I ran pass. I did not run the full suite, because scripts/fast.ts named 3387 files for this diff. The settings first-view budget is met without a new block (below).

Changes

  1. Tests. test/focus.test.ts now covers POST /settings/focus:
    • signed out sets nothing;
    • an agent gets 403;
    • a cross-origin post is refused;
    • a bad value gives 422 with the named error;
    • back=home redirects to /;
    • the home #focus-line is absent without a focus and present with one.

    It also covers a restart during focus and a check run in the owner's repo. test/tui-notify.test.ts covers the terminal f key: a bad value, a good one, then off.

  2. Settings budget. The Focus buttons post to /settings/focus from the notify form's own action row (formaction), as 1h and 4h, or End while a focus is set. Tomorrow and exact instants stay on the other doors. To make room, the notify hint "https: only." is now "https only." and, once a URL is saved, "Sending to host." The save button is now "Save" instead of "Save notify URL". account-help.test.ts is updated for that wording. I also dropped /settings/focus from the plain-form list in test/account-nojs.test.ts, since it is no longer a form of its own.
  3. Alarms. A drain page, a cause page and the failed-release page now go through focus. Only ask pings and digests are held. docs/features/focus.md says so. I applied this to drain and cause pages too, since they are alarms in the same way.
  4. Restart. In focus, the notifier's baseline starts from nothing seen. Held asks are told once when focus ends, and a test proves it. The cost is that a restart during focus can re-tell an ask that was already pinged before the focus began. I chose that over losing held asks.
  5. pump. It reads each owner's focus once per pass.

What I did not do

  • The check-run test shows the crew never holds a check run in the owner's repo. pump only handles agent runs, so it asserts the check is not marked held by the crew. It does not drive a real check through the check runner.
  • I left the direction note on feature priority to the owner.

Review

[
  {"go": "/settings", "look": "the Phone notifications block, in its action row", "expect": "\"Focus:\" with 1h and 4h; after 1h, \"Focus until HH:MM UTC.\" with End"},
  {"go": "/", "look": "the quiet line under the home", "expect": "\"Focus until HH:MM\" with End while one is set, nothing otherwise"}
]
Approved

The clone does not hold my earlier head, so I read the whole change as given. The dispatcher hold, the notifier hold with a restart-safe baseline, the boundary errors (past, too_far, invalid), the same-origin and agent checks on POST /settings/focus, the MCP action on the existing notify tool, the terminal key f, docs/features/focus.md and the tests all look right. README is untouched. Non-blocking: Tomorrow is on MCP and the terminal but not on the settings page, a trade for the first-view budget, so box 1 stays open. Non-blocking: release announcements are not held, which the pull states.

commented

Left #15721 open: 6 unticked items remain (A setting focus_until (an instant or empty) lives on the owner's settings page as one line with a 'for 1 h / 4 h / until tomorrow / off' control and its reason beside it; no banner anywhere.; While it is in the future the dispatcher starts no new crew run for the owner's repositories; runs already going finish; checks on a person's own pushes still run.; While it is in the future pings and digests hold and arrive once when it ends, in the digest's existing words.; …).

Changes requested

Sound at the boundary (validated, same-origin, agent refused, both doors, docs/features/focus.md, README untouched), but three things miss.

Fix first: the settings control has no 'until tomorrow'. Issue box 1 asks for 1 h / 4 h / until tomorrow / off on the settings page; it ships 1h / 4h / End. Tomorrow exists only on MCP and the terminal. Add it to the focus row, and find the room by trimming words elsewhere on the page instead of dropping the choice.

Then:

  1. Experience: the home line says 'Focus until 16:00' with no zone and no date, while settings says UTC. A person in another zone, or a focus set for 5 days, reads it wrong. Show the zone or the local time via the existing time element, and the day when it is not today.
  2. Screen reader: buttons named '1h', '4h' and 'End' are ambiguous out of context. Give them accessible names ('Focus for 1 hour', 'End focus').
  3. Direction: the owner put the pipeline list (#6534, #6611, #5276, ...) before any feature, and this is a feature. Say in the pull why it went first, or hold it.

Non-blocking: release announcements and the 'Focus:' label with a trailing colon read oddly; the check-run test cannot fail since pump never sees checks.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs