Skip to content

fix(api): honor cancellation in YouTube, Chat, and People - #1145

Merged
steipete merged 2 commits into
openclaw:mainfrom
SebTardif:fix/f026-google-api-context
Sep 22, 2026
Merged

steipete merged 2 commits into
openclaw:mainfrom
SebTardif:fix/f026-google-api-context

Conversation

@SebTardif

@SebTardif SebTardif commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

YouTube requests, Chat unread lookups and sends, and People profile/relationship reads could ignore command cancellation because their Google client calls did not carry the command context. Bind those calls to the existing context so stalled in-flight HTTP requests end when the caller cancels.

The strengthened regressions wait for the YouTube, Chat, and People requests to reach a synthetic server before canceling. On the old implementation, all three ignore cancellation and wait for the two-second server fallback. With the fix, all three return context.Canceled after exactly one request.

Thanks @SebTardif for the context-propagation fix. No live Google account was used.

The full make ci gate passes on AWS Crabbox. Independent Codex review of the staged candidate found no actionable P0–P2 findings.

@clawsweeper

clawsweeper Bot commented Sep 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.

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 20, 2026
@clawsweeper

clawsweeper Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 22, 2026, 1:54 AM ET / 05:54 UTC (Revision 2).

ClawSweeper review

What this changes

The PR attaches command contexts to 17 YouTube, Chat, and People API calls, adds three in-flight cancellation regressions, and updates automation documentation and the changelog.

Merge readiness

✅ Ready for maintainer review

This remains a useful fix absent from current main. The updated production-path cancellation evidence addresses the previous review, and no introduced correctness or security defects were found.

Priority: P2
Reviewed head: 0362d1a11460cf466e71d3077be94ee4d2dd6c8a

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused implementation with meaningful production-path cancellation evidence and no actionable introduced defects.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The body reports AWS Crabbox before/after observations for production YouTube playlist listing, Chat unread lookup, and People profile retrieval: server arrival precedes cancellation, and each patched command returns context.Canceled after one request instead of waiting for the fallback. Inspection confirms real Google clients and HTTP transport through those command owners, satisfying the internal-reliability proof path without live Google access. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The body reports AWS Crabbox before/after observations for production YouTube playlist listing, Chat unread lookup, and People profile retrieval: server arrival precedes cancellation, and each patched command returns context.Canceled after one request instead of waiting for the fallback. Inspection confirms real Google clients and HTTP transport through those command owners, satisfying the internal-reliability proof path without live Google access. No stored-data contract changes.
Evidence reviewed 9 items Pinned introduced change: The pinned main-to-head delta attaches contexts at 13 YouTube, two Chat, and two People call sites. Production changes preserve request parameters, account selection, confirmation checks, and error handling.
Still necessary on current main: Current main's playlist-list command still calls Do without attaching its command context. The introduced patch repairs the same omission in Chat unread lookups and People profile reads; existing sibling calls already use per-request contexts.
Latest release still affected: The supplied latest release, v0.40.0, also omits the request context in People profile reads. This is not already-shipped work.
Findings None None.
Security None None.

How this fits together

gogcli commands turn user input into Google API requests. Passing the command context into each request lets the HTTP client stop waiting when the caller cancels or reaches a deadline.

flowchart LR
 A[Command input] --> B[YouTube Chat or People command]
 C[Cancellation or deadline] --> B
 B --> D[Google request with context]
 D --> E[HTTP transport]
 E --> F[Result or cancellation error]
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Cancellation coverage 17 API call sites; 3 in-flight scenarios Representative production commands cover cancellation after HTTP dispatch across all three services.
Production versus test LOC Production +17/-16; tests +110/-0 Production growth is limited to context propagation, with most added code establishing regression coverage.

Technical review

Best possible solution:

Retain the existing per-request context pattern and the dispatch-before-cancellation regressions for these affected commands.

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

Yes, from source: the affected main-branch requests omit the caller context, and the supplied harness cancels after server arrival. This read-only review did not execute tests.

Is this the best way to solve the issue?

