Repository navigation
feat(cli): declare projects, agents, labels, tasks and credentials - #5000
Merged
Merged
Conversation
yannickmonney
force-pushed
the
feat/managed-projects-agents
branch
from
October 15, 2026 11:11
59926ad to
5fe1df0
Compare
Six managed kinds (project, project-label, project-agent, task, agent-secret, connector-credential) adopt the resource their identity names, and create an absent one under a caller-chosen stable UUID when the declaration says createIfMissing. Each field has one owning kind: an agent's harness, model, instructions and tools stay with agent-model, agent-instructions and agent-tools; a task's description with task-instructions, and its status is never declared. A field left out keeps what is stored. Secrets name a TALE_CONFIG_SECRET_ variable, never a value; readback carries a salted PBKDF2 digest of the stored value so a rotated value reads as a change. One declaration holds up to 512 resources. The task limits move to the shared package, and the automation door narrows the widened union by kind.
Managed configuration doors for a project, a project agent, a standing task, a project label, an agent secret and a connector credential: each reads in its declaration's shape (null for an absent id a creating declaration names) and writes through the app's own writers on the hash the plan read. A created agent starts with its declared runtime, model, instructions and tools; a created task in backlog or todo, its status never reconciled afterwards; nothing absent from a declaration is deleted. A secret's or credential's value travels only in its own write; readback answers a salted digest computed from the stored value, and an OAuth credential is never declared. A dispatch check counts the agents, tasks and labels its declaration creates, and checks a project the declaration creates against the declaration alone, for an Owner or Admin.
Plan and apply create what other resources refer to first (project, labels, agent secrets, connector credentials, agents, tasks), then the instruction, tool and model kinds, automations and dispatch. Nothing inside a project, agent or task the declaration creates is read while planning; apply writes on what the creation left, a retried plan included. A dispatch check sends the agents, tasks and labels the dispatch names that the declaration creates. Secret values are read from TALE_CONFIG_SECRET_ variables when planning and applying, compared by digest and sent only in their own write, never into a plan, receipt or refusal; a managed deployment requires each such variable as an environment reference. A declaration file may include other declaration files, merged before validation, with a file named twice read once; plans, receipts and declarations hold 512 resources. Configuration-only deployments accept the new kinds.
The CLI install guide lists the six fleet kinds with their identities and fields, the apply order, how secret values are read from TALE_CONFIG_SECRET_ variables and compared by digest, includes and the 512-resource limit, and the two-phase retirement (switch off, apply, then drop). The environment reference, the MCP settings page and the dispatch page say the same in EN, DE and FR.
A managed read of an agent secret or a connector credential derives a 100,000-iteration PBKDF2 digest of the stored value, several times per apply. The platform now derives it on the thread pool, so other requests are served meanwhile; the CLI keeps the synchronous form, and both produce the same digest.
PROJECT_AGENT_ID_TAKEN is answered only when a managed declaration creates an agent under the id it chooses; a REST create never names an agent's id, so the REST error-code registry lists it as app-only.
A managed project's declaration that restated the teams a project already has called the audience's writer, which asks for an owner or admin before it notices nothing changes. An editor allowed to rename the project was refused the rename. The audience's writer now runs only when the teams differ, in order, since the first team owns the project.
The platform matches a task's labels without regard to case and keeps the catalog's spelling, but a declared task compared its labels exactly. A task naming `Bug` on a project whose label is `bug`, or `release` beside a declared `Release` label, planned an update on every run and failed its readback after the write. A task now wears a label by its case-folded name, in its declaration and in the platform's readback (`foldedLabels`); the spelling stays with `project-label`.
A declared secret's readback digest verifies its value: whoever holds it, or a plan's or receipt's hashes over it, can test guesses offline. It is derived with 600,000 PBKDF2-SHA-256 iterations, OWASP's recommendation for it, instead of 100,000; the platform derives it from the stored value on every read, so the change reads every declared secret as changed once and the next apply rewrites it. `tale config platform read` shows `valueMatches` instead of printing the digest.
Inside a project, agent or task the same declaration creates, planning read every resource as absent and planned it as created, whether or not its kind can create itself. A label or agent declared without createIfMissing, the model of an agent nothing declares or the description of an undeclared task planned as `create`; apply then wrote the project and stopped at the resource it could not adopt, half-applied. Planning now admits there only what can be written: a resource that creates itself, a project's instructions, and the model, instructions, tools, description or review context of an agent or task the declaration creates. It refuses anything else, and a task in a new project assigned to an agent nothing creates there, before anything is written.
A connector credential the declaration creates was only validated by its write, after the projects, labels and agent secrets before it were written. A connector Tale lacks, a sign-in method or endpoint the connector does not take, or a connector whose per-credential settings are required (an IMAP/SMTP mailbox, HTTP) failed the apply half-way. Plan now asks `POST /api/app/connector-credentials/configuration/check`, without the values, and the CLI refuses the plan naming the field and code. A declaration carries no per-credential settings, so those connectors are connected in Tale, and the SMTP login fields, which only a mailbox takes, are no longer declarable.
The CLI README and the EN/DE/FR CLI install pages now say what planning refuses before anything is written (a resource that only adopts inside a project, agent or task the declaration creates; a task there assigned to an agent nothing creates; a credential its connector would refuse, a connector needing per-credential settings included), that a task's labels read case-folded, that `read` shows `valueMatches` and plans and receipts of secret resources carry a value verifier to treat as sensitive, and that declaring or rotating a secret needs a full deployment, since the backend reads its value from its environment. The manual automation and error-code references record the same.
yannickmonney
marked this pull request as ready for review
October 15, 2026 13:39
yannickmonney
force-pushed
the
feat/managed-projects-agents
branch
from
October 15, 2026 13:39
8c5fec7 to
8b96c92
Compare
5 tasks done
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.
Summary
A managed declaration (
tale config platform, a deployment'sconfiguration/configurationSource,tale deploy --configuration-only) can now create, not only adopt, what a fleet of agents works with, so the fleet's own Tale is infrastructure as code:project,project-label,project-agent,task(standing tasks),agent-secret,connector-credential. Without a policy each adopts the resource its identity names, as before. WithcreateIfMissing: trueit creates an absent one, under a stable UUID the declaration chooses (project, agent, task), so a retried apply finds what an interrupted one created.agent-model/agent-instructions/agent-tools. A created agent is seeded from them, so it never runs on anything else, and creating one requires itsagent-modelin the same declaration. A task's description stays withtask-instructions. Its status is never declared or reconciled:initialStatus(backlog/todo) is a creation-only policy. A field a declaration leaves out keeps what Tale stores.TALE_CONFIG_SECRET_*variables in the CLI's environment (in a managed deployment, the backend container's environment; each such variable must be a requiredenvironmentreference, as forprovider-credential). Readback is a salted PBKDF2-SHA-256 digest (600,000 iterations, OWASP's figure) computed server-side from the stored value, on the thread pool so the event loop is not blocked. A value rotated in the environment, or replaced in Tale, plans asupdatewhile the declaration hash stays the same.tale config platform readshowsvalueMatches, never the digest. The digest, and the plan/receipt hashes over it, still verify the value offline, so the docs say to treat plans and receipts of secret resources as sensitive. OAuth credentials are never declarable, and a credential keeps its sign-in method.createIfMissing, the model of an undeclared agent, the description of an undeclared task) and a task in a new project assigned to an agent nothing creates there are refused at plan. A connector credential is checked against its connector (POST /api/app/connector-credentials/configuration/check, no values sent): unknown connector, sign-in method or endpoint the connector does not take, a changed sign-in method, or a new credential for a connector with required per-credential settings (imap-smtp,http) are refused, naming the field and code.Bugon a project whose label isbugconverges; the spelling belongs toproject-label.create, and apply writes over what the creation left, a retried plan included. The dispatch check sendsplanned(the agents, standing tasks and labels the dispatch names that the declaration creates, and whether it creates the project). The platform counts them for the check only, and the save, written last, checks what then exists. For a project the declaration creates, the check judges the declaration alone (plus the default labels) and requires an organization Owner/Admin.includeother declaration files (relative, same source rules, captured into the immutable bundle), merged before validation. A{file}reference named several times is read once. Including the same declaration twice, or in a cycle, is refused. The 128 caps on declaration, plan, journal, receipt and source files are all raised to 512.Refinements of the brief, based on what the code does:
project-labelhas nocolor/description, because labels have no description column and their colour is derived from the name.project-agenthas noharness, becauseagent-modelowns it (no two kinds per field).connector-credentialalso needsauthMethod(api-key|bearer|basic) so the platform knows which secret fields to expect. It carries no per-credential settings (config), so connectors that require some (imap-smtp,http) are connected in Tale, and the mailbox-onlysmtpUsername/smtpPasswordfields are not declarable.Spec rules: PROJ-R21, PROJ-R22, TASK-R67, TASK-R68, TASK-R69, ASEC-R5, CCRED-R8. TASK-R62–R66 are already used by open PRs #4997/#4998, so this PR starts at R67. Manual coverage is recorded as rows in
reference/automation/{projects,tasks,connectors}.mdplus anerror-codes.mdrow.Upgrade facts
textwith a default, so an explicit UUID insert works./api/app/...(not/api/v1):projects/{id}/configuration/project,projects/{id}/agents/{agentId}/configuration/agent,tasks/{taskId}/configuration/task,tasks/labels/by-project/{projectId}/configuration,agent-secrets/configuration,connector-credentials/configurationandconnector-credentials/configuration/check. The dispatch check accepts an optionalplannedbody.--configuration-onlyaccepts these kinds, but declaring a new secret or rotating a value changes the rendered backend environment, so it needs a full deployment (documented).TALE_CONFIG_SECRET_(at most 80 characters). It is documented in.env.exampleand in the environment reference.Checklist
bun run checkpasses: not run monorepo-wide on this shared, loaded Mac. Targeted gates are listed under the test plan, and CI runs the rest.bun run lint:sastpasses: opengrep on every changed source file, 0 findings.messages/key changed; the user-visible text is docs, in EN/DE/FR.docs/{en,de,fr}/: the CLI install guide, the environment reference, MCP settings and dispatch.tools/cli/README.mdis updated too.README*.md: N/A.Test plan
Gates run locally, all green:
tsc --noEmiton@tale/shared,@tale/cliand@tale/platform.oxlinton shared and CLI, plusoxlint --type-awareon the changed platform files.oxfmt --checkon the changed files.@tale/sharedvitest: 1022 tests.bun test src: 1940 pass. 2 tests fail inacceptance-request.test.ts(actual TLS transport,ECONNREFUSED origin.example.test). They fail in isolation too, are untouched here, and come from the local DNS environment.domain-specsandenv-example-scopeguards.@tale/docsvitest: 716 tests.lint:manual,lint:links,lint:conflictsandknip.New tests:
packages/shared/src/config/managed-fleet.test.ts: schema, identities, caps, kept fields, digest.tools/cli/src/lib/config/managed-fleet.test.ts, the plan/apply flow against a stateful stand-in: create whole, dependency order, the planned dispatch check (bounded to what the dispatch names), adopt/converge/CAS, retry after a lost response inside a created project, secret rotation, no value in plan/journal/refusal, configuration-only.configuration-source.test.ts: include, cycle, read once, 512.inputs.test.ts: a secret's variable must be a required environment reference.managed*.test.tsandroutes.managed.test.tsfor the six doors: gates, path/body identity, UUID-only creation,plannedon a check only.Re-verified on the pushed head
5fe1df0c74:turbo run test --filter='!@tale/platform', which includes@tale/cliand@tale/sharedon Linux) are green. TheCI ready (*)jobs fail only on the draft hold ("Draft pull request is held"); Backend integration, E2E, Build and CLI builds are skipped while the PR is a draft.tsc --noEmit(shared, CLI, platform),oxlint(CLI),oxlint --type-aware(whole platform, shared),oxfmt --checkon every changed file,commitlintover the range,lint:conflicts,lint:manual,lint:links,knipand opengrep on the changed files (0 findings).@tale/sharedvitest (55 files, 1023 tests). CLIsrc/lib/configandsrc/lib/deployment, file by file: 64 of 65 files green (1264 tests);acceptance-request.test.tsfails 2 TLS tests onECONNREFUSED origin.example.test, which is local DNS (the file imports nothing this PR changes). Platform vitest: agent_secrets, connector_credentials, projects, tasks, automations, governance, core/tasks, rest, mcp settings, lib/mcp, lib/i18n, scripts/openapi and every guard exceptturbo-inputs, in four runs (156 + 152 + 22 + 13 files; 1,948 + 2,889 + 219 + 772 tests), all green.@tale/docscontent suites (24 files, 638 tests).Review round (findings 1–6), on head
8c5fec7d78Each finding was verified against the code and fixed with a test:
tools/cli/.../managed-fleet.test.ts: adopt-only agent, adopt-only label, model of an undeclared agent, description of an undeclared task, task assigned to an undeclared agent; zero writes each; an adopt-only agent still adopts once the project exists).foldedLabelson both sides (shared schema test, platformmanaged-entities.test.tswithBugvs built-inbug, CLI end-to-end converge with a stand-in that now stores the catalog spelling).managed.test.tsagainst the shipped catalog: confluence/github/http/imap-smtp/unknown/fixed method/oauth2;routes.managed.test.tsfor the check door; CLI test for http, unknown connector, missing endpoint, no value in any request).teamIds(an editor renames with restated teams; a reordered list still goes to the admin-only writer).readshowsvalueMatches(CLI test), docs note.Gates run locally on the final tree:
tsc --noEmit(shared, CLI, platform),oxlint(CLI, shared, platform--type-aware),oxfmt --checkon changed files,commitlintover the range,knip,lint:manual,lint:links,lint:conflicts;@tale/sharedvitest (55 files, 1024 tests); CLImanaged-fleet.test.ts(22 tests) andsrc/lib/config+src/lib/deployment(1273 pass, 5 skip, the same 2 local-DNS TLS failures inacceptance-request.test.ts); platform vitest forconnector_credentials,projects,tasks,agent_secrets,rest/error-codesandtests/guards(151 files, 2030 tests);@tale/docslocale/structure/docs/links/frontmatter suites (13 files, 525 tests).Not done
backend:integration(real Postgres) was not run: it needs thetale-dbimage and Docker, which this session could not start. The new writers are covered by unit tests with stand-ins. A real-Postgres lane for create/adopt (explicit-id inserts, label respelling, secret digest readback) would be a good follow-up, and CI's Backend integration check runs the existing lanes.TASK_LABEL_UNKNOWN). Likewise an agent granted a secret the organization lacks and nothing declares stops at the agent.SETTINGS_KINDS_NOT_OVER_MCPwithcli: trueand a reason.