Skip to content

Feat log dump command#931

Draft
shortdiv wants to merge 3 commits intomainfrom
feat-log-dump-command
Draft

Feat log dump command#931
shortdiv wants to merge 3 commits intomainfrom
feat-log-dump-command

Conversation

@shortdiv
Copy link
Copy Markdown
Contributor

@shortdiv shortdiv commented Apr 2, 2026

No description provided.

shortdiv and others added 2 commits April 1, 2026 19:15
Introduces a new `logs <commitsha>` subcommand that reads the
authorship note for a commit, resolves transcript and database
paths for each agent (claude, cursor, codex, copilot, windsurf,
gemini, opencode, continue-cli, droid, amp), and packages
everything into a zip file with metadata.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Databases (Cursor vscdb, OpenCode sqlite, Copilot vscdb) contain all
sessions and are too large for a debug bundle. Working log blobs are
full file snapshots, and INITIAL is seed attribution state — neither
is useful for debugging checkpoint behavior. The bundle now only
includes checkpoints.jsonl from working logs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Comment thread src/commands/logs.rs
// Also check for debug-mode "old-<sha>" directory
let old_working_log_dir = repo.storage.working_logs.join(format!("old-{}", base_sha));

let effective_wl_dir = if working_log_dir.is_dir() {

Check failure

Code scanning / CodeQL

Uncontrolled data used in path expression High

This path depends on a
user-provided value
.
Comment thread src/commands/logs.rs

let effective_wl_dir = if working_log_dir.is_dir() {
Some(&working_log_dir)
} else if old_working_log_dir.is_dir() {

Check failure

Code scanning / CodeQL

Uncontrolled data used in path expression High

This path depends on a
user-provided value
.
Comment thread src/commands/logs.rs Fixed
Comment thread src/commands/logs.rs Fixed
Comment thread src/commands/logs.rs Fixed
Sanitize user-controlled inputs used in path expressions:
- Validate commit SHA and base_commit_sha are hex-only before using in paths
- Canonicalize output directory to resolve ".." components
- Add symlink escape detection in collect_dir_recursive

Addresses CodeQL "Uncontrolled data used in path expression" findings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Comment thread src/commands/logs.rs
/// Recursively collect all files in a directory, producing (relative_path, absolute_path) pairs.
/// Skips the `blobs/` subdirectory since those are full file snapshots that bloat the bundle.
fn collect_dir_recursive(base: &Path, dir: &Path, out: &mut Vec<(String, PathBuf)>) {
let entries = match fs::read_dir(dir) {

Check failure

Code scanning / CodeQL

Uncontrolled data used in path expression High

This path depends on a
user-provided value
.
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.

3 participants