Compare commits

..

2 Commits

Author SHA1 Message Date
09ee1d9006 fix: fall back from invalid presence timezone
All checks were successful
Codex Template Compliance / template-compliance (pull_request) Successful in 6s
Build / test-and-image (pull_request) Successful in 45s
2026-07-05 23:01:37 +02:00
20243d159f Merge pull request 'docs: record dynamic DAVE presence release' (#72) from codex/handoff-dave-presence into codex/production-intelligence-terminal
All checks were successful
Release Dry Run / release-dry-run (push) Successful in 19s
Codex Template Compliance / template-compliance (push) Successful in 7s
Build / test-and-image (push) Successful in 32s
2026-07-05 20:59:42 +00:00
2 changed files with 14 additions and 2 deletions

View File

@@ -78,8 +78,12 @@ export class DavePresence {
const profile = this.profileStore?.getAgentProfile(); const profile = this.profileStore?.getAgentProfile();
if (!profile) return this._result(false, 'profile_missing'); if (!profile) return this._result(false, 'profile_missing');
const timezone = profile.timezone || this.fallbackTimezone; let timezone = profile.timezone || this.fallbackTimezone;
const clock = localClock(now, timezone); let clock = localClock(now, timezone);
if (!clock && timezone !== this.fallbackTimezone) {
timezone = this.fallbackTimezone;
clock = localClock(now, timezone);
}
if (!clock) return this._result(false, 'invalid_timezone'); if (!clock) return this._result(false, 'invalid_timezone');
this._rollDay(clock.day); this._rollDay(clock.day);
if (this.state.sentCount >= this.maxPerDay) return this._result(false, 'daily_limit'); if (this.state.sentCount >= this.maxPerDay) return this._result(false, 'daily_limit');

View File

@@ -89,3 +89,11 @@ test('local clock uses the profile timezone', () => {
assert.deepEqual(localClock(new Date('2026-07-06T12:30:00Z'), 'Europe/Berlin'), { day: '2026-07-06', time: '14:30' }); assert.deepEqual(localClock(new Date('2026-07-06T12:30:00Z'), 'Europe/Berlin'), { day: '2026-07-06', time: '14:30' });
assert.equal(localClock(new Date(), 'Invalid/Timezone'), null); assert.equal(localClock(new Date(), 'Invalid/Timezone'), null);
}); });
test('invalid profile timezone falls back to configured operational timezone', async () => {
const { presence, messages, calls } = setup({ profile: { timezone: 'not-a-timezone' } });
const outcome = await presence.tick(new Date('2026-07-06T12:00:00Z'));
assert.equal(outcome.reason, 'sent');
assert.equal(messages.length, 1);
assert.match(calls[0].prompt, /timezone: UTC/);
});