Skip to content

feat(amr): forward AMR_CLIENT_SOURCE to vela + source on wallet links#4005

Merged
lefarcen merged 7 commits into
mainfrom
codex/amr-wallet-auth-redirect
Jun 10, 2026
Merged

feat(amr): forward AMR_CLIENT_SOURCE to vela + source on wallet links#4005
lefarcen merged 7 commits into
mainfrom
codex/amr-wallet-auth-redirect

Conversation

@lefarcen

@lefarcen lefarcen commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

背景

配合 vela 的「按宿主产品区分收入来源」改动(powerformer/vela#270)。让 vela CLI 把 Open Design 拉起的命令 + 模型调用归因为 source=open_design

改动(已随 main 收敛)

  • runtimes/env.ts:AMR agent spawn 时设 AMR_CLIENT_SOURCE=open_design(紧随 main 的 amrAnalyticsIdentityEnv 之后)。非 PII,不走 telemetry consent 门控。
  • amr-guidance.ts:AMR 钱包/console URL(prod/test/local 各 profile)加 ?source=open_design,供 vela web 的 page_view 归因。
  • vela-errors.ts:daemon 错误卡的充值链接同样加 ?source=open_design

OD_INSTALLATION_ID 的转发已由 main 的 amrAnalyticsIdentityEnv(consent-gated,覆盖所有 AMR spawn)实现,故本 PR 早先的 spawnVelaLogin 改动已移除(冗余)。

待 vela 发版后的follow-up

本改动设的 AMR_CLIENT_SOURCE 需要新版 vela CLI才会被读取并注入网关 header。vela#270 合并发版后,需把 OD 打包的 vela 二进制升级到新版,收入归因才端到端生效。

测试

@open-design/daemon typecheck 通过(仅本地缺 node-pty 原生依赖的无关报错)。

🤖 Generated with Claude Code

lefarcen and others added 2 commits June 1, 2026 18:32
…allet links

So vela analytics can attribute Open Design's command funnel and model spend
back to this host (source=open_design), and the AMR wallet landing carries the
source for the web page_view.

- runtimes/env: set AMR_CLIENT_SOURCE=open_design for the amr agent spawn (not
  PII, so no telemetry-consent gate)
- integrations/vela: spawnVelaLogin forwards OD_INSTALLATION_ID (consent-gated)
- web/daemon: AMR wallet recharge URL gains ?source=open_design

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@PerishCode

Copy link
Copy Markdown
Contributor

@lefarcen I'm holding off on generating review comments for #4005 because this pull request has merge conflicts right now.

Please resolve the conflicts with main and push the updated branch. Once that's done, request or wait for the review to run again and I'll take another look.

🔁 Powered by Looper · runner=reviewer · agent=codex · An autonomous AI dev team for your GitHub repos.

…-redirect

# Conflicts:
#	apps/daemon/src/integrations/vela.ts
#	apps/daemon/src/runtimes/env.ts
#	apps/daemon/src/server.ts
#	apps/web/src/runtime/amr-guidance.ts
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Visual regression review

Head: 5d56c77 · Base: c2d1672

14 changed · 21 unchanged · 0 missing baseline · 0 failed

Changed cases

Case Main PR Diff
visual-avatar-local-agent-list main pr diff
visual-avatar-menu main pr diff
visual-home-plugin-use-with-query main pr diff
visual-plugin-details main pr diff
visual-plugin-share-menu main pr diff
visual-project-avatar-model-dropdown main pr diff
visual-project-workspace main pr diff
visual-settings-byok main pr diff
visual-settings-byok-model-dropdown main pr diff
visual-settings-byok-openai main pr diff
visual-settings-execution main pr diff
visual-settings-local-cli main pr diff
visual-settings-local-cli-model-dropdown main pr diff
visual-workspace-staged-contexts main pr diff
Unchanged cases
Case Main PR Diff
visual-design-system-detail main pr diff
visual-design-systems main pr diff
visual-home main pr diff
visual-home-catalog main pr diff
visual-home-context-picker main pr diff
visual-home-plugin-filter main pr diff
visual-home-plugin-use-staged main pr diff
visual-home-staged-attachment main pr diff
visual-integrations main pr diff
visual-integrations-mcp main pr diff
visual-integrations-use-everywhere main pr diff
visual-new-project-modal main pr diff
visual-onboarding-runtime main pr diff
visual-plugins main pr diff
visual-projects main pr diff
visual-projects-kanban main pr diff
visual-tasks main pr diff
visual-topbar-byok-model-dropdown main pr diff
visual-topbar-byok-switcher main pr diff
visual-topbar-execution-switcher main pr diff

Visual diff is advisory only and does not block merging.

audit and others added 2 commits June 9, 2026 23:31
The AMR console/recharge links the OD app opens into vela web now carry
?source=open_design so vela attributes the visit to Open Design. Update the
console/recharge URL assertions accordingly.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…recharge URL

DEFAULT_AMR_RECHARGE_URL now carries the source param for attribution.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@lefarcen lefarcen requested a review from mrcfps June 9, 2026 16:03
@lefarcen lefarcen added size/S PR changes 20-100 lines risk/high High risk: apps/desktop, daemon, auth, migration, workflows, package deps type/feature New feature labels Jun 9, 2026

@lefarcen lefarcen left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ## 背景 / ## 改动 / ## 测试 sections cover the background, change scope, and validation well — the note about _redirects not changing (to avoid mis-attribution on social-auth callback) is especially helpful context.

One quick addition: could you fill in a ## Surface area checklist? This PR introduces an env var (AMR_CLIENT_SOURCE), changes vela CLI attribution behaviour, and appends ?source=open_design to wallet links — ticking the relevant boxes (e.g. Env var, Default behavior change) would let reviewers scope the blast radius in one glance.

@mrcfps mrcfps left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lefarcen Thanks for wiring the AMR source attribution through both the CLI env and the wallet links. I found one blocking follow-up before this is ready: the recharge URL changed in production code, but the end-to-end insufficient-balance coverage is still pinned to the old URL, so this path will go red as soon as that suite runs.

🔁 Powered by Looper · runner=reviewer · agent=opencode · An autonomous AI dev team for your GitHub repos.

Comment thread apps/daemon/src/integrations/vela-errors.ts
…sertion

- tools/pack: bundle @powerformer/vela-cli 0.0.15 (the release carrying the
  source-attribution logic that reads AMR_CLIENT_SOURCE and tags model_request)
- e2e: expect the insufficient-balance recharge URL to carry ?source=open_design
  (addresses review on DEFAULT_AMR_RECHARGE_URL)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@lefarcen lefarcen requested a review from a team as a code owner June 10, 2026 01:42
The tools/pack @powerformer/vela-cli bump changed pnpm-lock.yaml, invalidating
the daemon/web fetchPnpmDeps fixed-output hashes. Update to the values the Nix
flake check computed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

🚀 Landing page preview

This PR is deployed to a Cloudflare Pages preview — not staging or production:

@lefarcen lefarcen added size/M PR changes 100-300 lines and removed size/S PR changes 20-100 lines labels Jun 10, 2026

@mrcfps mrcfps left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lefarcen I re-reviewed the updated head and didn't find any remaining actionable issues in the changed ranges. The AMR source tagging is threaded consistently through the daemon spawn env, the wallet/console URLs for the relevant profiles, and the packaged vela CLI bump is paired with the lockfile/Nix hash refresh. Thanks for tightening up the follow-up fixes here.

🔁 Powered by Looper · runner=reviewer · agent=opencode · An autonomous AI dev team for your GitHub repos.

@lefarcen lefarcen added this pull request to the merge queue Jun 10, 2026
Merged via the queue into main with commit 3f5fe0f Jun 10, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk/high High risk: apps/desktop, daemon, auth, migration, workflows, package deps size/M PR changes 100-300 lines type/feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants