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

address review: restore scheduledTime alignment for interval-mode jobs, fix a11y with single focused row button and visual-only toggle

Adam Eivy11a663279ee4
diff --git a/client/src/components/ToggleSwitch.jsx b/client/src/components/ToggleSwitch.jsx
index 9e9f250733..ba15040f7a 100644
--- a/client/src/components/ToggleSwitch.jsx
+++ b/client/src/components/ToggleSwitch.jsx
@@ -13,7 +13,7 @@ const SIZES = {
}
};
-export default function ToggleSwitch({ enabled, onChange, disabled, ariaLabel, size = 'md', activeColor = 'bg-port-accent', className = '' }) {
+export default function ToggleSwitch({ enabled, onChange, disabled, ariaLabel, size = 'md', activeColor = 'bg-port-accent', className = '', tabIndex }) {
const s = SIZES[size] || SIZES.md;
return (
<button
@@ -22,6 +22,7 @@ export default function ToggleSwitch({ enabled, onChange, disabled, ariaLabel, s
aria-checked={enabled}
onClick={onChange}
disabled={disabled}
+ tabIndex={tabIndex}
className={`relative inline-flex ${s.track} items-center rounded-full transition-colors shrink-0 ${
enabled ? activeColor : 'bg-gray-600'
} ${disabled ? 'opacity-50' : ''} ${className}`}
diff --git a/client/src/components/cos/tabs/ScheduleTab.jsx b/client/src/components/cos/tabs/ScheduleTab.jsx
index f5ca5c7fdc..fe15b7cc68 100644
--- a/client/src/components/cos/tabs/ScheduleTab.jsx
+++ b/client/src/components/cos/tabs/ScheduleTab.jsx
@@ -461,8 +461,14 @@ function GlobalConfigControls({ taskType, config, onUpdate, onTrigger, onReset,
return (
<div
key={field}
- className="flex items-center justify-between gap-3 min-h-[44px] cursor-pointer rounded px-2 -mx-2 hover:bg-port-card/30 active:bg-port-card/50"
+ role="button"
+ tabIndex={updating ? -1 : 0}
+ aria-disabled={updating}
+ aria-pressed={enabled}
+ aria-label={`${enabled ? 'Disable' : 'Enable'} ${label.toLowerCase()}`}
+ className={`flex items-center justify-between gap-3 min-h-[44px] rounded px-2 -mx-2 ${updating ? 'opacity-60 cursor-not-allowed' : 'cursor-pointer hover:bg-port-card/30 active:bg-port-card/50'}`}
onClick={handleToggle}
+ onKeyDown={(e) => { if (!updating && (e.key === 'Enter' || e.key === ' ')) { e.preventDefault(); handleToggle(); } }}
>
<div className="min-w-0 flex-1">
<span className="text-sm text-white">{label}</span>
@@ -470,9 +476,10 @@ function GlobalConfigControls({ taskType, config, onUpdate, onTrigger, onReset,
</div>
<ToggleSwitch
enabled={enabled}
- onChange={(e) => { e.stopPropagation(); handleToggle(); }}
+ onChange={(e) => e.stopPropagation()}
disabled={updating}
- ariaLabel={`${enabled ? 'Disable' : 'Enable'} ${label.toLowerCase()}`}
+ tabIndex={-1}
+ ariaLabel={undefined}
/>
</div>
);
diff --git a/server/services/cos.js b/server/services/cos.js
index ae25e7a674..162c6d5e36 100644
--- a/server/services/cos.js
+++ b/server/services/cos.js
@@ -2656,10 +2656,21 @@ function computeNextJobFireTime(job, timezone) {
return next.getTime();
}
- // Pure interval fallback (no scheduledTime, no cronExpression)
+ // Interval fallback: lastRun + intervalMs, then align to scheduledTime if set
const lastRun = job.lastRun ? new Date(job.lastRun).getTime() : 0;
let nextDue = lastRun + job.intervalMs;
+ // Restore scheduledTime alignment for interval-mode jobs (e.g. weekly at 00:00).
+ // nextLocalTime advances nextDue to the next occurrence of HH:MM in the user's timezone,
+ // preventing drift when a run occurs slightly late.
+ if (job.scheduledTime) {
+ const match = String(job.scheduledTime).match(/^([01]\d|2[0-3]):([0-5]\d)$/);
+ if (match) {
+ const candidate = nextLocalTime(nextDue, Number(match[1]), Number(match[2]), timezone);
+ if (candidate > nextDue) nextDue = candidate;
+ }
+ }
+
if (job.weekdaysOnly) {
const { dayOfWeek } = getLocalParts(new Date(nextDue), timezone);
if (dayOfWeek === 0) nextDue += 24 * 60 * 60 * 1000; // Sunday → Monday