Fix/share always backfill full task#116
Merged
Merged
Conversation
…le self-hosted stack Primary fix ----------- OAuth callback returned 502 after Authentik login. Root cause: Authentik routes to its /application/o/* endpoints by HTTP Host header and rejects hosts with an underscore (auth_server is not a valid RFC-1123 hostname) with a 404, so back-channel token exchange to http://auth_server:9000 failed and the API rendered its own 502 page. The api now connects to AUTHENTIK_INTERNAL_URL for networking but presents the front-channel host (host of AUTHENTIK_BASE_URL, e.g. localhost:9000 or auth.tumblecode.dev) as the Host header on token/userinfo/discovery calls. Topology-independent: works for the bundled dev stack and a public app.tumblecode.dev deployment alike. - config/auth.py: get_back_channel_host_header() - src/auth/authentik.py: _back_channel_headers() on the 3 back-channel calls - tests/test_back_channel_host.py: header value + attachment on all calls - README.md / .env.example: Host-override rationale + production block Verified live against the running Authentik: old Host (auth_server:9000) -> 404; new Host (localhost:9000) + real client_secret + fake code -> 400 invalid_grant (request reaches the endpoint, client auth passes). Also includes the in-progress self-hosted stack snapshot ------------------------------------------------------- Bundled Authentik (server/worker/Postgres/Redis) + blueprint, Dockerfile entrypoint with db_bootstrap (FRESH/LEGACY/MANAGED), Makefile, web view tweaks, and the accompanying ai_plans docs.
Share only backfilled the full task.json on a 404 (TaskNotFoundError), assuming any existing server row was complete. When the live bridge had created a partial row (it connected mid-task and captured only later messages, while the offline-run opening turns were never uploaded), share returned 200, backfill was skipped, and the partial copy was shared — the web view showed tokens/cost (from api_req_started rows) but "Untitled task" and no conversation. Backfill the authoritative full local history before sharing whenever messages are available; keep the 404 path as a best-effort retry. backfill_messages replaces the task's stored rows, so this is idempotent.
The cloud web view labels a task's worktree from task.workspace_path,
stamped once and never overwritten. For live (bridge) tasks the first
stamp read the path from a per-user registry that tracks only one
extension instance ('newest wins'), and the message event didn't carry
which window produced it. With multiple windows under one account, a
task could be stamped with another window's worktree.
Carry the originating window's workspacePath on each Message bridge
event and prefer it over the registry singleton on the backend,
mirroring the share/backfill path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.