跳到正文
Tessl:產品與工程博客·· 1 小時前AI 評分56

Tessl 教學:如何為 factory 工作流程設定權限

How to set permissions for factory workflows with Tessl

AI 導讀

Tessl 的教學説明如何為 factory 工作流程設定權限,透過環境集中管理憑證與權限,再指定可使用該環境的專案。環境綁定後,能在該專案啟動 run 的用戶可透過 run 使用環境提供的憑證,因此應先核查工作區角色及事件發送者。指南並以文件檢查工作流程示範只授予所需存取權,將生產憑證與沙盒憑證分開,並在首次執行後檢查報告或 PR。

正文

As you automate more work with agents, you need a clear way to decide which jobs can reach which repos and services. Configuring access separately for every job makes those decisions harder to review and maintain.

Tessl environments let an organization admin define the credentials and permissions for a workflow, then control which projects can use that environment. We'll use a recurring docs job to work through the setup, from choosing its access to running it as part of a factory.

In Tessl's factory model, a factory is the set of agent workflows working on a repo. A loop defines an action and the triggers that start it, such as an event, a schedule, or a manual request; a run is one execution. This guide covers access for those Tessl runs. Your organization's identity policies and controls on the services they call still apply, and developers' existing local agent sessions keep their own configuration.

1. Choose permissions for one job

If you are new to Tessl, sign up for free to follow along. Work with an organization admin and confirm that your organization has the environment and factory features needed for this setup.

Start by writing down the job's expected output. A docs check that reports broken links needs different access from one that commits a fix and opens a PR. The second job needs permission to write to the repo, but neither needs a production database credential.

An environment is a named set of credentials and configuration. You need organization admin access to create one and bind it to projects. For the docs job, use these defaults as the starting point:

ControlDefaultWhen to change it
GitHub accessreadChoose pull-requests if the job must push changes and open a PR.
Linear accessnoneEnable access only when the job needs to read or change Linear issues.
Read other runs' logsOffEnable it for a job that needs to inspect other runs in the workspace.
Tessl token roleconsumerUse member for reviews; publisher adds evals and publishing.
Allow loops to start other loops in this projectOffEnable it only when the workflow needs to trigger other work in the same project.

The pull-requests permission permits merging PRs and creating, changing, or deleting branches and tags where branch protection allows it, plus managing releases. It doesn't allow writing issues, statuses, checks, Actions, or workflow files. Check your repo's protections as well as the environment setting; opening a PR and authorizing its merge are separate decisions for your workflow.

The run-permissions guide explains each level. In particular, GitHub access set to none is for supplying your own GITHUB_TOKEN or GH_TOKEN; without one, the run can't start. For a reporting-only docs check, keep read.

2. Create the environment and add only its credentials

In the Tessl web app, open your organization's Settings, then Environments, and choose Create environment. Give it a name that describes the job or trust level, set its permissions, and add any variables it needs. A new environment created through this web flow has no project bindings.

For a reporting-only docs check, use Tessl’s supplied GitHub access at read. If the job proposes fixes through a PR, select pull-requests and keep the repo protections described above. Add another service’s credential only if the job needs that service.

For this docs job, leave Linear access at none and omit any separate Linear token. The none setting withholds Tessl’s supplied Linear token; it does not restrict a token you add yourself.

You can save a value directly in the environment or reference a named secret from the organization's Secrets settings. Use a named secret when several environments need the same credential: rotating it updates every referencing environment from its next run. The Secrets page shows which projects receive each secret, and Tessl prevents deletion while an environment still references it.

Saved values can't be retrieved through the settings pages, API, or CLI. They are still available to the runs that receive them. That distinction determines who you should trust with access to the environment.

3. Review access before binding the project

Treat binding an environment as giving its credentials to everyone who can start a run in that project. In the project's workspace, that includes publishers, managers, and owners, plus organization admins. A trusted sender holding a custom_event_sender key can also start the project's custom-event runs, which receive their environment's values.

This means that hiding a token in settings does not prevent a person from using it through a run. Check the workspace roles and event senders before you grant access. Keep production credentials in a separate environment from sandbox credentials, and bind each environment only to projects whose jobs need it.

To make the binding, open the environment's Bound projects card, select Bind a project, and choose the docs job's project. Then configure that loop to use the environment by name. Binding makes the environment available; the loop's configuration selects it. The environment guide shows both the project default and per-loop configuration.

Tessl redacts environment values from stored transcripts, but short values or values a run transforms can still appear. Avoid asking a job to print credentials for debugging, and keep access to other runs' logs off unless the job needs it.

4. Add an MCP server only if the job needs one

If the docs workflow needs an external tool through MCP, an organization admin registers and authorizes that server in Settings → MCP servers. Tessl stores the upstream credentials and relays requests with them.

A new organization server is available to a run only when the run's environment names it. Registration alone doesn't grant access. Naming a server in an organization environment currently requires Tessl support; the web app and CLI do not yet expose that edit.

There is an exception to check in an existing setup. Servers marked as moved from a workspace retain access from their former workspace, and environment bindings do not limit that access. The local tessl mcp proxy command also connects through workspace-held or moved servers. It is not a general way to grant a local agent access to any new organization server. The MCP gateway guide explains these access paths.

If the docs job only needs GitHub, leave MCP out of its environment.

5. Bring the workflow into your factory

Once the job has the right access, make it a repeatable loop in the repo's factory. For the weekly docs example, declare an action in tessl.json that names the docs skill and the environment you configured, then add a weekly schedule for that action. Keep credential values in the environment; the file names the environment rather than containing its secrets. The loop configuration guide shows how the action and schedule fit together.

Review the configuration with the team, validate it with tessl doctor --automations, and push the accepted change to the default branch so Tessl can sync it. Review a first run's report or PR and recorded tool calls against the intended task, and leave the merge decision to your review process. If it fails, diagnose the failure before increasing permissions; a failed run alone doesn't justify broader access.

The next scheduled run now uses the declared workflow and configured environment. Teammates can review the repo’s workflow definition and the environment’s access settings instead of recreating the job with their own credentials. This is the context-driven factory approach applied to one job: shared instructions and a declared workflow that the team can inspect and maintain. Assign an owner to review those settings when the job changes, and reuse the environment only for jobs with the same trust and access needs.

When the job stops needing an environment, unbind its project. When a shared credential changes, rotate the named secret so future runs receive the new value. Unbinding and rotation are not a promise that credentials already issued to an active run disappear; account for active runs and the credential provider's revocation controls when removing access.

Make workflow access reviewable as your factory grows

Adding another agent job shouldn't mean reconstructing its access from a developer's setup. With a declared loop and a scoped environment, the team can see what the job does, which credentials it receives, and who can start it. Review those decisions when the workflow changes so the next run uses access suited to its current task.

Follow the environment setup guide with your admin and confirm the required features are available in your organization. If you are new to Tessl, sign up for free to get started.

來源:Tessl:產品與工程博客 · tessl.io