π€― LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
π docs(acceptance): preserve production credentials during publication (#19871)
AmAzing-f26ade47bf52
diff --git a/.agents/acceptance/PROCESS.md b/.agents/acceptance/PROCESS.mdindex 528790a2b3e..80d7e8113de 100644--- a/.agents/acceptance/PROCESS.md+++ b/.agents/acceptance/PROCESS.md@@ -271,19 +271,10 @@ What is specific to this repository:(`check.json` + `seed/`). Execution outputs stay in the round's `assets/` and arenever copied back into a fixture.-- **Publish against PRODUCTION defaults, not the local dev profile.** The product- under test runs locally, but publishing there yields a URL nobody can open and a- stub bucket that silently drops evidence uploads. Strip the local overrides:-- ```bash- env -u LOBEHUB_SERVER -u LOBE_API_KEY -u LOBEHUB_CLI_API_KEY -u LOBEHUB_CLI_HOME \- lh acceptance run ingest "$DIR" --source agent-testing --subject "$SUBJECT" \- --requirement "$REQUIREMENT" --open --json- ```-- Verify auth in the same clean env first; if it reports no authentication, have- the user run `lh login`. If a publish flag is rejected as an unknown option, the- `lh` on PATH is stale β publish through `npx @lobehub/cli@latest` instead.+- **Publish to production with a verified production credential, not the local+ test profile.** Follow [Publish auth preflight](#publish-auth-preflight) below+ for both looking up existing rounds and publishing. Do not unconditionally+ remove API keys or assume a stored login exists.- **Choose the subject by business continuity**, not by what is easiest to create:an explicit instruction first; else the current conversation's `topic:<id>` (the@@ -304,6 +295,89 @@ What is specific to this repository:run-page paths. Leave whitespace between the URL and any following text β CJKpunctuation glued to it gets swallowed into the href.+#### Publish auth preflight++1. **Inspect locally before sending credentials anywhere.** Run+ `lh doctor --offline --json` and inspect `endpoints.resolution`,+ `credentials.source`, and workspace scope. This identifies the effective+ server and credential source without network requests; it does **not** prove+ that the credential is valid or belongs to production. Do not print raw+ environment variables, credential files, or use `set -x` around credentials.++2. **Establish provenance, then choose one publish environment.** Use the known+ login/key provisioning context, not just a variable's presence or a URL.+ `LOBEHUB_JWT` takes precedence over `LOBEHUB_CLI_API_KEY`, which takes+ precedence over the stored login. Changing `LOBEHUB_CLI_HOME` alone does not+ override an environment token. Do not assume the legacy `LOBE_API_KEY` name+ is supported by the installed CLI; the source diagnostic is authoritative.++ - **Known production environment credential:** retain the production API key+ or JWT and its intended CLI home. In particular, do not remove a production+ API key just because no disk login exists. Once the winning credential is+ confirmed to belong to this target, define:++ ```bash+ publish_lh() { env LOBEHUB_SERVER=https://app.lobehub.com lh "$@"; }+ ```++ - **Known local test profile:** do not merely replace its server URL; that+ would send the test token to production. Return to the original shell or+ process containing the known production credential. If instead a production+ login is known to exist in the default `~/.lobehub` directory, deliberately+ select that login by defining this alternative:++ ```bash+ publish_lh() {+ env -u LOBEHUB_JWT -u LOBE_API_KEY -u LOBEHUB_CLI_API_KEY -u LOBEHUB_CLI_HOME \+ -u LOBEHUB_WORKSPACE_ID LOBEHUB_SERVER=https://app.lobehub.com lh "$@"+ }+ ```++ Clear the inherited workspace together with its credential: an environment+ workspace ID overrides the stored login's scope and may belong to another+ account or server. Clearing it does **not** force personal scope β the+ selected login may have a saved workspace. Verify the intended scope below+ before publishing; do not silently move a workspace acceptance to personal.++ - **Unknown provenance or no usable production credential:** stop before any+ authenticated request. Ask for the intended production profile/credential;+ do not try an unknown key against different servers. Request user-run+ `lh login --server https://app.lobehub.com` only when a login is actually+ needed, with conflicting test tokens removed from that login environment.+ Do not launch interactive login on the user's behalf.++3. **Preflight and publish with exactly the same environment and CLI binary.**+ Run `publish_lh doctor --offline --json` to confirm the selected source,+ target, and personal/workspace scope against the intended acceptance target.+ If a workspace is intended, run `publish_lh workspace list --json` with the+ selected production credential and confirm that the exact target ID is+ present. Only then restore that verified ID if needed: in the stored-login+ wrapper above, add `LOBEHUB_WORKSPACE_ID=<verified-production-workspace-id>`+ after the `-u` options and before `lh`. Repeat the offline check after any+ wrapper change. If personal scope is intended, confirm no workspace resolves;+ if a saved workspace still resolves, stop and select the intended profile+ rather than publishing under that saved scope.++ Neither a successful offline doctor nor `acceptance run list` proves+ workspace membership: an unauthorized workspace header may fall back to+ personal scope. Stop if the intended scope cannot be established. Once it is+ verified, use a read-only authenticated request as the final gate; only+ proceed on success:++ ```bash+ publish_lh acceptance run list --json \+ && publish_lh acceptance run ingest "$DIR" --source agent-testing \+ --requirement "$REQUIREMENT" --open --json+ ```++ Add `--subject` or `--acceptance` only as required by the round's intended+ association. For a lookup-only task, stop after `list`; do not publish a new+ round. Do not change keys, home, or workspace scope between the check and+ publication. On failure, distinguish missing credentials from server+ rejection, permission, or network errors; do not treat all of them as a need+ to log in again. If the CLI lacks a required command/flag, upgrade it (or use+ `npx @lobehub/cli@latest` in `publish_lh`) and repeat this preflight.+## Phase 3 β Finish### Step 6 β Teardowndiff --git a/.agents/acceptance/PROJECT.md b/.agents/acceptance/PROJECT.mdindex d91b101d1e7..ce25d643fe9 100644--- a/.agents/acceptance/PROJECT.md+++ b/.agents/acceptance/PROJECT.md@@ -186,17 +186,30 @@ stale standalone install: a recently added workspace package fails to resolve- Invocation: from source, no rebuild β `cd apps/cli && bun src/index.ts <cmd>`(referred to as `$CLI`). CLI-side code changes take effect immediately.-- Auth: see Β§3 CLI. Source the seeded profile first:- `source .records/env/agent-testing-cli.env`. It sets `LOBE_API_KEY` /- `LOBEHUB_CLI_API_KEY`, `LOBEHUB_SERVER=http://localhost:3010`, and- `LOBEHUB_CLI_HOME=.lobehub-dev` for isolated settings.--- **Local-run vs publish env distinction:** those seeded overrides are for- _running_ the local backend test. They are WRONG for _publishing_ β a localhost- run yields a verify URL nobody else can open, and the local stub S3 makes- evidence upload fail. Strip them for the publish step (the skill's Step 6 does- `env -u LOBEHUB_SERVER -u LOBE_API_KEY -u LOBEHUB_CLI_API_KEY -u LOBEHUB_CLI_HOME lh verify ingest-report β¦`- so `lh` uses production defaults + the user's real `~/.lobehub` login).+- Auth: see Β§3 CLI. Load `.records/env/agent-testing-cli.env` only inside the+ local-test subshell below. It sets `LOBE_API_KEY` / `LOBEHUB_CLI_API_KEY`,+ `LOBEHUB_SERVER=http://localhost:3010`, and `LOBEHUB_CLI_HOME=.lobehub-dev`+ for isolated settings.++- **Local-run vs publish env distinction:** seeded credentials are only for the+ local backend. Load the test profile inside a subshell so it does not overwrite+ production credentials in the parent shell; remove any inherited production+ JWT inside that subshell because it would override the seeded API key:++ ```bash+ (+ unset LOBEHUB_JWT+ source .records/env/agent-testing-cli.env+ lh whoami+ # Run the local CLI test commands here.+ )+ ```++ For publication or existing-round lookup, follow+ [Publish auth preflight](PROCESS.md#publish-auth-preflight). Preserve known+ production credentials; do not blindly clear API keys or assume `~/.lobehub`+ contains a login. Never change only the server URL while retaining a local+ test credential.- Standalone install: `cd apps/cli && pnpm install` (root install does not cover it).diff --git a/.agents/acceptance/probe-mock-patterns.md b/.agents/acceptance/probe-mock-patterns.mdindex f8af8543c54..7e3a328bbad 100644--- a/.agents/acceptance/probe-mock-patterns.md+++ b/.agents/acceptance/probe-mock-patterns.md@@ -1477,8 +1477,12 @@ would have landed in the production account.**Works:** prefix local invocations with`env -u LOBEHUB_JWT -u LOBEHUB_SERVER -u LOBEHUB_OPERATION_ID -u LOBEHUB_TOPIC_ID -u LOBEHUB_ASSISTANT_MESSAGE_ID`,run `electron-dev.sh` as `env -u ELECTRON_RUN_AS_NODE .agents/acceptance/scripts/electron-dev.sh start`,-then set the isolated home/server explicitly. Publish steps (ingest) strip-`LOBEHUB_JWT` as well so the stored `~/.lobehub` login is used.+then set the isolated home/server explicitly. Keep those changes scoped to local+test subprocesses. For publication, follow+[Publish auth preflight](PROCESS.md#publish-auth-preflight): retain a known+production credential and check its precedence; strip `LOBEHUB_JWT` only when+deliberately selecting a different, known production credential. Do not assume+a stored `~/.lobehub` login exists.`holds-while: pickAuthSource precedence LOBEHUB_JWT > flags > LOBEHUB_CLI_API_KEY > stored (apps/cli/src/auth/source.ts); Electron honors ELECTRON_RUN_AS_NODE.`diff --git a/.agents/skills/pr/SKILL.md b/.agents/skills/pr/SKILL.mdindex 12c71a0f428..c9f4c7c4631 100644--- a/.agents/skills/pr/SKILL.md+++ b/.agents/skills/pr/SKILL.md@@ -21,7 +21,7 @@ user-invocable: true- `git log --oneline origin/canary..HEAD` β unpushed commits- `gh pr list --head "$(git branch --show-current)" --json number,title,state,url` β existing PR- `git diff --stat --stat-count=20 origin/canary..HEAD` β change summary-- `env -u LOBEHUB_SERVER -u LOBE_API_KEY -u LOBEHUB_CLI_API_KEY -u LOBEHUB_CLI_HOME lh acceptance run list --json` β the published acceptance round for this branch (match on `branch`)+- Reuse an existing acceptance link from the task when it covers the delivered behavior. If a lookup is needed, first follow [Publish auth preflight](../../acceptance/PROCESS.md#publish-auth-preflight), then run `publish_lh acceptance run list --json` and match on `branch`. Do not blindly unset API keys: the production credential may exist only in the environment. A lookup never requires creating a new round.### 2. Handle uncommitted changes on default branch