Let scheduled jobs call connector tools the owner approved

Đang mở
#132 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
github, go, kubernetes
Lĩnh vực
backend, devtools, security

Hướng nghiên cứu

Start with the connector token policy in internal/connectors/caller.go:44-50 and decision D15 in docs/superpowers/plans/2026-11-26-connectors.md:86, then trace job token creation in internal/gateway/jobs/jobs.go and internal/controller/jobs/reconciler.go. The issue proposes per-job grants approved in a plan, scoped to admin-approved read tools, plus clear failures and notices when a connection needs reauthorization. Done means the acceptance flow works with one approval and run history reports connector failures.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

type: enhancement 💅🏼

Summary

A user who has connected the GitHub connector should be able to say "every night at 3am, refresh my checklist with my GitHub reviews", approve one plan, and have it run as a normal job with run history and failure notices. Today they can't, because a scheduled job cannot call a connector tool.

We tried this on powershift (2026-12-04) with a pi coding agent. It worked only because a platform admin drove it. The workaround is a sync script that calls github__search_issues through the agent helper, plus a home-made 03:00 daemon with a lock file, started by a pi extension inside an interactive app that has to stay up. A non-technical user could not have built that, and its failures never reach the Jobs UI.

What the code says today (checked on main at c7fa2b9)

Claim from the session Verdict Where
Jobs cannot call connectors Confirmed, and it's on purpose. Caller.MayUseConnectors accepts only a personal token or a coding agent app's token. Job tokens are refused because "the job's code could make it act". internal/connectors/caller.go:44-50, decision D15 in docs/superpowers/plans/2026-11-26-connectors.md:86
JobBody has no apiAccess, so jobs never get a token Partly wrong. There's no per-job field, but a job gets its owner's API token when its template sets apiToken: true (model.DefaultAPIAccess). jobs-python doesn't set it. Only backup, chat, claude-code and pi do. A job token still could not reach connectors (row above). internal/gateway/jobs/jobs.go:80-100, internal/controller/jobs/reconciler.go:1034-1040, deploy/helm/javo/files/templates/*.yaml
No REST route calls a connector tool; only the in-pod helper at 127.0.0.1:7690/mcp does Wrong. The gateway serves connector tools on its own /mcp endpoint (internal/mcp). The agent helper just forwards to it with the app's JAVO_TOKEN. The real limit is which token is accepted, not where the endpoint is. internal/agenthelper/agenthelper.go:40-41, internal/mcp/server.go:45
The helper uses the offline token Tapas collects at sign-in Wrong. Connector calls use the person's own OAuth connection to that connector, sealed in the vault and refreshed with its refresh token. The sign-in offline token (agenttoken broker, /api/auth/agent-access) is used for platform services such as Frames, not for connectors. So a nightly run's lifetime depends on the GitHub connection's refresh token, not on the person's Tapas sign-in. internal/connectors/broker/token.go:28-38, internal/connectors/vault/vault.go:171-182, internal/gateway/agenttoken/agenttoken.go
No one can see whether the credential will still work at 03:00 Mostly wrong, for connectors. GET /api/connectors shows the person's connection status (active or needs_reauth). It doesn't show the expiry, and nothing alerts anyone when a scheduled use fails. /api/auth/agent-access is browser-session only, as reported, but connectors don't depend on it. internal/gateway/connectors/member.go:54, internal/gateway/authn/agentaccess.go:99-125
Agents can't attach secrets, and starting an app that holds a token needs a plan Confirmed, by design. MsgAgentNeedsPerson in internal/reasons/messages.go:721
Read-only tools like get_me and list_pull_requests asked for approval while search_issues didn't Confirmed, and it's configuration. A tool runs without approval only if an admin set it to read. Any tool without a mode defaults to write. The server's ReadOnlyHint only prefills the admin's choice. On powershift the GitHub connector's tool modes are incomplete. internal/connectors/connectors.go:18-38, 93-98
The agent guide says nothing about connectors in jobs Confirmed. "Jobs and schedules" covers cron jobs only, and no section mentions connectors. internal/controller/workspace/agents_guide.md:237-253
node missing from custom and jobs-python, and backend-node treats file as the script Not checked in the code. Reported from failed runs.

The core gap

D15 refuses job tokens for a good reason: if any job token could call connectors, any code in a job could act through the owner's connections. Closing this gap needs a narrower grant that the owner approves for a specific job, not a reversal of D15.

Proposed direction (for discussion)

  1. Connector grants for each job, approved in a plan. Add an optional field to the job, for example connectors: [{connector: "github", tools: ["search_issues"]}], limited to tools the admin has set to read. Approving the plan that creates or changes the job approves the grant. The job's token may then call exactly those tools on the gateway /mcp endpoint, as the owner, and nothing else. This keeps jobs as the only scheduler.
    • Changing the grant invalidates the approval, like changing a secret does today.
    • Runs record which tools were called.
  2. Fail runs clearly when the connection lapses. A run that gets ErrNotConnected or needs_reauth fails with a specific reason (for example ConnectorNotConnected) and uses the job's existing notify path, saying "reconnect GitHub at /settings/connections". Show the dependency on the job page.
  3. Docs and smaller fixes.
    • Add a section to agents_guide.md on scheduled work that uses connectors, once (1) exists.
    • Admin guidance or a default for read-only tool modes (for example, accept ReadOnlyHint for well-known connectors), so read calls don't leave stray approval requests.
    • Return connector rate limits (GitHub search allows 30 a minute) as a structured error, not a bare 403.
    • Check whether node belongs in a jobs template, and document what file means for backend-node.

Out of scope for now: a general "scheduled agent prompt" (headless pi -p on a schedule). It's more general but spends model tokens on every run, and (1) covers this use case with a plain script.

Acceptance

A user with GitHub connected sets up the nightly sync with:

  • no PAT and no secret
  • no folder grants
  • no long-running app
  • exactly one approval

Run history is visible in the Jobs UI, and a lapsed GitHub connection shows up there as a clear failure with a notice.

Ngôn ngữ chính
Go
Star
5
Fork
0
Merge trung bình
21 giờ 13 phút
Pull request đã merge (30 ngày)
53

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của nebari-dev/tapas

Tất cả issue của nebari-dev/tapas

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.