Repository navigation
Keep Command scratch under the user home and recover orphaned files - #2279
Merged
Merged
Conversation
JacobStephens2
marked this pull request as ready for review
November 18, 2026 22:56
Merged
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
Give each Command private scratch under
~/.thirdshift/scratch/, shared by child Ticket runs. Sessions useTMPDIRthere; Factory skills are extracted there too. Sandbox Sessions receive separate temporary subdirectories, mounted at/sandbox/tmpin sealed sandboxes.Closes #2278.
Evidence
Execution evidence
cargo test --test scratch sessions_and_factory_skills_use_command_scratch_and_success_removes_it -- --nocapturefailed at the scratch-location assertion:"/tmp/.tmpnbqE4p/tmp".After: the same command passed for Claude and Codex; the complete scratch integration file passes 10 tests (2 fixture entry points ignored).
cargo test --test scratch startup_reaps_a_killed_commands_scratch_but_never_a_live_commands -- --nocapturefailed:orphan survived.After: the same test passes, including its live-owner preservation assertion and removal log.
cargo test --test scratch recovery_keeps_scratch_until_a_successful_continuation_or_dismissal -- --nocapturefailed:Recovery lost its scratch.After: the same test passes for successful continuation and Dismissal.
cargo test --test scratch sandboxed_triage_uses_writable_command_scratch -- --nocapturefailed withwrong TMPDIRand Harness exit 42.After: the same test passes using writable Command scratch.
cargo test --test experiments custom_runner::custom_runner_uses_command_scratch_without_the_sandbox -- --nocapture: passed.cargo test --bin thirdshift prompts_page: 14 passed;npm run docs:check --prefix site: passed.cargo test --test scratch_review_spec recommending_triage_does_not_discard_a_failed_runs_retained_scratch -- --exact --nocapturefailed:recommendation-only Triage deleted the failed run's retained scratch, with the removal log.After: the exact command passes; retained scratch survives recommendation-only Triage. The regression is kept.
cargo test --test scratch sigterm_during_startup_removes_scratch_before_any_session_starts -- --exact --nocapturefailed:SIGTERM during startup left scratch(left: 1,right: 0).After: the same command passes, before any Harness starts. The handler is installed before allocation.
RUST_TEST_THREADS=3 cargo test --test ci --test fresh_run --test mergeable: 72 passed, 6 fixture entry points ignored.cargo test --test pickup_run a_waiting_spec_is_passed_over_until_its_ticket_can_start_then_continued -- --exact --nocapturefailed because cleanup displaced the final PR outcome. After: the exact command passes; retained cleanup is recorded only in the Activity log.cargo test --test pickup_run delayed_selector_after_failed_winner_still_starts_only_one_run -- --exact --nocapturefailed after 120 seconds:the agent never started. After: the exact command passes in 2.49 seconds with explicit fixture coordination; the fullRUST_TEST_THREADS=3 cargo test --test pickup_runpasses 154 cases (2 fixture entry points ignored).cargo test --locked --test pickup_model -- --nocapture: 4 passed, 1 known-finding assertion ignored. Bounded claimed-dispatch safety passes; the existing documented pre-Claim counterexample remains. Reservation/Claim requests and ordering are unchanged.cargo test --test release summaries::every_configured_harness_gets_complete_release_evidence_in_a_toolless_sandbox -- --exact --nocapturefailed withBroken pipeand no summary: mounting scratch at its host path exposed the host-home ancestor that the fake Harness checks is absent. After: the exact command passes for all seven Harnesses with the original privacy assertions intact; the sandbox sees/sandbox/tmpbacked by Command scratch.cargo test --bin thirdshift sandbox::testspasses 30 tests, andcargo test --test experiments sandbox::passes six.cargo test --test release summary_calls_in_the_same_second_follow_execution_order_not_opaque_log_tokens -- --exact --nocapturefailed with calls[second, first]instead of[first, second]. After: the exact command passes; the helper orders sequential summary Sessions by completed writes, keeping the Release recovery assertions intact. The original CI failure,cargo test --test release recovery::an_old_merged_bump_can_be_recut_with_a_new_bump_pr -- --exact --nocapture, also passed locally.RUST_TEST_THREADS=3 /usr/bin/time -p target/debug/deps/release-ea016fa707ae5020: 150 passed, 3 fixture entry points ignored, 324.65 seconds; compilation excluded. This clean run replaces an invalidated Cargo run whose test executable was rebuilt concurrently.9a41cc05: all four Linux x86 Rust partitions, exact test-coverage gate, formatting, clippy, Python tooling, site and Console browser tests. ARM follows the repository's main/nightly policy and was skipped on this PR.CARGO_BUILD_JOBS=3 RUST_TEST_THREADS=3 /usr/bin/time -p scripts/affected-tests refs/remotes/origin/main. Site: 72 passed in 74.22 seconds. Cargo fallback: 1,974 unit tests passed (3 ignored), followed by passing integration cases; stopped the duplicate local suite after equivalent Rust and site CI passed for this exact head, asdocs/testing.mdpermits. This is CI reuse, not a claim that the local full-suite run completed.Test seams: real CLI Command/Session lifecycle with Scenario's fake Harnesses; the sandboxed Triage launch; the Custom runner Experiment CLI; native scratch allocation and guard lifetime in an isolated subprocess.
Visual evidence
The thirdshift PR skill requires: “Host PR-evidence media in a secret git-pushed Gist.”
gh gist createfailed with HTTP 404 because the configured GitHub token lacksgistscope. No media was uploaded; paired captures remain at these exact local paths and are copied beside the Session reports under.thirdshift-review-laVrhm/captures/./tmp/before-desktop.Rc3GpK.png/tmp/after-desktop.jzOdXy.png/tmp/before-mobile.dVlgbZ.png/tmp/after-mobile.wXEgIN.png/tmp/before-desktop.nbH0gT.png/tmp/after-desktop.Sbmpov.png/tmp/before-mobile.qmlSzd.png/tmp/after-mobile.6LAOD6.png/tmp/before-desktop.o2KNqy.png/tmp/after-desktop.BWU0wm.png/tmp/before-desktop.KOq2QX.png/tmp/after-desktop.CF0Yp1.pngUnaddressed findings
Standards
None. No findings skipped or declined.
Spec
None. No findings skipped or declined.
Security
None. No introduced findings.
Security review outcome
No unaddressed introduced findings.
Review coverage
Standards: 0 actionable findings. Spec: 1, fixed and verified with the reviewer’s exact reproducer. Both reviewers completed an initial pass and one coverage follow-up at
35e5004b(31 changed files read, 37 generated exclusions).Later validation corrections are outside that completed pass. Final unread changes:
.agents/skills/pr/SKILL.md: new evidence recipe change.skills/thirdshift-pr/SKILL.md: last evidence recipe adjustment; earlier hunks were read.site/prompts/index.html: last regenerated evidence recipe adjustment.tests/ci.rs: exact expected prompt strings updated for scratch guidance.tests/fresh_run.rs: exact expected prompt string updated for scratch guidance.tests/mergeable.rs: exact expected prompt string updated for scratch guidance.src/scratch.rs: early interruption handling and Activity-log-only retained cleanup; earlier implementation was read.tests/scratch.rs: new SIGTERM-during-startup regression; earlier tests were read.tests/pickup_run.rs: fixture coordination separated from Session TMPDIR.src/sandbox.rs: neutral sandbox TMPDIR alias backed by Command scratch.src/sandbox/code_grader.rs: shared temporary-directory sandbox mount.docs/guide.md: namespace alias clarification.site/docs/index.html: regenerated namespace alias clarification.tests/release.rs: same-second call-order regression and fixture ordering correction.The code-review skill allows one coverage follow-up per axis and says remaining gaps are reported rather than retried. Coverage of all 74 final changed paths at
9a41cc05: 25 fully read, 35 unchanged confirmed generated exclusions, and the 14 paths above. Reports and each axis's actual final files-read list are retained with this Session in.thirdshift-review-laVrhm/standards.md,spec.mdandsummary.json.The generated files below were intentionally not read. For the reviewed head, both axes reviewed their sources and generators:
src/prompt.rs,src/prompts_page.rs, the affected embedded Factory skills, Harness arguments,docs/guide.mdandsite/generate-docs.mjs. Prompt parity/fence/escaping checks, manual regeneration checks and documentation browser captures passed; the prompt page's surrounding hand-written HTML is unchanged.Every generated changed file intentionally left unread
prompts/architecture-review.mdprompts/bug-continuation-pr.mdprompts/bug-continuation.mdprompts/bug-fresh.mdprompts/ci-fix-repair-inherited.mdprompts/ci-fix-repair.mdprompts/code-review.mdprompts/conflict-repair.mdprompts/continuation-pr.mdprompts/continuation.mdprompts/fix-ci-repair.mdprompts/fix-conflict-repair.mdprompts/fix-review-repair.mdprompts/foreign-conflict-repair.mdprompts/fresh.mdprompts/grader.mdprompts/panel-grader.mdprompts/process-step-issue.mdprompts/process-step-later.mdprompts/process-step.mdprompts/pull-request-address.mdprompts/pull-request-ci-fix-repair.mdprompts/pull-request-review.mdprompts/pull-request-security-review.mdprompts/pull-request-validation.mdprompts/resume.mdprompts/review-repair.mdprompts/security-audit.mdprompts/security-fix.mdprompts/security-reproduction.mdprompts/security-review.mdprompts/spec-review.mdprompts/triage-correction.mdprompts/triage-issue.mdprompts/triage.mdsite/prompts/index.htmlsite/docs/index.htmlMerge Danger
Door: one-way
Cleanup deletes disposable files and verified old Factory extractions. Undoing a Dismissal cannot restore deleted scratch. Age, ownership, recursive layout checks, host/process identity and directory leases guard deletion.
Blast Radius: host
Commands on the same OS account share the scratch inventory. Repository skills and files outside Command scratch stay outside cleanup.
Built with codex codex-cli 0.167.2 · gpt-6.1-sol · xhigh