Skip to content

refactor(agents): keep media request identity with its operation - #177906

Merged
steipete merged 1 commit into
mainfrom
deslop/z39-8-media-request-owner-20261015
Oct 20, 2026
Merged

steipete merged 1 commit into
mainfrom
deslop/z39-8-media-request-owner-20261015

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Media duplicate detection maintains a second request-start cache and joins it back to operations that already own the same work and completion lifetime.

User Impact

No intended user-visible change. Duplicate paid generation is still blocked, different requests remain independent, and recently completed detached work is reused for two minutes. No migration or operator action is needed.

Why This Change Was Made

Keep request identity on the existing process-owned media operation, at the same detached-only admission call site. Remove the parallel recent-start map, matching and pruning machinery, recorder, and production test-global publication. Operation retention is now the only completion-expiry clock. Status projections still select their public fields explicitly; request identity is not exposed.

Production delta: 17 added, 188 removed; 171 net lines removed, three production files. This is a completed-owner residue under the campaign's 100+ waiver, not a large-PR claim. Security/lifecycle authority, paid-call suppression, blocked-result retention, completion delivery and resource settlement remain intact. The obsolete assertion allowance is removed rather than retained as spare budget.

Best-effort tradeoffs accepted

When equivalent operations already coexist, duplicate lookup prefers a matching running/queued operation before an older successful completion. It still prevents another provider call. No security, durability or paid-call guard is removed. The removed cache was only request metadata joined back to the retained native owner (structural provenance #84006); it could never restore retired work. No human incident is claimed as provenance for a speculative guard removal.

Evidence

  • Activity/status/prompt/music-status suites: 19/19 passed; canonical wrapper 182.64 seconds.
  • Resource and retention suites: 44/44 passed; 92.20 seconds.
  • Image, music, video and background caller suites: 146/146 passed; canonical wrapper 55.23 seconds after one fixture correction. The first run exposed two observer-classification failures: metadata-only updates were being labeled progress. The shared observer now records only actual progress updates; original progress assertions are unchanged.
  • The oversized image suite's completion fixtures now reuse actual admitted operations instead of duplicating their identities. Image-only replay: 59/59 passed, 48.21 seconds. This also resolves the line-growth hook finding without trimming assertions or allowing new line-cap debt.
  • Targeted three-root production typecheck, boundary-free scoped core lint, root-support lint, formatting and diff whitespace checks passed.
  • Independent review of the full code/test change: no actionable P0–P2 findings. Author simplification pass completed.
  • Runtime import cycles: zero. Static import cycles: zero. Focused assertion check: zero remaining assertions in the simplified owner.
  • Prefix stability: 5/5 passed. Required suppression inventory: 14/14 passed. Combined canonical wrapper: 92.07 seconds.

Exact-head hosted CI is the broad gate. No whole-graph typecheck, whole test suite, build or live-provider result is claimed.

@clawsweeper

clawsweeper Bot commented Oct 20, 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.

@steipete
steipete marked this pull request as ready for review October 20, 2026 01:06
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T01:08:47.243325Z 10e2d88 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: M labels Oct 20, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 20, 2026
@clawsweeper

clawsweeper Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR stores media request identity on the existing operation and removes the separate recent-start cache.

Example: Repeat an identical image request for “draw a tree” 10 seconds after its detached generation succeeds.

  • Before: The separate request cache joins back to the retained operation and returns recent-success status.
  • After: The retained operation supplies request identity directly and returns the same recent-success status.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch is focused and source-consistent; supplied validation is in-process rather than shipped-entry-point evidence, and broad CI is pending.
Proof confidence 🦐 gold shrimp (3/6) The maintainer-authored refactor is outside the ordinary contributor proof gate; its body reports focused owner, retention, and caller tests without claiming a shipped-entry-point or live-provider run.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: No intended user-visible change; duplicate suppression currently requires parallel request metadata and operation bookkeeping.
Reason: The maintainer-directed consolidation reduces lifecycle machinery while retaining scoped duplicate suppression and documenting its selection tradeoff.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: the maintainer-directed refactor removes redundant bookkeeping without an identified correctness defect; exact-head CI remains pending.

Priority: P3
Reviewed head: 10e2d88cf57e25069192327e8099925cac56fd88

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: No shipped CLI or Gateway media-retry run is supplied; recorded validation covers operation owners and mocked provider callers.
Agent review details

How this fits together

Image, music, and video tools pass prepared request keys into detached media admission; the process-owned operation registry supplies scoped duplicate decisions and status while the existing completion machinery owns delivery.

flowchart TD
  A[Media tool request] --> B[Request preparation]
  B --> C[Duplicate lookup]
  C --> D[Scoped operation registry]
  C --> E[Detached admission]
  E --> D
  E --> F[Provider work and completion delivery]
Loading

Technical review

Best possible solution:

Keep request identity and expiry with the existing media operation owner and let exact-head CI finish.

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

This PR addresses redundant internal ownership rather than a reported user failure; source confirms the separate cache exists on fetched main, and no target code was executed.

Is this the best way to solve the issue?

The change is a small, complete consolidation: existing operation lifetime and scope absorb request identity, while the replaced cache, recorder, pruning machinery, and test publication are removed.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Source -171, Tests -78, Other -1. Total -250 across 12 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 3 17 188 -171
Tests 8 54 132 -78
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 1 -1
Total 12 71 321 -250

Review metrics

Metric Value Why it matters
Production versus test changes Production +17/-188; tests and test support +54/-132 The reduction removes a parallel cache and adapts existing coverage without adding a replacement subsystem.

Labels

Label changes:

  • add P3: This is internal ownership cleanup with no intended user-visible change or established urgent regression.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This is internal ownership cleanup with no intended user-visible change or established urgent regression.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

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 October 19, 2026, 9:23 PM ET / October 20, 2026, 01:23 UTC.

@steipete
steipete enabled auto-merge (squash) October 20, 2026 01:26
@steipete
steipete merged commit fbf10f4 into main Oct 20, 2026
198 of 199 checks passed
@steipete
steipete deleted the deslop/z39-8-media-request-owner-20261015 branch October 20, 2026 01:29
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash auto-merge.

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

Labels

agents Agent runtime and tooling P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant