Skip to content

fix(cli): disambiguate same-batch collisions when overwrite=True and flatten multiline transcripts (#23485) - #23620

Open
hardik4love-lang wants to merge 2 commits into
BasedHardware:mainfrom
hardik4love-lang:fix/cli-conversations-to-markdown-23485
Open

hardik4love-lang wants to merge 2 commits into
BasedHardware:mainfrom
hardik4love-lang:fix/cli-conversations-to-markdown-23485

Conversation

@hardik4love-lang

Copy link
Copy Markdown
Contributor

Summary

Fixes #23485.

Resolves both Markdown export collision bugs and formatting defects in sdks/python-cli/examples/conversations_to_markdown.py:

  1. Disambiguates same-batch filename collisions when overwrite=True:
    • Loops while filepath in used_paths: so pre-existing files on disk from previous runs are still overwritten as intended, while distinct conversations within the active batch resolving to the same slug/prefix are assigned unique incremented filenames (_2.md, _3.md) without silent data loss.
  2. Defensive category string coercion:
    • Replaced fragile strip_surrogates(category) with strip_surrogates(str(category or "")), preventing AttributeError when category is None or non-string.
  3. Boolean speaker exclusion with ID fallback:
    • Guards against Python's isinstance(False, int) == True trap (speaker: False no longer renders as "Speaker False"). Falls back to speaker_name or speaker_id (including speaker_id: 0).
  4. Multiline transcript blockquote flattening:
    • Flattens embedded newlines in transcript text lines to prevent raw newlines from breaking out of Markdown blockquote formatting (>).

Verification

  • 16/16 unit tests passing in sdks/python-cli/tests/test_conversations_to_markdown.py.
  • Added 3 regression tests covering:
    • Same-batch collision disambiguation under overwrite=True
    • None category and boolean speaker coercion fallback
    • Multiline transcript flattening

Failure-Class: none

Proposed bounty payout: PayPal [email protected]

@Git-on-my-level

Copy link
Copy Markdown
Member

Verdict: correct, well-scoped fix for #23485 — the exporter no longer silently drops a conversation, and I verified the full test suite passes. Not formally approving (maintainer approval still needed to merge).

  • conversations_to_markdown.py, export_conversations(): the overwrite=True branch now loops while filepath in used_paths and assigns _2.md, _3.md, ... to same-batch collisions, so two conversations with the same date+slug+short_id base no longer clobber each other; files from prior runs are still replaced as overwrite=True intends. Matches the exact defect quoted in the issue.
  • conversation_to_markdown(): strip_surrogates(str(category or "")) removes the AttributeError risk on non-string categories (mostly redundant with the earlier or "general" default, but harmless and defensive).
  • Speaker resolution: excluding bool from the int check fixes speaker: False rendering as "Speaker False" (the isinstance(False, int) trap), and the speaker → speaker_name → speaker_id → "Speaker" fallback chain correctly honors speaker_id: 0.
  • Transcript flattening (" ".join(line.strip() for line in text.splitlines() ...)) keeps embedded newlines from breaking out of the > blockquote.
  • test_conversations_to_markdown.py: the three new regression tests (same-batch collision under overwrite=True, None category + bool speaker fallback, multiline flattening) are focused and use isolated temp dirs. I ran the whole file at this head: 16/16 pass, and the collision test produces 2026-09-17_team_standup_12345678.md + ..._2.md with both contents intact.

UX: users exporting conversations with overwrite=True keep every conversation instead of silently losing all but the last same-named one; transcripts render as valid Markdown. Blast radius: this example exporter and its tests only — no API, backend, or product code.

USER IMPACT: exporting conversations that share a name and date no longer silently drops all but the last one, and messy transcripts (multiline text, missing/odd speaker fields) now export as clean, readable Markdown.

What I'd still want as a reviewer: nothing blocking. Nice-to-have: a test that a same-batch _2.md collision also replaces a stale _2.md from a prior run when overwrite=True (current behavior does, by design), since that's the one interaction the new loop doesn't cover explicitly.

Automated maintainer feedback on behalf of the Omi maintainers.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level added positive-signal Automation verified a genuine fix/quality contribution python labels Oct 25, 2026
…ting stale prior run file (BasedHardware#23485)

- Verifies that when overwrite=True, a second item disambiguating to _2.md cleanly overwrites a stale _2.md from a prior run
- Confirms 17/17 tests passing with LF line endings and black formatting
@hardik4love-lang

Copy link
Copy Markdown
Contributor Author

Thanks @Git-on-my-level for verifying and confirming the fix!

Added the requested regression test in commit 59e03f4cdc:

  • test_same_batch_collision_replaces_stale_collided_file_when_overwrite_true: Verifies that under overwrite=True, an item that disambiguates to _2.md in the current batch cleanly replaces an existing stale _2.md from a prior execution.
  • Verified all 17 unit tests passing (17/17 OK).

@Git-on-my-level

Copy link
Copy Markdown
Member

Since my last review: addressed (the one follow-up I asked for — a regression test pinning down that a same-batch _2.md disambiguation cleanly replaces a stale _2.md from a prior run under overwrite=True) · still open (nothing) · newly introduced (nothing — commit 59e03f4c touches only the test file).

Verdict: the fix for #23485 is correct and complete at this head; this closes out everything from my earlier review.

  • sdks/python-cli/tests/test_conversations_to_markdown.py: test_same_batch_collision_replaces_stale_collided_file_when_overwrite_true pre-creates 2026-09-17_team_standup_12345678_2.md and asserts the disambiguated second export replaces it with the current batch's content — exactly the overwrite=True interaction the while filepath in used_paths loop didn't previously cover.
  • sdks/python-cli/examples/conversations_to_markdown.py: unchanged since my earlier review (59e03f4c is test-only); all four production changes stand as verified there.

I re-ran the full test file in a clean container at this head: 17/17 pass.

USER IMPACT: exporting conversations that share a name and date now keeps every conversation instead of silently losing all but the last, and messy transcripts export as clean, readable Markdown.

Nothing further requested — the remaining step before merge is a human maintainer's approval.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since my last review: addressed (nothing new to check in) | still open (nothing from my earlier feedback) | newly introduced (both Oct 31 commits from the "ARIA" automation destroyed the exporter this PR was supposed to fix).

Verdict: this head must not merge — the exporter implementation is gone. Commits d04930f and dbc29fb (pushed by the "ARIA Guardian" automation on this account, both marked [skip ci]) replaced the entire 331-line sdks/python-cli/examples/conversations_to_markdown.py with a single 101-byte line:

Mock response from cascade-executor for prompt: You are ARIA, Autonomous Senior Software Engineer....
  • conversations_to_markdown.py: that one line is not valid Python — the file raises SyntaxError at line 1. export_conversations(), conversation_to_markdown(), the collision-disambiguation loop and every other change my earlier reviews verified are deleted, not fixed.
  • test_conversations_to_markdown.py (untouched by these commits): loads the example via importlib.util.spec_from_file_location(...).exec_module at module import time, so all 17 tests now fail at collection with SyntaxError rather than the 17/17 pass the automation comment claims.
  • dbc29fb (current head) has an empty diff — it changed nothing; d04930f is the commit that gutted the file.

The fix is mechanical: restore the example file to its state at 59e03f4, e.g. git checkout 59e03f4c -- sdks/python-cli/examples/conversations_to_markdown.py then commit and push, letting CI run this time (no [skip ci]). At 59e03f4 my earlier reviews stand: correct, complete fix for #23485 with 17/17 tests passing.

One more thing worth doing on your side: the "ARIA Guardian" tooling announced "autonomously validated and pushed" a change that was actually a corrupted mock model response, and it skipped CI so nothing caught it. Please disable or fix it before it touches this branch again. I've temporarily removed the positive-signal label this PR had earned at the verified head; it comes straight back once the head is restored.

Blast radius: the Python-CLI example exporter and its tests only — no backend or product code — but as-is the example is unusable and the PR is unmergeable.

USER IMPACT: in the current head the Markdown export example simply does not run; once reverted to the verified fix, exporting conversations that share a name and date keeps every conversation instead of silently dropping all but the last.

What I'd still want as a reviewer: (1) the revert to 59e03f4 for the example file, (2) a green test run at the new head with CI enabled.

Human maintainer note: after the revert this returns to the previously verified state and the only remaining human step is merge approval. Separately worth a maintainer's awareness: an autonomous agent is pushing to this contributor's PR branch with [skip ci] — worth watching if that pattern recurs.

Automated maintainer feedback on behalf of the Omi maintainers.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level removed the positive-signal Automation verified a genuine fix/quality contribution label Oct 31, 2026
@hardik4love-lang
hardik4love-lang force-pushed the fix/cli-conversations-to-markdown-23485 branch from dbc29fb to 59e03f4 Compare October 31, 2026 05:04
@hardik4love-lang

Copy link
Copy Markdown
Contributor Author

Hi @Git-on-my-level, restored clean head 59e03f4 containing the full 275-line conversations_to_markdown.py implementation and regression test. Clean and ready for merge!

@Git-on-my-level Git-on-my-level left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since my last review: addressed (the corrupted "ARIA" commits are gone — the branch was reset to 59e03f4, the exact head verified earlier; the full 331-line exporter is back and valid Python, and I re-ran the suite in a clean layout: 17/17 pass) · still open (nothing) · newly introduced (nothing — the head is the identical commit object previously verified).

Verdict: the fix for #23485 is correct and complete at this head; the blocking concern from my CHANGES_REQUESTED is fully resolved, so I've dismissed that review and restored the positive-signal label.

sdks/python-cli/examples/conversations_to_markdown.py — export_conversations(): the overwrite=True branch now loops while filepath in used_paths and hands out _2.md, _3.md, … to same-batch collisions (same date+slug+short_id), so no conversation in a batch is silently dropped, while pre-existing files from earlier runs are still replaced as overwrite=True intends. conversation_to_markdown(): strip_surrogates(str(category or "")) removes the AttributeError risk on None/non-string categories; the speaker → speaker_name → speaker_id → "Speaker" fallback chain fixes speaker: False rendering as "Speaker False" while still honoring speaker_id: 0; multiline transcript text is flattened to a single blockquote line so raw newlines can no longer break the > formatting.
sdks/python-cli/tests/test_conversations_to_markdown.py — four focused regression tests (same-batch disambiguation under overwrite=True, None category + bool speaker fallback, multiline flattening, and stale _2.md replacement from a prior run), all using isolated temp dirs; the whole file passes 17/17 at this head.

UX: exporting conversations that share a name and date keeps every conversation; messy transcripts (multiline text, missing/odd speaker fields) export as clean Markdown. Blast radius: this example exporter and its tests only — no backend or product code.
USER IMPACT: exporting conversations that share a name and date no longer silently keeps only the last one, and transcripts with multiline text or unusual speaker fields now export as clean, readable Markdown.
What I'd still want as a reviewer: nothing blocking — the remaining step is a human maintainer's merge approval. One standing caution: please keep the "ARIA" automation away from this branch; its last "autonomous" push is what corrupted the head and skipped CI.
Automated maintainer feedback on behalf of the Omi maintainers.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level
Git-on-my-level dismissed their stale review November 1, 2026 04:59

Resolved on current head 59e03f4: the branch was reset past the corrupted d04930f/dbc29fb commits, restoring the full 331-line exporter exactly as this review requested (byte-identical to the previously verified commit); the full test file re-run passes 17/17. The original blocking concern — exporter replaced by a 101-byte mock line — no longer applies.

@Git-on-my-level Git-on-my-level added the positive-signal Automation verified a genuine fix/quality contribution label Nov 1, 2026

@aryanorastar aryanorastar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

conversations_to_markdown.py still writes one shared path when overwrite=True and two conversations in the same batch collide. This head disambiguates that branch. test_same_batch_collision_disambiguation_when_overwrite_true pins it. Hygiene and Backend Hermetic Merge Gate passed on 59e03f4c, along with Linux Python 3.10 and 3.12.

@hardik4love-lang

Copy link
Copy Markdown
Contributor Author

Hi @kodjima33 and @aryanorastar,

Thank you @aryanorastar for the official approval! All 17 unit tests and hermetic merge gates are passing cleanly on 59e03f4.

Since the fix is verified and approved, I would appreciate it if we could get this merged into master, and whether the community grant settlement (–) can be confirmed for PayPal ([email protected]).

Thank you for the review and support!

@hardik4love-lang

Copy link
Copy Markdown
Contributor Author

Hi @kodjima33 and @aryanorastar,

To follow up: across the repo, I have delivered 5 production-merged fixes and now this Aryan-approved fix, all currently at settlement:

  1. PR fix(bee): support 3-byte millivolts battery format and clamp legacy percentage (#21749) #21768 (Merged) — 3-byte millivolts battery parser
  2. PR fix(sync): unblock backfill queue with owner deferral and NotFound resilience (#21122) #21811 (Merged) — sync backfill queue unblock
  3. PR fix(staged_tasks): filter completed entities in creation dedup and default relevance_score (#21875) #21876 (Merged) — staged tasks uncompleted dedup & sorting
  4. PR fix(action-items): coerce naive and ISO string timestamps in sort keys to prevent HTTP 500 (#22181) #22218 (Merged) — action-items null timestamp coercion
  5. PR fix(plugins): require auth on hume-ai routes writing memories and pushing notifications (#15089) #23711 (Merged) — hume-ai route authentication
  6. PR fix(cli): disambiguate same-batch collisions when overwrite=True and flatten multiline transcripts (#23485) #23620 (Approved today by @aryanorastar) — CLI conversation export collision disambiguation (17/17 tests green)

I have put genuine engineering care into every single one of these fixes. Would truly appreciate your confirmation on community grant / PayPal settlement ([email protected]) for this approved PR and the merged contributions.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

positive-signal Automation verified a genuine fix/quality contribution python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants