Skip to content

feat(drive): return the committed revision from guarded uploads - #1346

Open
nomadonwheels196 wants to merge 1 commit into
openclaw:mainfrom
nomadonwheels196:drive-upload-committed-revision
Open

nomadonwheels196 wants to merge 1 commit into
openclaw:mainfrom
nomadonwheels196:drive-upload-committed-revision

Conversation

@nomadonwheels196

Copy link
Copy Markdown

What Problem This Solves

Scripts using gog drive upload --replace --if-version need the exact revision their update committed. A subsequent metadata read can see a newer revision from another writer.

User Impact

Add --include-committed-revision to a conditional replacement and use --json to get file.headRevisionId, file.sha256Checksum and file.md5Checksum from the update response when available. Existing JSON and text output stay compatible when the flag is omitted.

Why This Change Was Made

The flag expands the field mask of the existing conditional Drive v2 upload. It preserves the file version and ETag checks and returns the provider fields from that same write, with no follow-up metadata request. Missing receipt fields remain absent. An HTTP 412 still reports a conflict, and an ambiguous failure still gets one write attempt.

Evidence

Local HTTP fixtures cover the exact conditional request, the committed response, default output, a response with missing receipt fields, a competing write, and a server failure. CLI cases cover invalid flag combinations and the dry-run output. Live Google Drive integration was not run.

On macOS the two packages passed 3,916 tests and 3,736 subtests. The existing interactive Keychain test skipped because the test runner had no unlocked Keychain.

go test ./internal/cmd -run '^TestDriveUpload_' -count=1
go test ./internal/cmd ./internal/googleapi -count=1

Relates to #1345.

@clawsweeper

clawsweeper Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. P2 Normal priority bug or improvement with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 21, 2026
@clawsweeper

clawsweeper Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

Adds an opt-in flag that returns available committed revision and checksum fields from a guarded Drive upload response.

Example: Replace file1 at version 42 using --include-committed-revision --json.

  • Before: The result identifies file1 but omits the revision committed by the upload.
  • After: The result includes file.headRevisionId and available checksums from that upload’s response.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The implementation is focused and has no identified blocking code defect, but fixture-only evidence does not satisfy the real-behavior gate.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Product

Kind: Feature · Worth it: Needs a maintainer decision · Fix scope: Complete
User problem: Automation cannot identify the revision its guarded upload committed because a later metadata read may observe another writer’s update.
Reason: The same-response receipt has clear practical value, while its new public flag requires an owner decision.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep this PR open: it adds a distinct capability absent from main and implements the same author’s open request; the new flag still needs a product decision.

Priority: P2
Reviewed head: 8c1e0e3ed6c291fa0b7193250980df0a0e6f3ef4
Owner decision: Required. See Decision needed.

Decision needed

  • Question: Should guarded Drive uploads expose committed revision metadata through --include-committed-revision?
  • Recommendation: Accept the opt-in receipt: Approve the proposed flag and same-response output contract while retaining existing defaults.
  • Why: The feature addresses a concrete concurrent-writer limitation, but adds a public CLI option without recorded maintainer approval.

Before merge

  • Add real behavior proof - The added fixtures exercise command parsing, the real Drive client against a local HTTP server, field mapping and error cases, but no supplied evidence shows the shipped CLI returning receipt fields from an actual Drive update. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.

Findings

  • [P3] Add the required reference and contributor credit to the changelog — CHANGELOG.md:6

Tests

  • Missing end-to-end proof: Provide redacted terminal output or a terminal screenshot of the shipped CLI performing a guarded upload against Drive and returning the committed revision and available checksums; redact credentials, IPs and non-public endpoints.
Agent review details

How this fits together

The Drive upload command validates local input, performs the existing version-and-ETag guarded update through Drive v2, and formats the update response for scripts or terminal users.

flowchart TD
  A[CLI upload arguments] --> B[Validate upload options]
  B --> C[Read version and ETag]
  C --> D[Single conditional media update]
  D --> E[Map returned file metadata]
  E --> F[JSON or text output]
Loading

Technical review

Best possible solution:

Expose available receipt fields through the existing guarded update response while preserving default output and single-attempt guarantees.

Do we have a high-confidence way to reproduce the issue?

Current-main source confirms the receipt fields are excluded from both the guarded update field mask and output mapping; no target code or tests were run.

Is this the best way to solve the issue?

Using the existing update response avoids the later-read race with a small extension; revision-list and metadata-read commands cannot reliably identify this particular write after another writer advances the file.

Full review comments:

  • [P3] Add the required reference and contributor credit to the changelog — CHANGELOG.md:6
    The new Unreleased entry omits both a PR/issue reference and contributor thanks, which root AGENTS.md explicitly requires for user-visible changes. Link the related request and credit @nomadonwheels196 in this entry.
    Confidence: 1

Overall correctness: patch is correct
Overall confidence: 0.91

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against ae8dbb2eef93.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 1b26124 adds internal/cmd/drive_upload.go:400 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 1b261244fc26; files: internal/cmd/drive_upload.go)

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add P2: A bounded improvement helps automation identify its committed content without changing existing upload behavior.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Label justifications:

  • P2: A bounded improvement helps automation identify its committed content without changing existing upload behavior.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 21, 2026, 5:16 PM ET / 22:16 UTC.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant