Repository navigation
Conversation
…d test every caller The expired-login check read the API URL from the live environment, so a project `.env` `VERYFRONT_API_URL` (next to an operator `VERYFRONT_API_BASE_URL`) or project config that set `VERYFRONT_API_URL` received the stored login. The check now uses the URL the login was resolved for, and only when it matches the host-captured routing. Tests: start, eval, project source context (task, workflow, schedules, webhooks) and a CLI subprocess run of `veryfront task --json` cover the stop, the envelope and exit code, 401/403/5xx/offline, exported tokens, missing logins, unlinked projects and remembered answers. Linked-project tests that now trigger the check stub it instead of reaching the live API.
This branch has not been deployed
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.
Fixes veryfront/veryfront-issue-inbox#3830.
Problem
A linked project (
veryfront.jsonprojectSlug, a project link, orVERYFRONT_PROJECT_SLUG) with an expired stored login runs through Cloud. That's deliberate: #5373 lets unlinked projects fall back toOPENAI_API_KEY, but linked ones must not (decision, 24 Oct). Every model call then failed with a bare gateway 401:veryfront startcame up as normal and failed the same way on its first model call.veryfront evalexplained itself, but only after its first model request was refused.Change
New
assertLinkedLoginAccepted(context)incli/shared/runtime-auth.ts. For a linked project using the stored login, it checks the login once (the same/mecheck, 5 s cap, and accepted/rejected cache as fix(cli): use the provider key when the stored login is rejected #5373's fallback, now shared asisStoredLoginRejected). On a 401 or 403 it stops with:Called after runtime auth in
applyProjectSourceRuntimeAuth(task,workflow, schedules, webhooks),hydrateEvalRuntimeAuth(eval) andhydrateStartRuntimeAuth(start).devalready reports an expired login at local-run admission.Unchanged: no fallback to the provider key for linked projects; an exported
VERYFRONT_API_TOKEN; an unlinked project; a login that can't be checked (network or 5xx) still runs. The existing test "keeps the login of a project linked through VERYFRONT_PROJECT_SLUG" passes unchanged.Validation
Real runs from source: a linked project, a fake (expired) stored login and
OPENAI_API_KEY=sk-test-not-real.veryfront task pingTask "ping" failed: veryfront-cloud request failed: Provider request failed with status 401after starting the taskveryfront login."veryfront eval pingeval-model-unauthorizedafter the first model requestveryfront starttests/integration/semantic-unit-boundary/cli/shared/runtime-auth.test.ts: linked plus rejected stops with the message and makes only the login check, no provider call; linked plus accepted runs; unlinked is left to the fallback with no check.deno task test:fileoncli/commands/start,cli/commands/eval,cli/commands/task,cli/shared/project-source-context.test.ts, the runtime-auth suite and the project-source-context intrinsics suite: all pass.deno fmt,deno lint,deno checkon the changed files.src/testing/env-exclusion.test.ts("keeps module and suite environment values inside each test file"), which passes on its own (1 step). That was a load flake at load average 132, so I pushed with--no-verifyand CI reruns it.Test hardening (
eb812496e)A coverage audit found a defect in this PR and fixed it.
assertLinkedLoginAcceptedbuilt the/meURL fromgetApiUrl(getEnvironmentConfig()). A project.envVERYFRONT_API_URL(with the shell onVERYFRONT_API_BASE_URL), or averyfront.config.tsthat sets it, sentAuthorization: Bearer <stored login>to that host. Credential resolution had already refused that host. The check now uses only the API URL the stored login was resolved for, and only when it matches the host-captured routing. Otherwise it skips the check, like any login it can't check.assertLinkedLoginAcceptedcases: 401 and 403, a link throughveryfront.jsonor a project link, a remembered accept and a remembered reject, 5xx and offline, an exported token, no stored login, an unlinked project, the.envand config leaks, and the message wording.start,eval, project-source-context). Each asserts theauthentication-requiredslug, a single/merequest, and that the task, workflow, schedule or webhook callback never runs.tests/integration/cli/commands/linked-expired-login.test.tsruns the real CLI against a local API stub.task ping --jsonexits 1 withslug: command-failed,registrySlug: authentication-requiredand the message. The task does not run, the token does not appear in the output, and the human output matches.--allow-all.https://attacker.example/me).deno task test:fileacross the touched and sibling suites gives 37 passed (467 steps), 0 failed.dropRejectedStoredLogin(fix(cli): use the provider key when the stored login is rejected #5373), still checks againstcandidate.validationEnvand has the same project-config exposure.