Skip to content

fix: Part C correctness — C1 embedBatch length, C4 default branch, C6 transcript escape - #173

Open
aadivyaraushan wants to merge 2 commits into
Autoloops:mainfrom
aadivyaraushan:fix/part-c-correctness-c1-c4-c6
Open

fix: Part C correctness — C1 embedBatch length, C4 default branch, C6 transcript escape#173
aadivyaraushan wants to merge 2 commits into
Autoloops:mainfrom
aadivyaraushan:fix/part-c-correctness-c1-c4-c6

Conversation

@aadivyaraushan

Copy link
Copy Markdown

Summary

Fixes three Part C correctness items from #145 (explicitly C1, C4, and C6; not C5 / #108):

  • C1 — Reject short/empty/dimensions-mismatched embedBatch results in ensureEmbeddings before any graph_object_embeddings insert (no more silent empty BLOBs via INSERT OR IGNORE).
  • C4 — Stop fabricating main when origin/HEAD is missing: try git ls-remote --symref origin HEAD, else store/report unknown. Non-git folder context still uses main.
  • C6 — Escape literal </filtered_session_transcript> inside transcript content (ZWSP after </) so pasted/hostile session text cannot break the evidence fence; real wrapper tags unchanged.

Test plan

  • npm run build && npm run typecheck
  • npm test (includes new check-embed-batch-length.js + check-worker-transcript-escape.js, updated check-repo-context.js)
  • User-facing dry-runs for C1, C4, and C6 (transcripts below)

Unit gate (commit 22f61f8)

$ npm test
Transcript bundle checks passed.
Repo context checks passed.
Install option checks passed.
Repository installation checks passed.
Managed CLI checks passed.
Graph view checks passed.
Graph view offline browser check passed: charts rendered with zero network access.
Source membership checks passed.
check-proposal-validate: ok
BM25 tokenizer checks passed.
check-anchor-drift: ok
Find similar claims checks passed.
Proposal validation dedupe checks passed.
check-opencode-sqlite-transcript: ok
Embed batch length checks passed.
Worker transcript escape checks passed.

Dry-run gate (same commit; disposable GREPLICA_HOME)

C4 — default branch no longer guessed as main

# temp git repo with origin remote, no refs/remotes/origin/HEAD
default_branch: "unknown"

# contrast: symbolic-ref refs/remotes/origin/HEAD → refs/remotes/origin/trunk
default_branch: "trunk"

C1 — embeddings no longer silently corrupt

# stub embedder returns 1 vector for 2 texts
threw: embedBatch returned 1 vector(s); expected 2.
after short batch: { c: 0, bytes: 0 }

# healthy stub on same fixture
healthy status: { checked_objects: 2, created: 2, reused: 0 }
after healthy: { c: 2, min_len: 32, max_len: 32 }

C6 — prompt containment holds

# transcript markdown contains a literal </filtered_session_transcript> mid-body
# built prompt: exactly one raw closing tag (the real fence closer);
# body shows ZWSP-neutralized sequence so early-close cannot break out
close-tag count: 1

Made with Cursor

…ags (C1/C4/C6)

Part C correctness from Autoloops#145: fail closed on incomplete embedBatch results,
resolve default branch via ls-remote or unknown, and neutralize early-close
tags in working-memory prompts so pasted transcript content cannot break
the evidence fence.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI review requested due to automatic review settings July 22, 2026 14:02

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Add a 5s timeout on ls-remote, reuse/rename the existing main scope when
default_branch changes, and reject wrong-length embedding vectors in tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
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