Repository navigation
feat(cli): batch import local sessions with redaction, retention, and dedup - #2100
suryanshxharma wants to merge 9 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
…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>
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.
Signed-off-by: suryanshxharma <suryanshxharma@gmail.com>
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.
Signed-off-by: suryanshxharma <suryanshxharma@gmail.com>
64e0100 to
945e3ee
Compare
Signed-off-by: suryanshxharma <suryanshxharma@gmail.com>
… dedup Signed-off-by: suryanshxharma <suryanshxharma@gmail.com>
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.
| r"""|access[_-]?key|private[_-]?key)\b["']?\s*[=:]\s*)("[^"]*"|'[^']*'|[^\s"'\\,;}]+)""", | ||
| re.IGNORECASE | re.ASCII, | ||
| ) | ||
| _JWT_RE = re.compile(r"\beyJ[\w-]{0,512}\.[\w-]{1,8192}\.[\w-]{0,1024}", re.ASCII) |
There was a problem hiding this comment.
P1 — With re.ASCII on the whole expression, Bearer followed by a non-breaking space and a credential no longer matches. Scope ASCII to the boundary with (?a:\b), preserve Unicode whitespace in the assignment and Basic auth expressions too, and cover the outgoing batch request.
Signed-off-by: suryanshxharma <suryanshxharma@gmail.com>
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

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 potentially sensitive local chat content into the server after client-side redaction; incorrect redaction or policy bypass could leak secrets or store data when recording is off.
Overview
Extends
loom ingest-transcriptso local Claude Code and Codex sessions can be discovered, parsed, and batch-imported into Loom conversations—not only single markdown/JSON files.--discoverlists projects under~/.claude/projectsand~/.codex/sessions.--project(repeatable) imports matching sessions;--newestcaps how many recent sessions are taken;--retention-daysdrops old sessions (defaulting to the namespace’s retention fromnamespace.get).--filenow accepts.jsonltranscripts with auto-detected format.New module
server/cli/_transcripts.pyparses JSONL (active Claude branch viaparentUuid/logicalParentUuid, strips injected client tags and tool results), aggregates discovery by project, andredact_secretsscrubs tokens, JWTs, keys, and similar patterns (plus the caller’s token) before any upload.Import paths verify conversation recording is enabled on the namespace, abort if policy lookup fails, and post turns via shared
_post_turnsthat treatsconversation.appendduplicate acks as idempotent re-runs. Imported rows get metadata such assource_class: imported, source, project, andsession_ts.Reviewed by Cursor Bugbot for commit 151ae7e. Bugbot is set up for automated code reviews on this repo. Configure here.