Skip to content

fix(guard): keep command lease payload schema-compatible#1305

Merged
kantorcodes merged 1 commit into
mainfrom
fix/command-lease-payload
Jul 4, 2026
Merged

fix(guard): keep command lease payload schema-compatible#1305
kantorcodes merged 1 commit into
mainfrom
fix/command-lease-payload

Conversation

@kantorcodes

Copy link
Copy Markdown
Member

Summary\n- strip non-contract snapshot metadata from Guard command lease payloads\n- preserve the lease payload fields the cloud route actually accepts\n- add regression coverage for metadata sanitization before remote polling\n\n## Testing\n- python3 -m ruff check src/codex_plugin_scanner/guard/runtime/command_queue.py tests/test_guard_command_queue.py\n- python3 -m pytest tests/test_guard_command_queue.py -q -k 'lease_payload_strips_local_snapshot_metadata or poll_once_leases_heartbeats_executes_and_posts_result'

Signed-off-by: Michael Kantor <6068672+kantorcodes@users.noreply.github.com>
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@kantorcodes kantorcodes merged commit 13bf315 into main Jul 4, 2026
14 of 21 checks passed
@kantorcodes kantorcodes deleted the fix/command-lease-payload branch July 4, 2026 20:03
@greptile-apps

greptile-apps Bot commented Jul 4, 2026

Copy link
Copy Markdown

Greptile Summary

This PR keeps Guard command lease payloads compatible with the cloud route. The main changes are:

  • Filters localRequestsSnapshot to only the fields accepted by the lease contract.
  • Drops local-only snapshot metadata such as maxBytes before remote polling.
  • Updates tests to cover the sanitized lease payload.

Confidence Score: 5/5

Safe to merge with minimal risk.

The change is narrowly scoped to sanitizing an existing lease payload, preserves the accepted fields, and includes tests for normal polling plus explicit metadata removal. No functional or security issue was identified in the changed paths.

No files require special attention.

T-Rex T-Rex Logs

What T-Rex did

  • Validated the guard command queue through the general contract validation proof, documenting the validation steps and outcomes.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
src/codex_plugin_scanner/guard/runtime/command_queue.py Adds an allowlist for command lease localRequestsSnapshot fields so local-only snapshot metadata is removed before polling.
tests/test_guard_command_queue.py Updates lease payload expectations and adds tests verifying local snapshot metadata is stripped.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Worker as Guard command worker
participant Store as GuardStore
participant Snapshot as Local request snapshot
participant Cloud as Guard Cloud lease route

Worker->>Store: Load OAuth metadata
Worker->>Snapshot: Build local request snapshot
Snapshot-->>Worker: Snapshot payload with contract and local metadata fields
Worker->>Worker: Keep only lease-compatible snapshot keys
Worker->>Cloud: POST /lease with sanitized payload
Cloud-->>Worker: Command job or empty response
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant Worker as Guard command worker
participant Store as GuardStore
participant Snapshot as Local request snapshot
participant Cloud as Guard Cloud lease route

Worker->>Store: Load OAuth metadata
Worker->>Snapshot: Build local request snapshot
Snapshot-->>Worker: Snapshot payload with contract and local metadata fields
Worker->>Worker: Keep only lease-compatible snapshot keys
Worker->>Cloud: POST /lease with sanitized payload
Cloud-->>Worker: Command job or empty response
Loading

Reviews (1): Last reviewed commit: "fix(guard): keep command lease payload s..." | Re-trigger Greptile

@kilo-code-bot

kilo-code-bot Bot commented Jul 4, 2026

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • src/codex_plugin_scanner/guard/runtime/command_queue.py - Fixes lease payload schema compatibility by filtering out non-contract metadata fields
  • tests/test_guard_command_queue.py - Updates test expectations and adds regression test

Reviewed by laguna-m.1-20260312:free · Input: 245.9K · Output: 14.3K · Cached: 1.2M

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.

1 participant