Skip to content

fix(ingest): preserve origin title provenance - #3892

Merged
Sinity merged 3 commits into
masterfrom
feature/fix/title-provenance-final
Aug 8, 2026
Merged

fix(ingest): preserve origin title provenance#3892
Sinity merged 3 commits into
masterfrom
feature/fix/title-provenance-final

Conversation

@Sinity

@Sinity Sinity commented Aug 8, 2026

Copy link
Copy Markdown
Owner

Summary

Preserve provider-authored titles from Grok, Antigravity, browser capture, and Hermes by assigning the existing typed origin provenance at each parser boundary. Heuristic identifiers, artifact names, and browser page titles remain untrusted fallbacks.

Problem

The public title-presence policy intentionally suppresses untyped title text. Four active parsers supplied genuine provider-authored titles without ParsedSession.title_source, so archive summaries and display labels degraded to generated structural labels after otherwise successful ingest. Ref polylogue-o5smo.

Solution

The Grok, Antigravity, and Hermes parsers now assign TitleSource.ORIGIN only to provider-authored values. Live and backfill browser producers emit a typed provider, page, or session-id title source; the parser trusts only provider and handles old envelopes conservatively. Native ChatGPT may consume that trusted title without inheriting the browser capture timestamp as provider update time. Index v67 declares the stored parser-semantic change as requiring raw replay. A shared production-route test carries each repaired origin through materialization, ArchiveStore, SessionFilter, and the public summary, while a provenance-removal mutation proves that the public title degrades.

Verification

devtools test tests/unit/sources/test_browser_capture.py tests/unit/storage/test_title_provenance_origins.py tests/unit/sources/parsers/test_antigravity.py tests/unit/sources/parsers/test_grok.py tests/unit/sources/parsers/test_hermes_state.py tests/unit/sources/parsers/test_origin_regression_pack.py: 122 passed in 26.50 seconds.

devtools test tests/unit/storage/test_index_fast_forward_lifecycle.py tests/unit/storage/test_index_fast_forward_executor.py tests/unit/devtools/test_verify_schema_upgrade_lane.py: 35 passed in 2.55 seconds.

npm test -- --run tests/common_envelope_boundary.test.js tests/backfill.test.js: 65 passed. npm run lint -- --quiet: passed.

devtools lab policy schema-versioning: schema evolution policy intact.

devtools verify --quick: all 24 checks passed in 97.09 seconds.

No live archive or production state was mutated.

Summary by CodeRabbit

  • New Features

    • Session titles now retain their source, distinguishing provider titles from page titles and session-ID fallbacks.
    • Provider-authored titles are preserved consistently across supported imports, browser captures, saved sessions, filtering, and public summaries.
    • Synthetic or unreliable titles are excluded from provider-title attribution.
  • Bug Fixes

    • Improved title fallback behavior when provider metadata is unavailable.
    • Existing stored sessions are reprocessed to apply accurate title provenance.
  • Documentation

    • Updated demo examples with refreshed sample manifest identifiers.

Sinity added 2 commits August 8, 2026 19:41
Assign typed origin provenance only to provider-authored titles from Grok, Antigravity, browser capture, and Hermes. Keep heuristic filename and page-title fallbacks untrusted. Add parser assertions and a shared parser-to-public-surface regression route with a provenance-removal mutation.\n\nRef polylogue-o5smo.
Record polylogue-o5smo as satisfied by the parser-to-public-surface implementation, focused production-route coverage, red provenance mutation, and clean quick gate.
@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

No new commits to review since the last review.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 0bed0e59-e39a-436a-8681-355c54634896

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The change records title provenance from browser capture and origin parsers through storage and public session conversion. Provider titles are trusted and marked separately from page and session-ID fallbacks. Schema version 67 requires semantic reparse.

Changes

Title provenance

