Conversation
Release v3.4.0 — promote develop to main
Release v3.4.1 — promote develop to main
Release v3.5.0 — promote develop to main
…ments (#1630) L1's generate() scored drawers by importance/emotional_weight/weight, and the docstring promised "prefer high importance, recent filing". But no ingest path (miner, convo_miner, diary, add_drawer) writes any of those fields, so the sort collapsed to insertion order (oldest first) and recency was never consulted. A scoped `wake-up --wing X` therefore surfaced the *oldest* moments: the opposite of useful. Add filed_at (present on every drawer, ISO-8601, lexically chronological) as the secondary sort key. Importance stays primary for the day a scoring pass populates it; filed_at is the effective signal today, making the "recent filing" half of the promise true with data already present. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: Igor Lins e Silva <4753812+igorls@users.noreply.github.com>
On Windows, Path.read_text() and open(path, 'a') use locale encoding (GBK on Chinese-locale systems) before PEP 686 / Python 3.15. A valid UTF-8 .gitignore with non-ASCII comments crashes _ensure_mempalace_files_gitignored() with UnicodeDecodeError, which aborts 'mempalace init' on Windows for any user whose .gitignore contains non-ASCII text. Force encoding='utf-8' on both read and append, with errors='replace' on read as a defensive fallback for legacy mixed-encoding files. Co-authored-by: ALaDingAhmad <16530935@qq.com> Co-authored-by: Igor Lins e Silva <4753812+igorls@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR syncs two post-v3.5.0 hotfixes from main back into develop to keep develop aligned ahead of the 3.6.0 promotion flow. It targets two user-facing reliability/UX issues: Windows .gitignore encoding handling during mempalace init, and L1 wake-up ordering so the most recently filed moments surface first.
Changes:
- Force UTF-8 (with defensive decode fallback) when reading
.gitignore, and UTF-8 when appending, to prevent Windows locale decode crashes inmempalace init. - Update L1 scoring/sorting to use
filed_atas a recency tie-breaker (after importance) so L1 surfaces newest-first when importance is absent/tied.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| mempalace/cli.py | Pins .gitignore read/append encoding to UTF-8 to avoid Windows UnicodeDecodeError during init. |
| mempalace/layers.py | Adjusts L1 scoring/sort to prefer newer filed_at when importance ties, aligning output with “recent filing” behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+153
to
+161
| # filed_at is an ISO-8601 string; ISO strings sort lexicographically | ||
| # in chronological order. Coerce to str so a missing/odd value sorts | ||
| # oldest rather than raising during the comparison. | ||
| recency = str(meta.get("filed_at") or "") | ||
| scored.append((importance, recency, meta, doc)) | ||
|
|
||
| # Sort by importance desc, then recency (filed_at) desc; take top N. | ||
| scored.sort(key=lambda x: (x[0], x[1]), reverse=True) | ||
| top = [(imp, meta, doc) for imp, _recency, meta, doc in scored[: self.MAX_DRAWERS]] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sync
mainhotfixes back intodevelopThe 3.6.0 promotion PR #2020 is currently behind
mainbecause two post-v3.5.0 hotfixes landed directly on the release branch and were never merged back:fix(cli): force UTF-8 when reading/writing .gitignore in init(fix(cli): force UTF-8 when reading/writing .gitignore in init #1648)fix(layers): order L1 wake-up by recency so it surfaces the latest moments(fix(layers): order L1 wake-up by recency (filed_at) so it surfaces the latest moments #1630)This PR carries those two changes into
developbefore the 3.6.0 promotion. Its effective diff is limited tomempalace/cli.pyandmempalace/layers.py.Release flow
develop.develophead.main.v3.6.0, then approve the gated PyPI publish.