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 (codex r4): don't treat 'by <time>' as a passive agent

[._.]/ Adam Eivy6697b45db8e3
diff --git a/server/lib/editorial/proseTics.js b/server/lib/editorial/proseTics.js
index 0bb7420631..4c29dd13a9 100644
--- a/server/lib/editorial/proseTics.js
+++ b/server/lib/editorial/proseTics.js
@@ -319,6 +319,15 @@ const MOOD_PARTICIPLES = new Set([
'soaked', 'coated', 'covered', 'wrapped', 'softened', 'muffled', 'hushed',
]);
+// Temporal/deictic nouns that follow "by" as a time phrase, not an agent ("she
+// was exhausted BY MORNING"). When one of these follows "by", the construction
+// is not an agentive passive, so it does not override stative/mood suppression.
+const NON_AGENT_BY = new Set([
+ 'morning', 'noon', 'midday', 'afternoon', 'evening', 'night', 'nightfall',
+ 'midnight', 'dawn', 'dusk', 'sunrise', 'sunset', 'sundown', 'twilight',
+ 'daybreak', 'then', 'now', 'today', 'tonight', 'tomorrow', 'yesterday',
+]);
+
// How far past the participle to look for a "by <agent>" phrase, allowing an
// intervening adverb ("decorated elaborately by Mira").
const PASSIVE_LOOKAHEAD = 3;
@@ -379,9 +388,11 @@ export function findPassiveVoice(text) {
}
// An explicit "by <agent>" (with an optional intervening adverb) is the
// unambiguous agentive passive — it wins over stative/mood classification.
- // The agent token must be inside the same-sentence window.
+ // The agent token must be inside the same-sentence window and must not be a
+ // time phrase ("by morning"), which is not an agent.
const byPos = after.findIndex((t) => t.lower === 'by');
- const byAgent = byPos !== -1 && after.length > byPos + 1;
+ const agentTok = byPos !== -1 ? after[byPos + 1] : undefined;
+ const byAgent = !!agentTok && !NON_AGENT_BY.has(agentTok.lower);
let classification = 'weak';
if (!byAgent) {
// A mood image needs BOTH a setting subject AND an atmospheric rendering
diff --git a/server/lib/editorial/proseTics.test.js b/server/lib/editorial/proseTics.test.js
index 8b5d1300ed..196795083f 100644
--- a/server/lib/editorial/proseTics.test.js
+++ b/server/lib/editorial/proseTics.test.js
@@ -188,6 +188,12 @@ describe('findPassiveVoice', () => {
expect(findPassiveVoice('The city was attacked in winter.')[0].classification).toBe('weak');
});
+ it('does not treat a "by <time>" phrase as an agent', () => {
+ const [hit] = findPassiveVoice('She was exhausted by morning.');
+ expect(hit.byAgent).toBe(false);
+ expect(hit.classification).toBe('stative');
+ });
+
it('does not read a "by" from the next sentence as the agent', () => {
// "By morning" starts a new sentence — it must not flip the stative
// "was exhausted" into a weak by-agent passive.