Repository navigation
feat(cli): batch import local sessions with redaction, retention, and dedup - #2100
suryanshxharma wants to merge 11 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
zlareb1
left a comment
There was a problem hiding this comment.
Batch import needs to stop when recording policy cannot be verified and resume after a partial upload. The four commits on this head also need the required DCO sign-offs.
zlareb1
left a comment
There was a problem hiding this comment.
The agent token-refusal and session delivery-census tests pass on the tested base and both fail on this exact CI merge. Failed job
2651263 to
5e627a3
Compare
zlareb1
left a comment
There was a problem hiding this comment.
The batch path stops on a failed policy request and uses per-turn IDs for retries. The focused import suite passed 16 tests. The retention decision still admits sessions that the conversation plane’s retention should exclude. The Unicode redaction finding in the shared parser also applies to this head.
| print(f"recording is disabled for namespace {namespace}; skipping import") | ||
| return 0 | ||
|
|
||
| retention_days = int(getattr(args, "retention_days", 0) or 0) or ns_retention |
There was a problem hiding this comment.
P1 — This selects the CLI value ahead of the policy, and the policy lookup reads a namespace retention value. The conversation TTL uses the deployment’s retention_conversations_days, which NamespaceGetOutput never returns. A probe with a 30-day policy and --retention-days 90 posts a 60-day-old session. Read the effective conversation retention, let the CLI narrow that window, and cover the case with the real policy response shape.
5e627a3 to
64e0100
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
Reviewed by Cursor Bugbot for commit 64e0100. Configure here.
945e3ee to
60c7ec9
Compare
zlareb1
left a comment
There was a problem hiding this comment.
The conversation-retention finding and the untyped callback return remain on this head. The redactor also skips credentials after Unicode whitespace.
zlareb1
left a comment
There was a problem hiding this comment.
The batch callback now has a typed return. Two findings still block this head. The importer can accept sessions outside the effective conversation retention window, and the redactor can send credentials after Unicode whitespace. Retention thread · Redaction thread
| return 0 | ||
|
|
||
|
|
||
| def _cmd_ingest_transcript(args: argparse.Namespace) -> int: |
There was a problem hiding this comment.
P2 — _cmd_ingest_transcript is 225 lines, above the 200-line function limit. Extract the single-file parsing or upload path so the function passes the existing gate. Failed check
zlareb1
left a comment
There was a problem hiding this comment.
The Postgres restore test fails before initialization starts. A controlled connection delay reproduces the same timeout on the CI base and on clean main. The repair starts the test deadline after Postgres reports the blocked query. Failed job · Repair #2181
151ae7e to
b27c311
Compare
zlareb1
left a comment
There was a problem hiding this comment.
The Unicode whitespace regression is fixed. The retention finding still applies. The batch flag can widen the configured retention window, and the policy lookup still reads namespace retention in place of conversation retention. The function-length finding also remains.
| ) | ||
| _SECRET_ASSIGNMENT_RE = re.compile( | ||
| r"""(?a:\b)((?a:[\w.-]){0,64}?(?:password|passwd|secret|secret[_-]?key|token|api[_-]?key""" | ||
| r"""|access[_-]?key|private[_-]?key)(?a:\b)["']?\s*[=:]\s*)("[^"]*"|'[^']*'|[^\s"'\\,;}]+)""", |
There was a problem hiding this comment.
P1 — The quoted value matcher ends at an escaped quote. A synthetic quoted password with an escaped quote keeps its suffix after redaction, and this result becomes the batch turn's outgoing content. Consume escaped characters inside quoted values and test the outgoing request.
zlareb1
left a comment
There was a problem hiding this comment.
Dependency review hits the 300-file limit while checking base-only changes. The same replay fails with the contributor diff removed on the CI base and on current main. Repair #2053 passes the replay using the tested merge. Failed job · Repair #2053
…o ingest-transcript Signed-off-by: suryanshxharma <suryanshxharma@gmail.com>
…SONL error Signed-off-by: suryanshxharma <suryanshxharma@gmail.com>
Signed-off-by: suryanshxharma <suryanshxharma@gmail.com>
…k token before args Signed-off-by: suryanshxharma <suryanshxharma@gmail.com>
Signed-off-by: suryanshxharma <suryanshxharma@gmail.com>
Signed-off-by: suryanshxharma <suryanshxharma@gmail.com>
Signed-off-by: suryanshxharma <suryanshxharma@gmail.com>
…ace redaction Signed-off-by: suryanshxharma <suryanshxharma@gmail.com>
… dedup Signed-off-by: suryanshxharma <suryanshxharma@gmail.com>
Signed-off-by: suryanshxharma <suryanshxharma@gmail.com>
…gest_transcript under 200 lines Signed-off-by: suryanshxharma <suryanshxharma@gmail.com>
b27c311 to
a920bbe
Compare

Part 2 of #2078 (builds on #2099).
--project,--newest, and--retention-daystoloom ingest-transcriptfor batch-importing discovered Claude Code and Codex sessions.redact_secrets) matching the plugin hooks so credentials, tokens, JWTs, and private keys are scrubbed before leaving the machine.namespace.getfor the namespace recording setting and retention window, andconversation.threadsto skip already-importedsession_idthreads.metadata.source_class="imported"andsession_ts.docs/reference/cli.md.Note
Medium Risk
Imports local chat transcripts into Loom with client-side redaction and namespace policy checks; mishandled secrets or policy bypass could leak credentials or store conversations when recording is intended to be off.
Overview
loom ingest-transcriptnow discovers and imports local Claude Code and Codex session JSONL under~/.claude/~/.codex, in addition to markdown and JSON files.New flags:
--discoverlists sessions by project (no network);--projectbatch-imports matching projects;--newestcaps how many sessions per run;--retention-daysdrops old sessions (defaults to the namespace’s conversation retention when unset).--namespace/--fileare optional when using--discoveralone.Implementation adds
server/cli/_transcripts.py: JSONL parsing (active branch / compaction-aware for Claude), injected-tag stripping,redact_secretsbefore any upload, andnamespace.getgating (abort if policy lookup fails; skip when recording is off). Turns post via a shared_post_turnspath withsource_class: importedmetadata,session_ts, and idempotentconversation.appenddedup on duplicatemsg_id. CLI reference and help snapshots are updated; unit tests cover parsers, discovery, redaction, retention, and policy failures.Reviewed by Cursor Bugbot for commit a920bbe. Bugbot is set up for automated code reviews on this repo. Configure here.