Skip to content

fix: handle non-interactive init prompts gracefully#13

Closed
sheetsync wants to merge 1 commit intoMemPalace:mainfrom
sheetsync:bugfix/noninteractive-init-eof
Closed

fix: handle non-interactive init prompts gracefully#13
sheetsync wants to merge 1 commit intoMemPalace:mainfrom
sheetsync:bugfix/noninteractive-init-eof

Conversation

@sheetsync
Copy link
Copy Markdown
Contributor

Summary

  • make room approval fall back safely when stdin is unavailable
  • make entity confirmation fall back safely on EOF too
  • add regression tests for non-interactive approval flows

Repro

Before this change, running mempalace init <dir> < /dev/null crashed with EOFError when room approval prompted for input.

Validation

  • pytest -q
  • verified python -m mempalace init <dir> < /dev/null now writes mempalace.yaml instead of crashing

@bensig
Copy link
Copy Markdown
Collaborator

bensig commented Apr 7, 2026

This was fixed in #123--yes now skips all interactive prompts. Closing as duplicate.

@bensig bensig closed this Apr 7, 2026
igorls added a commit to igorls/mempalace that referenced this pull request Apr 7, 2026
MCP tool_add_drawer:
- Make drawer_id content-based: hash full content instead of
  content[:100] + timestamp. Same content → same ID, eliminating
  TOCTOU race conditions
- Switch from col.add() to col.upsert() so re-filing with updated
  content updates the existing drawer

miner.add_drawer:
- Switch from collection.add() to collection.upsert() so re-mining
  a modified file updates instead of silently failing
- Remove the try/except catching 'already exists' — upsert handles
  this naturally

Findings: MemPalace#11 (HIGH — add ignores updates), MemPalace#6 (MEDIUM — TOCTOU),
          MemPalace#13 (MEDIUM — non-deterministic IDs)

Includes test infrastructure from PR MemPalace#131.
92 tests pass.
igorls added a commit to igorls/mempalace that referenced this pull request Apr 7, 2026
MCP tool_add_drawer:
- Make drawer_id content-based: hash full content instead of
  content[:100] + timestamp. Same content → same ID, eliminating
  TOCTOU race conditions
- Switch from col.add() to col.upsert() so re-filing with updated
  content updates the existing drawer

miner.add_drawer:
- Switch from collection.add() to collection.upsert() so re-mining
  a modified file updates instead of silently failing
- Remove the try/except catching 'already exists' — upsert handles
  this naturally

Findings: MemPalace#11 (HIGH — add ignores updates), MemPalace#6 (MEDIUM — TOCTOU),
          MemPalace#13 (MEDIUM — non-deterministic IDs)

Includes test infrastructure from PR MemPalace#131.
92 tests pass.
igorls added a commit to igorls/mempalace that referenced this pull request Apr 8, 2026
MCP tool_add_drawer:
- Make drawer_id content-based: hash full content instead of
  content[:100] + timestamp. Same content → same ID, eliminating
  TOCTOU race conditions
- Switch from col.add() to col.upsert() so re-filing with updated
  content updates the existing drawer

miner.add_drawer:
- Switch from collection.add() to collection.upsert() so re-mining
  a modified file updates instead of silently failing
- Remove the try/except catching 'already exists' — upsert handles
  this naturally

Findings: MemPalace#11 (HIGH — add ignores updates), MemPalace#6 (MEDIUM — TOCTOU),
          MemPalace#13 (MEDIUM — non-deterministic IDs)

Includes test infrastructure from PR MemPalace#131.
92 tests pass.
igorls added a commit to igorls/mempalace that referenced this pull request Apr 8, 2026
MCP tool_add_drawer:
- Make drawer_id content-based: hash full content instead of
  content[:100] + timestamp. Same content → same ID, eliminating
  TOCTOU race conditions
- Switch from col.add() to col.upsert() so re-filing with updated
  content updates the existing drawer