Layer / File(s) Summary
Envelope title-source contract
polylogue/browser_capture/models.py, browser-extension/src/*, browser-extension/tests/*
Session envelopes now include title_source values for provider, page, and session-ID titles. Boundary and restart tests cover the selection.
Parser provenance handling
polylogue/sources/parsers/*, tests/unit/sources/*
Origin parsers mark provider titles with TitleSource.ORIGIN. Browser-capture parsing rejects synthetic fallback titles and preserves trusted envelope titles.
Storage migration and route verification
polylogue/storage/sqlite/*, tests/unit/storage/*, docs/examples/demo-tour/*, .beads/issues.jsonl
Index version 67 declares a semantic reparse. Integration tests verify provenance retention and degradation across storage, filtering, and public summaries.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant OriginParser
  participant BrowserCaptureParser
  participant ArchiveStorage
  participant PublicSession
  OriginParser->>BrowserCaptureParser: title and TitleSource.ORIGIN
  BrowserCaptureParser->>ArchiveStorage: parsed session with title provenance
  ArchiveStorage->>PublicSession: stored title and provenance
  PublicSession-->>ArchiveStorage: public session summary
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes preserving origin title provenance during ingest.
Description check ✅ Passed The description covers the required sections, solution, verification, bead disposition, and risks; the conditional changelog entry is omitted.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/fix/title-provenance-final

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Sinity

Sinity commented Aug 8, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fe8c89666b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

source_name=Provider.GROK,
provider_session_id=fallback_id,
title=title,
title_source=TitleSource.ORIGIN if provider_title else None,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Trigger a semantic replay for title provenance

When upgrading an existing v66 archive whose raw records have already been parsed, these parser-only assignments leave INDEX_SCHEMA_VERSION unchanged, so normal startup accepts the existing index.db and the parse backlog excludes rows with parsed_at_ms; consequently the stored title_source remains NULL and the public title stays suppressed for all previously ingested Grok, Antigravity, browser-capture, and Hermes sessions. Increment the index version and declare the delta as SEMANTIC_REPARSE so those sessions are rebuilt from their retained raw evidence rather than fixing only new or explicitly reprocessed imports.

AGENTS.md reference: AGENTS.md:L193-L200

Useful? React with 👍 / 👎.

source_name=provider,
provider_session_id=provider_session_id,
title=envelope.session.title or envelope.provenance.page_title or provider_session_id,
title_source=TitleSource.ORIGIN if envelope.session.title else None,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Do not trust the envelope's fallback title

When a browser adapter cannot extract a provider title, the actual extension producer still sets session.title to document.title or the native session ID in browser-extension/src/common.js; therefore this condition marks exactly those page-title/identifier fallbacks as TitleSource.ORIGIN, bypassing the public suppression policy. The new test avoids the production shape by deleting session.title manually, but a real no-title capture will retain it, so provenance must be carried separately from the producer or compared against the known page-title/ID fallbacks before assigning ORIGIN.

Useful? React with 👍 / 👎.

_apply_browser_capture_session_kind(
_merge_envelope_attachments(parse_chatgpt(raw_provider_payload, provider_session_id), envelope),
_merge_envelope_attachments(
_merge_envelope_native_metadata(parse_chatgpt(raw_provider_payload, provider_session_id), envelope),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Avoid merging capture time into native ChatGPT timestamps

When a native ChatGPT payload omits update_time, parse_chatgpt correctly leaves updated_at unset, but this newly enabled helper also copies envelope.session.updated_at; the production extension always constructs that field as updatedAt || now, so the session is now falsely stamped with browser capture time and downstream timeline/date ordering treats it as provider evidence. Limit the ChatGPT merge to the trusted title fields, or preserve a distinct capture-time field instead of passing the whole metadata merge.

Useful? React with 👍 / 👎.

Problem

Browser envelopes carried fallback page titles and session ids in the same
field as provider-authored titles. Native ChatGPT parsing also merged the
envelope capture timestamp as provider update time. Existing derived rows
could not be repaired without replay.

What changed

Add a typed title-source field to live and backfill producers, trust only
provider evidence in the parser, and keep native ChatGPT timestamp authority
inside its native payload. Declare the semantic parser change as index v67
and refresh generated demo evidence. Pin the v64-to-v65 executor fixture to
its stated target so later semantic versions do not invalidate it.

Verification

- 157 focused Python tests passed
- 65 browser-extension tests passed
- browser-extension ESLint passed
- devtools lab policy schema-versioning passed
- devtools verify --quick passed all 24 steps

Ref polylogue-o5smo.

Co-Authored-By: Codex <noreply@openai.com>
@Sinity

Sinity commented Aug 8, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@Sinity

Sinity commented Aug 8, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Already reviewed.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: cde7fef6e3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Sinity
Sinity merged commit 4b61a21 into master Aug 8, 2026
3 checks passed
@Sinity
Sinity deleted the feature/fix/title-provenance-final branch August 8, 2026 18:30
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.

1 participant