feat(agents): restrict session ingestion to CodeMie-owned sessions#403
Open
BolotnyaBoss wants to merge 12 commits into
Open
feat(agents): restrict session ingestion to CodeMie-owned sessions#403BolotnyaBoss wants to merge 12 commits into
BolotnyaBoss wants to merge 12 commits into
Conversation
…ovider native-external
…c for external sessions
- Fix _metrics.json filter in session-ownership: use endsWith instead of includes to avoid skipping legitimate session files whose names merely contain the substring _metrics - Guard ConversationsProcessor.shouldProcess against CODEMIE_CONV_SYNC_DISABLED to prevent writing PENDING payloads for external resume sessions - Extract shouldBlockNonInteractiveResume as module-level export from AgentCLI so the non-TTY/no-prompts path can be unit-tested without mocking private state; refactor promptExternalResume to delegate to it - Add tests for shouldBlockNonInteractiveResume and the _metrics filter fix Generated with AI Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
…dation
- Remove UUID_RE guard that rejected non-UUID --resume values (e.g. ticket
slugs like epmcdme-12992); sanitize resumeId for display with \p{Cc}/gu
- Also set process.env.CODEMIE_CONV_SYNC_DISABLED in parent process so
same-process conversation sync consumers respect the suppression flag;
clean up after adapter.run() completes
- Standardize _metrics file filter to endsWith('_metrics.json') in
native-loader.ts, consistent with session-ownership.ts
- Write sidecar marker in session-origin-audit.ts and add existsSync guard
before transcript append (non-fatal, race-condition-free ownership signal)
- Add CODEMIE_CONV_SYNC_DISABLED guard to codex, gemini, opencode
conversation processors
Generated with AI
Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
Work item, spec, plan, two code-review verdicts, task state, gate plan, and QA report for session origin validation. Generated with AI Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
Generated with AI Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
…ons in HTML report
- HTML report now renders an amber warning badge in both the sessions
table ("⚠ ext" tag) and the session-detail modal header
("⚠ external — not CodeMie-managed") when session.provider is
"native-external". Previously the sessions were silently shown with
no visual distinction from CodeMie-owned sessions.
- Fix pre-existing crash in AnalyticsAggregator.deriveTitle: guard
against prompt.text being a non-string value (e.g. content-block
array) to prevent "raw.replace is not a function" TypeErrors that
blocked HTML report generation.
Generated with AI
Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
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.
Summary
Implements EPMCDME-12992. CodeMie was ingesting all Claude sessions from
~/.claude/projects/without verifying ownership, causing unrelated sessions to appear in Analytics and allowingcodemie-claude --resumeto silently ingest external sessions. This PR adds session origin validation across the full ingestion and resume path.Changes
Core ownership check
session-origin-audit.ts— writes a sidecar marker file~/.codemie/sessions/{id}-codemie-marker.jsonat session start and appends events to~/.codemie/logs/session-origin-audit.jsonlsession-ownership.ts—scanSessionsForClaudeId()scans correlation records in~/.codemie/sessions/to determine ownershipResume validation (
AgentCLI.ts)--resumetarget against ownership index before proceedingy/N; non-interactive mode blocks silentlyCODEMIE_CONV_SYNC_DISABLED=1injected into subprocess env and current process env to suppress conversation synccodemie-claude --resume epmcdme-12992Analytics (
native-loader.ts,formatter.ts)native-external, displayed with yellownative [external ⚠ not CodeMie-managed]in terminal output!f.endsWith('_metrics.json')(was!f.includes('_metrics'))Conv sync guards (codex/gemini/opencode processors)
shouldProcess()returnsfalsewhenCODEMIE_CONV_SYNC_DISABLED=1Testing
native-loader.test.ts,syncProcessor-guard.test.ts)Checklist
main— rebase before merge if neededCloses EPMCDME-12992