Skip to content

Connect hosted app logs to Cloudflare Workers Logs - #38

Merged
tnkuehne merged 2 commits into
mainfrom
feat/cloudflare-logs
Oct 15, 2026
Merged

tnkuehne merged 2 commits into
mainfrom
feat/cloudflare-logs

Conversation

@tnkuehne

@tnkuehne tnkuehne commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Hosted app logs are now written to Cloudflare Workers Logs and read through the existing widefleet logs, HTTP API and management UI. Dynamic Worker tails attribute console output, browser reports and native failures to the app and deployed version; browser reports keep their original build for source-map resolution. Cloudflare Workflow application errors are logged before transport without changing retry/control-signal behavior.

The query adapter preserves app authorization, deployment/build filtering, severity/source/request/trace/text filters, signed pagination and source-map resolution. Every query is scoped to the installation's runtime Worker and authorized app. The self-hosted OTLP/ClickHouse path remains selected independently. The runtime artifact advances to 0.2.5.

Validation: 21 workerd runtime tests, 6 log-normalization tests, 10 authorized query tests, 40 existing platform API tests and 23 celld runtime tests. Type checking, formatting, lint, Cloudflare build and Wrangler dry-run pass. Native logging is tested with local workerd; the Cloudflare query endpoint uses documented response fixtures and has not been exercised against a live account.

Operational details: the control-plane API token needs Workers Observability Write permission to run queries. Hosted logs use Cloudflare's seven-day retention and native event pagination. Follow uses the tail's receive timestamp and the client's existing overlap/deduplication window; Cloudflare does not expose the ClickHouse ingestion watermark, so indexing delays beyond that overlap can require a fresh history query. Oversized forwarded records are explicitly truncated before exceeding the Cloudflare record limit. No infrastructure was deployed.

The CLI orders each complete follow window by receive time across backend pages. Its temporary ordering buffer is capped at 32 MiB / 100,000 records and reports an actionable error when exceeded. Restored Workflow step errors are not logged a second time by the outer runner. Both changes have targeted regression tests; Rust log tests and Clippy also pass.

CI on 54adefb: source checks, Cloudflare tests, release-image checks and Greptile pass. Three existing tests failed: oauth2-proxy login after container restart reached a browser error page; the browser-network/Traefik test exceeded its 180-second timeout; the macOS Intel starter/bootstrap test also timed out. These tests and their affected command/network paths are unchanged. The first PR commit, cf83373, completed the full CI successfully. No failed jobs were manually rerun.

The stacked deletion PR #39 includes this exact logs implementation and completed the full CI successfully on 58c8206, including the three suites above. The checks on this PR itself retain their original results.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
widefleet-docs 54adefb Oct 14 2026, 10:46 PM

@tnkuehne
tnkuehne merged commit 9b8dd8d into main Oct 15, 2026
15 of 19 checks passed
@tnkuehne
tnkuehne deleted the feat/cloudflare-logs branch October 15, 2026 10:02
tnkuehne added a commit that referenced this pull request Oct 15, 2026
App and preview deletion now works through the existing CLI, HTTP API
and management UI on Hosted installations. Removal is accepted by the
native `APP_OPERATIONS` Workflow, marks the app and preview descendants
as deleting, and cleans children before their parent. Self-hosted
retains the existing agent queue and deletion implementation.

Cleanup unpublishes each app, removes its Cron/Queue routing and
consumers, purges its native app Workflow instances, detaches its own
runtime bindings, and deletes its D1, R2, KV and Queue resources,
including dead-letter queues. A paginated inventory includes resources
from historical artifacts. Bucket objects and artifacts are deleted in
bounded pages; SQL deletion happens last. Shared connectors and other
apps remain intact.

Provisioning and removal admission take the existing app row lock.
Resource creation uses stable app-specific names: a repeated attempt
finds an existing resource or creates the missing resource, using
bounded native Workflow retries. There is no additional
resource-creation table, migration or background reconciler. A remote
CREATE that completes only after deletion has finished can leave an
orphan requiring manual cleanup; the app is not held indefinitely
waiting for an unconfirmed creation. Existing confirmation guards for
shared runtime bindings, subscriptions and connector uploads remain
unchanged.

Small permanent host and event deletion markers prevent delayed
publication from reviving a removed app; a new app can reuse the
hostname. Subscription updates never recreate missing queues. Removal
authorization is checked before admission, and a command from a revoked
grantee cannot prevent an owner from deleting. Admission retains the
existing app lock through command storage and native Workflow
acceptance. Repeated DELETEs for a deleting app acknowledge the existing
removal without rewriting command files or admitting another Workflow.
Exhausted retries retain the failure and deleting state; recovery
requires an explicit native Workflow restart. Repeating DELETE does not
automatically restart a failed instance. Retained logs expire under
Cloudflare's normal retention policy.

Validation of the current revision: 41 native workerd
deployment/operation tests, 11 provisioning tests, 9
binding-confirmation tests, 4 resource-removal tests and 40 existing
platform API tests pass. Coverage includes creation without a
server-side effect, lost creation responses, deletion after exhausted
creation retries and a runtime restart, preview isolation, paginated
history, stale activation, authorization and hostname reuse. `pnpm
check` passes. Cloud provisioning APIs use synthetic local fixtures; no
live infrastructure was changed. CI and review must assess this revision
independently of the previous revision.

Based on main after #38 merged. The runtime artifact advances from 0.2.5
to 0.2.6 for deletion-marker support; publication and installed-runtime
rollout are separate. No new dependencies or public documentation
changes.


<!-- greptile_comment -->

<!-- greptile_summary -->

<h2><a
href="https://app.greptile.com/api/retrigger?id=81066395"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/RetriggerDark.svg?v=2"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"><img
alt="Retrigger"
src="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"
align="right"></picture></a><a
href="https://app.greptile.com/mendra/github/widefleet/widefleet/-/pull/39"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptileDark.svg?v=2"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"><img
alt="View in Greptile"
src="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"
align="right"></picture></a>Confidence Score: 5/5</h2>

<!-- greptile-impact-verdict --> The latest changes appear safe to merge
and address the outstanding command-file race.

<details open><summary><h3>Summary</h3></summary>

Hosted app deletion runs through native Workflows, cleans previews
before parents, and removes app-owned resources before SQL rows.

- Hosted app removal runs through the native workflow.
- App removal clears previews, routes, and app-owned resources.
- Deleted app markers keep stale publications from returning.
</details>

<details open><summary><h3>Diagram</h3></summary>

```mermaid
%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Authorize and lock app] --> B{Already deleting?}
  B -->|Yes| C[Return accepted without writing]
  B -->|No| D[Store command and admit Workflow]
  D --> E[Release app lock]
  E --> F[Mark app and previews deleting]
  F --> G[Clean children before parent]
  G --> H[Remove resources and stored files]
  H --> I[Delete SQL rows]
```
</details>

<!-- greptile_confidence_score:5 -->

<sub>Reviews (4) · Last reviewed commit: ["Avoid rewriting commands
during app
remo..."](ba98058)
· [Reviewed by
Greptile](https://www.greptile.com/?utm_source=greptile_review&utm_medium=github&utm_campaign=review_public&utm_content=widefleet/widefleet)</sub>

<!-- /greptile_comment -->
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