← back to Ken
Ken: config-cache coherence — autoTrader refreshes enabled gate from DB each cycle (no more silent re-arm) [yoloforever c1, TK-10166]
9507bcf280b65e743a7521591047655c1bbb854c · 2026-08-03 09:33:32 -0700 · Steve Abrams
Files touched
Diff
commit 9507bcf280b65e743a7521591047655c1bbb854c
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Mon Aug 3 09:33:32 2026 -0700
Ken: config-cache coherence — autoTrader refreshes enabled gate from DB each cycle (no more silent re-arm) [yoloforever c1, TK-10166]
---
kalshi-dash/server.js | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/kalshi-dash/server.js b/kalshi-dash/server.js
index e092fed..b81deb2 100644
--- a/kalshi-dash/server.js
+++ b/kalshi-dash/server.js
@@ -7532,6 +7532,17 @@ async function getWinnerConsensusSignals() {
}
async function autoTrader(signals) {
+ // Config-cache coherence (TK-10166): the DB is the source of truth for the enabled gate.
+ // Refresh in-memory TRADE_CONFIG.enabled from ken_config each cycle so an out-of-band DB
+ // disarm (ken-gambling-canary, a manual psql edit, the arm/disarm scripts) takes effect
+ // immediately WITHOUT a restart, and can't be silently re-armed by a later
+ // saveTradeConfig() writing a stale in-memory value. (safe_mode is already read fresh.)
+ try {
+ const tcRow = await kenQ("SELECT value FROM ken_config WHERE key = 'trade_config'");
+ if (tcRow.rows.length && typeof tcRow.rows[0].value?.enabled === 'boolean') {
+ TRADE_CONFIG.enabled = tcRow.rows[0].value.enabled;
+ }
+ } catch {}
if (!TRADE_CONFIG.enabled) return;
try {
← 9de5a64 Ken UI: unmistakable PAPER/LIVE-MONEY badge + 'Paper Balance
·
back to Ken
·
Ken: fix restartIntervals crash — it referenced boot-scoped bf37e33 →