@mobcode/openclaw-plugin 0.1.7 → 0.1.8

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/package.json +1 -1
  2. package/src/state-store.js +11 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mobcode/openclaw-plugin",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "MobCode integration plugin for OpenClaw",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -811,17 +811,23 @@ export class MobcodeStateStore {
811
811
  LIMIT 1`,
812
812
  )
813
813
  .get(normalizedSessionKey);
814
+ const messageCountRow = this._db()
815
+ .prepare(`SELECT COUNT(*) AS count FROM messages WHERE session_key=?`)
816
+ .get(normalizedSessionKey);
817
+ const messageRows = Number(messageCountRow?.count ?? 0);
814
818
  const alreadyBackfilled =
815
819
  typeof existing?.last_backfill_at === "string" && existing.last_backfill_at.trim().length > 0;
816
- if (alreadyBackfilled) {
817
- const messageCountRow = this._db()
818
- .prepare(`SELECT COUNT(*) AS count FROM messages WHERE session_key=?`)
819
- .get(normalizedSessionKey);
820
+ if (alreadyBackfilled && messageRows > 0) {
820
821
  this.logger?.info?.(
821
- `[mobcode-store] ensureSessionIndexed skip session=${normalizedSessionKey} reason=already_backfilled lastBackfillAt=${existing?.last_backfill_at ?? "-"} messageRows=${Number(messageCountRow?.count ?? 0)}`,
822
+ `[mobcode-store] ensureSessionIndexed skip session=${normalizedSessionKey} reason=already_backfilled lastBackfillAt=${existing?.last_backfill_at ?? "-"} messageRows=${messageRows}`,
822
823
  );
823
824
  return;
824
825
  }
826
+ if (alreadyBackfilled && messageRows <= 0) {
827
+ this.logger?.warn?.(
828
+ `[mobcode-store] ensureSessionIndexed retry session=${normalizedSessionKey} reason=stale_backfill_marker lastBackfillAt=${existing?.last_backfill_at ?? "-"} messageRows=${messageRows}`,
829
+ );
830
+ }
825
831
  this.logger?.info?.(
826
832
  `[mobcode-store] ensureSessionIndexed start session=${normalizedSessionKey}`,
827
833
  );