@yemi33/minions 0.1.2024 → 0.1.2025

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dashboard.js +16 -2
  2. package/package.json +1 -1
package/dashboard.js CHANGED
@@ -1782,9 +1782,17 @@ function getStatus() {
1782
1782
  if (fastStale) {
1783
1783
  // Reload config on fast-state miss — picks up external changes (minions init, minions add)
1784
1784
  reloadConfig();
1785
+ // Snapshot mtimes BEFORE the rebuild reads disk. If an engine write lands
1786
+ // mid-rebuild (dispatch.json, work-items.json, pull-requests.json), the
1787
+ // snapshot reflects pre-write state, but capturing _lastMtimes AFTER would
1788
+ // record the post-write mtime — silently masking the change. Subsequent
1789
+ // polls would then see no mtime delta and return 304 with stale data until
1790
+ // FAST_STATE_TTL expires. Capturing pre-build at worst forces one extra
1791
+ // (no-op) rebuild on the next poll; capturing post-build loses the update.
1792
+ const preBuildMtimes = _getMtimes();
1785
1793
  _fastState = _buildStatusFastState();
1786
1794
  _fastStateTs = now;
1787
- _lastMtimes = _getMtimes();
1795
+ _lastMtimes = preBuildMtimes;
1788
1796
  }
1789
1797
 
1790
1798
  // Rebuild slow state (rarely-changing data: ~8-15 reads, 60s TTL)
@@ -1836,8 +1844,14 @@ function refreshStatusAsync() {
1836
1844
  if (!fastStale && !slowStale && _statusCache) return _statusCache;
1837
1845
 
1838
1846
  let fast = _fastState;
1847
+ // Pre-build mtime snapshot (see getStatus() for the rationale). The async
1848
+ // path has an even wider race window than the sync path because of the
1849
+ // `await _yieldEventLoop()` below — any write that lands between disk
1850
+ // reads and the post-build `_getMtimes()` capture would be lost.
1851
+ let preBuildMtimes = null;
1839
1852
  if (fastStale) {
1840
1853
  reloadConfig();
1854
+ preBuildMtimes = _getMtimes();
1841
1855
  fast = _buildStatusFastState();
1842
1856
  }
1843
1857
 
@@ -1868,7 +1882,7 @@ function refreshStatusAsync() {
1868
1882
  if (fastStale) {
1869
1883
  _fastState = fast;
1870
1884
  _fastStateTs = now;
1871
- _lastMtimes = _getMtimes();
1885
+ _lastMtimes = preBuildMtimes;
1872
1886
  }
1873
1887
  if (slowStale) {
1874
1888
  _slowState = slow;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yemi33/minions",
3
- "version": "0.1.2024",
3
+ "version": "0.1.2025",
4
4
  "description": "Multi-agent AI dev team that runs from ~/.minions/ — five autonomous agents share a single engine, dashboard, and knowledge base",
5
5
  "bin": {
6
6
  "minions": "bin/minions.js"