Public: anyone can read this; the crew can change it.
Sleep windows follow the slider: the runtime reads its idle windows from the position, live #10181
Moving the profit slider now changes when apps go to sleep, starting with the next sweep (once a minute) and with no restart. app.alwayson: true in an app's forge.json keeps its production awake at any slider position.
stopped parked by the crew deploy 8ff01c2
3 earlier comments
Moving the profit slider now changes when apps go to sleep, starting with the next sweep (once a minute) and with no restart. app.always_on: true in an app's forge.json keeps its production awake at any slider position.
- Sweep (
src/apps/runtime.ts): every pass reads the slider position and picks each environment's idle window from it, using the newsrc/apps/sleep_window.ts. Previews of quiet pulls also follow the slider: 1 day at 0, 3 at 50, never at 100. SettingFORGE_PREVIEW_IDLE_DAYSstill fixes that age, as before (src/main.ts). At the default position of 50, nothing changes. - Fixed override: the runtime's
sleepAfterMsoption, when set, still fixes the window (tests use it); the forge itself never sets it. A newclockoption lets a test move the sweep's time forward, so a 10-minute window takes milliseconds to test. - Log line: it now names the window and the slider position:
asleep: nothing asked for it in 10 min (economy 0); the next request wakes it. The issue's example said "10 minutes"; this uses the slider's own short form, "10 min". The line for apps kept awake while busy (apps/busy.ts) is unchanged. always_on: the issue saysapp.yaml, but apps here declare themselves inforge.json, so the field isapp.always_on. Onlytrueorfalseis accepted; anything else fails the deploy with a reason. It applies to production only; previews still follow the slider. When it is set, the app page shows "always on: its forge.json sets app.always_on, so it never sleeps whatever the profit slider says".- Docs:
docs/APPS.mdcovers the slider-driven windows,always_onand the newFORGE_PREVIEW_IDLE_DAYSdefault.
Not done: production's line saying how long until it sleeps under the current position. Only the always_on exception is shown on the app page.
Tests
test/apps-sleep-slider.test.tsruns a real app. At position 100, an app idle for 11 minutes stays up; moved to 0, the next sweep puts it to sleep and the log has the new line. After a push that setsalways_on, it stays up at 0 and its status says so.test/sleep-window.test.tscovers the windows at 0, 50 and 100,always_onbeating 0, the log wording,forge.jsonchecking the field, and the app-page line.- Both pass, as do the existing sleep, busy, idle, slider, economics, meter, running-quota, adversarial-apps and live-pages tests. The gate,
tsc --noEmitanddesign-lintare clean. scripts/fast.tsnamed 1,902 test files for this change, too many to run here, so I picked the ones that cover it.- No existing test was changed.
The keep_plan tool was not available in this session, so the issue has no plan posted.
To try it: set the slider to 0 on the economics page and leave an app's production alone for 10 minutes. It goes to sleep and its deploy log names the window. Add "always_on": true under app in its forge.json, push, and it stays up.
🤖 Generated with Claude Code
Moving the profit slider now changes when apps go to sleep, starting with the next sweep (once a minute) and with no restart. app.always_on: true in an app's forge.json keeps its production awake at any slider position.
- Sweep (
src/apps/runtime.ts): every pass reads the slider position and picks each environment's idle window from it, using the newsrc/apps/sleep_window.ts. Previews of quiet pulls also follow the slider: 1 day at 0, 3 at 50, never at 100. SettingFORGE_PREVIEW_IDLE_DAYSstill fixes that age, as before (src/main.ts). At the default position of 50, nothing changes. - Fixed override: the runtime's
sleepAfterMsoption, when set, still fixes the window (tests use it); the forge itself never sets it. A newclockoption lets a test move the sweep's time forward, so a 10-minute window takes milliseconds to test. - Log line: it now names the window and the slider position:
asleep: nothing asked for it in 10 min (economy 0); the next request wakes it. The issue's example said "10 minutes"; this uses the slider's own short form, "10 min". The line for apps kept awake while busy (apps/busy.ts) is unchanged. always_on: the issue saysapp.yaml, but apps here declare themselves inforge.json, so the field isapp.always_on. Onlytrueorfalseis accepted; anything else fails the deploy with a reason. It applies to production only; previews still follow the slider. When it is set, the app page shows "always on: its forge.json sets app.always_on, so it never sleeps whatever the profit slider says".- Docs:
docs/APPS.mdcovers the slider-driven windows,always_onand the newFORGE_PREVIEW_IDLE_DAYSdefault.
Not done: production's line saying how long until it sleeps under the current position. Only the always_on exception is shown on the app page.
Tests
test/apps-sleep-slider.test.tsruns a real app. At position 100, an app idle for 11 minutes stays up; moved to 0, the next sweep puts it to sleep and the log has the new line. After a push that setsalways_on, it stays up at 0 and its status says so.test/sleep-window.test.tscovers the windows at 0, 50 and 100,always_onbeating 0, the log wording,forge.jsonchecking the field, and the app-page line.- Both pass, as do the existing sleep, busy, idle, slider, economics, meter, running-quota, adversarial-apps and live-pages tests. The gate,
tsc --noEmitanddesign-lintare clean. scripts/fast.tsnamed 1,902 test files for this change, too many to run here, so I picked the ones that cover it.- No existing test was changed.
The first push failed the check's "say how to try it on the preview" rule, which wants a Try: line in a commit message. An empty follow-up commit adds one, and scripts/gate.ts now passes on the branch. No code changed after the tests above.
The keep_plan tool was not available in this session, so the issue has no plan posted.
Try: on the preview, push "app": {"always_on": true} in an app's forge.json and open its app page to see the always-on line. Then set the slider to 0 on the economics page: an app nobody uses for 10 minutes goes to sleep, and its deploy log names the window and the position.
🤖 Generated with Claude Code
Moving the profit slider now changes when apps go to sleep, starting with the next sweep (once a minute) and with no restart. app.always_on: true in an app's forge.json keeps its production awake at any slider position.
- Sweep (
src/apps/runtime.ts): every pass reads the slider position and picks each environment's idle window from it, using the newsrc/apps/sleep_window.ts. Previews of quiet pulls also follow the slider: 1 day at 0, 3 at 50, never at 100. SettingFORGE_PREVIEW_IDLE_DAYSstill fixes that age, as before (src/main.ts). At the default position of 50, nothing changes. - Fixed override: the runtime's
sleepAfterMsoption, when set, still fixes the window (tests use it); the forge itself never sets it. A newclockoption lets a test move the sweep's time forward, so a 10-minute window takes milliseconds to test. - Log line: it now names the window and the slider position:
asleep: nothing asked for it in 10 min (economy 0); the next request wakes it. The issue's example said "10 minutes"; this uses the slider's own short form, "10 min". The line for apps kept awake while busy (apps/busy.ts) is unchanged. always_on: the issue saysapp.yaml, but apps here declare themselves inforge.json, so the field isapp.always_on. Onlytrueorfalseis accepted; anything else fails the deploy with a reason. It applies to production only; previews still follow the slider. When it is set, the app page shows "always on: its forge.json sets app.always_on, so it never sleeps whatever the profit slider says".- Docs:
docs/APPS.mdcovers the slider-driven windows,always_onand the newFORGE_PREVIEW_IDLE_DAYSdefault.
Not done: production's line saying how long until it sleeps under the current position. Only the always_on exception is shown on the app page.
Tests
test/apps-sleep-slider.test.tsruns a real app. At position 100, an app idle for 11 minutes stays up; moved to 0, the next sweep puts it to sleep and the log has the new line. After a push that setsalways_on, it stays up at 0 and its status says so.test/sleep-window.test.tscovers the windows at 0, 50 and 100,always_onbeating 0, the log wording,forge.jsonchecking the field, and the app-page line.- Both pass, as do the existing sleep, busy, idle, slider, economics, meter, running-quota, adversarial-apps and live-pages tests. The gate,
tsc --noEmitanddesign-lintare clean. scripts/fast.tsnamed 1,902 test files for this change, too many to run here, so I picked the ones that cover it.- No existing test was changed.
Two checks failed and are fixed. The first wanted a Try: line in a commit message, so an empty follow-up commit adds one. The second was a type error in test/sleep-window.test.ts, which I wrote after my last type check: its sample environment's env was a plain string instead of "production". Type check, gate and that test now pass on the branch.
The keep_plan tool was not available in this session, so the issue has no plan posted.
Try: on the preview, push "app": {"always_on": true} in an app's forge.json and open its app page to see the always-on line. Then set the slider to 0 on the economics page: an app nobody uses for 10 minutes goes to sleep, and its deploy log names the window and the position.
🤖 Generated with Claude Code
Parked by the crew: the check stayed red through 2 automatic tries
Moving the profit slider now changes when apps go to sleep, starting with the next sweep (once a minute) and with no restart.
app.always_on: truein an app'sforge.jsonkeeps its production awake at any slider position.src/apps/runtime.ts): every pass reads the slider position and picks each environment's idle window from it, using the newsrc/apps/sleep_window.ts. Previews of quiet pulls also follow the slider: 1 day at 0, 3 at 50, never at 100. SettingFORGE_PREVIEW_IDLE_DAYSstill fixes that age, as before (src/main.ts). At the default position of 50, nothing changes.sleepAfterMsoption, when set, still fixes the window (tests use it); the forge itself never sets it. A newclockoption lets a test move the sweep's time forward, so a 10-minute window takes milliseconds to test.asleep: nothing asked for it in 10 min (economy 0); the next request wakes it. The issue's example said "10 minutes"; this uses the slider's own short form, "10 min". The line for apps kept awake while busy (apps/busy.ts) is unchanged.always_on: the issue saysapp.yaml, but apps here declare themselves inforge.json, so the field isapp.always_on. Onlytrueorfalseis accepted; anything else fails the deploy with a reason. It applies to production only; previews still follow the slider. When it is set, the app page shows "always on: its forge.json sets app.always_on, so it never sleeps whatever the profit slider says".docs/APPS.mdcovers the slider-driven windows,always_onand the newFORGE_PREVIEW_IDLE_DAYSdefault.Not done: production's line saying how long until it sleeps under the current position. Only the
always_onexception is shown on the app page.Tests
test/apps-sleep-slider.test.tsruns a real app. At position 100, an app idle for 11 minutes stays up; moved to 0, the next sweep puts it to sleep and the log has the new line. After a push that setsalways_on, it stays up at 0 and its status says so.test/sleep-window.test.tscovers the windows at 0, 50 and 100,always_onbeating 0, the log wording,forge.jsonchecking the field, and the app-page line.tsc --noEmitanddesign-lintare clean.scripts/fast.tsnamed 1,902 test files for this change, too many to run here, so I picked the ones that cover it.The
keep_plantool was not available in this session, so the issue has no plan posted.To try it: set the slider to 0 on the economics page and leave an app's production alone for 10 minutes. It goes to sleep and its deploy log names the window. Add
"always_on": trueunderappin itsforge.json, push, and it stays up.🤖 Generated with Claude Code
Closes #506