Yes. Attaching the existing context at each request follows neighboring implementations and avoids new timeout settings or transport machinery.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The body reports AWS Crabbox before/after observations for production YouTube playlist listing, Chat unread lookup, and People profile retrieval: server arrival precedes cancellation, and each patched command returns context.Canceled after one request instead of waiting for the fallback. Inspection confirms real Google clients and HTTP transport through those command owners, satisfying the internal-reliability proof path without live Google access. No stored-data contract changes.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The body reports AWS Crabbox before/after observations for production YouTube playlist listing, Chat unread lookup, and People profile retrieval: server arrival precedes cancellation, and each patched command returns context.Canceled after one request instead of waiting for the fallback. Inspection confirms real Google clients and HTTP transport through those command owners, satisfying the internal-reliability proof path without live Google access. No stored-data contract changes.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This repairs cancellation in a bounded set of Google API commands without evidence of an urgent widespread outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The body reports AWS Crabbox before/after observations for production YouTube playlist listing, Chat unread lookup, and People profile retrieval: server arrival precedes cancellation, and each patched command returns context.Canceled after one request instead of waiting for the fallback. Inspection confirms real Google clients and HTTP transport through those command owners, satisfying the internal-reliability proof path without live Google access. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The body reports AWS Crabbox before/after observations for production YouTube playlist listing, Chat unread lookup, and People profile retrieval: server arrival precedes cancellation, and each patched command returns context.Canceled after one request instead of waiting for the fallback. Inspection confirms real Google clients and HTTP transport through those command owners, satisfying the internal-reliability proof path without live Google access. No stored-data contract changes.

Evidence

What I checked:

  • Pinned introduced change: The pinned main-to-head delta attaches contexts at 13 YouTube, two Chat, and two People call sites. Production changes preserve request parameters, account selection, confirmation checks, and error handling. (internal/cmd/youtube.go:231, 0362d1a11460)
  • Still necessary on current main: Current main's playlist-list command still calls Do without attaching its command context. The introduced patch repairs the same omission in Chat unread lookups and People profile reads; existing sibling calls already use per-request contexts. (internal/cmd/youtube.go:231, 4341ecead611)
  • Latest release still affected: The supplied latest release, v0.40.0, also omits the request context in People profile reads. This is not already-shipped work. (internal/cmd/people_profile.go:38, a3065f53c38f)
  • Production-path fault injection: All three regressions invoke production commands through Kong. Their HTTP handlers count an arriving request before canceling the caller context, and assertions require exactly one request and context.Canceled. Service helpers construct actual Google clients using real HTTP clients against local servers; the transport is not mocked. (internal/cmd/google_api_context_test.go:19, 0362d1a11460)
  • Reported after-fix observations: The full captured PR body reports that the old implementation waited for the two-second server fallback, whereas all three patched command paths returned context.Canceled after exactly one request. It reports make ci passing on AWS Crabbox without a live Google account. A REST read matched the captured body and pinned head. These are submitted execution observations, not tests executed by this reviewer. (0362d1a11460)
  • Previous review follow-up: The prior review requested cancellation after dispatch, a narrower coverage claim, and an Unreleased changelog entry. The current harness moves cancellation into server handlers, the body no longer claims every YouTube call is covered, and the changelog includes the reference and contributor thanks. Three untouched YouTube lookup/list calls still omit contexts; those are pre-existing omissions outside this patch. (CHANGELOG.md:5, 0362d1a11460)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Andrew Beresford: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-20T20:13:40.462Z sha 29e8bc6 :: needs real behavior proof before merge. :: none

SebTardif and others added 2 commits September 21, 2026 22:45
YouTube, Chat GetSpaceReadState/Messages.Create, and People.Get
called Do without Context(ctx), so cancel did not abort the HTTP
round trip. Chain Context like the sibling list callers.

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
@steipete
steipete force-pushed the fix/f026-google-api-context branch from 29e8bc6 to 0362d1a Compare September 22, 2026 05:46
@steipete steipete changed the title fix(api): pass request context through leftover Google Do calls fix(api): honor cancellation in YouTube, Chat, and People Sep 22, 2026
@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 22, 2026
@steipete
steipete merged commit 38dbdaa into openclaw:main Sep 22, 2026
12 of 13 checks passed
@steipete

Copy link
Copy Markdown
Collaborator

Landed as 38dbdaa. Strengthened the regressions to cancel only after each YouTube/Chat/People request reaches the HTTP server. Old source waited two seconds for each fallback 504; the fixed calls return context.Canceled immediately. Full make ci passed on AWS Crabbox, independent review was clean through P2, and cross-platform CI passed on 0362d1a11460cf466e71d3077be94ee4d2dd6c8a. Synthetic HTTP only; no Google account used. Thanks @SebTardif!

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. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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.

2 participants