miner.add_drawer:
- Switch from collection.add() to collection.upsert() so re-mining
  a modified file updates instead of silently failing
- Remove the try/except catching 'already exists' — upsert handles
  this naturally

Findings: MemPalace#11 (HIGH — add ignores updates), MemPalace#6 (MEDIUM — TOCTOU),
          MemPalace#13 (MEDIUM — non-deterministic IDs)

Includes test infrastructure from PR MemPalace#131.
92 tests pass.
igorls added a commit to igorls/mempalace that referenced this pull request Apr 8, 2026
MCP tool_add_drawer:
- Make drawer_id content-based: hash full content instead of
  content[:100] + timestamp. Same content → same ID, eliminating
  TOCTOU race conditions
- Switch from col.add() to col.upsert() so re-filing with updated
  content updates the existing drawer

miner.add_drawer:
- Switch from collection.add() to collection.upsert() so re-mining
  a modified file updates instead of silently failing
- Remove the try/except catching 'already exists' — upsert handles
  this naturally

Findings: MemPalace#11 (HIGH — add ignores updates), MemPalace#6 (MEDIUM — TOCTOU),
          MemPalace#13 (MEDIUM — non-deterministic IDs)

Includes test infrastructure from PR MemPalace#131.
92 tests pass.
gnusam pushed a commit to gnusam/mempalace-pgsql that referenced this pull request Apr 9, 2026
Port of upstream a4149ab (by @igorls, findings MemPalace#6, MemPalace#11, MemPalace#13) adapted to
the PG+pgvector backend.

1. MCP/diary path ID is now hash(content), not content[:200]+timestamp.
   Same content → same deterministic ID. Eliminates TOCTOU races and
   stops identical content from piling up as distinct duplicate rows.
   Matches upstream's intent (findings MemPalace#6 TOCTOU, MemPalace#13 non-deterministic
   IDs).

2. INSERT ... ON CONFLICT (id) DO NOTHING → ON CONFLICT (id) DO UPDATE.
   Re-mining a modified file previously got the new content silently
   dropped because the slot ID matched an existing row (upstream
   finding MemPalace#11 HIGH — "add ignores updates"). True upsert: content,
   embedding, metadata, and filed_at are all refreshed.

3. add_drawer now always returns the drawer_id (both insert and update
   paths). The old "return None on conflict" signal implicitly encoded
   the stagnation bug and is no longer meaningful.

Updated tests/test_db.py::test_mine_drawer_reupsert_by_source to assert
the new upsert semantics instead of the stagnation assertion it replaced,
and added test_mcp_add_drawer_is_idempotent_on_same_content to cover the
deterministic-content-ID path. The mtime-based file_already_mined half
of bf88daa is in a follow-up commit.

Co-Authored-By: Igor Lins e Silva <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
jphein referenced this pull request in jphein/mempalace Apr 27, 2026
Three new fork-change rows for 2026-04-27 work that wasn't yet
captured in the documented inventory:

29. CLOSET_RANK_BOOSTS hoist + VecRecall ablation finding
    (f558d3c3cb03f3) — module-level constants + 12-probe A/B
    showing closet boost is mostly inert on chat-heavy corpus;
    VecRecall's MemPalace#1129 critique didn't reproduce.

30. .claude-plugin/ manifest scrub (81191499f91e18) — removed
    embedded API key + homelab URL from .mcp.json and hooks.json;
    daemon routing restored without the literal credential, env
    inherits from settings.local.json at runtime.

31. palace-daemon upstream PR push (PRs #7-#13) — seven small/medium
    PRs covering most fork-ahead daemon work; pending follow-ups
    and needs-generalization items tracked in daemon README.

YAML manifest gets corresponding entries for MemPalace#29 (kind-filter-retired,
closet-boost-ablation) and MemPalace#30 (plugin-manifest-scrub); FORK_CHANGELOG
re-rendered. Lint clean (11 fork hashes resolve, 90 PR refs match
upstream, FORK_CHANGELOG matches YAML).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants