Repository navigation
feat(planner): SG3 — bind omitted secret ref dimensions from the job's scope - #807
Conversation
…s scope
`secret://KEY` and `secret://env:prod/KEY` parsed since SG1 but were sent to
the server unbound, which refuses any reference that does not pin workspace,
project and env. Baselines therefore hard-coded their own name as the
workspace, so a baseline built into a workspace with a different name (for
example agent-visibility in makan) failed with "Ref workspace ... does not
name this run's workspace".
bindContext now fills the omitted workspace, project and env of every
secretEnv and optionalSecretEnv reference when the plan is built, from the
same scope the composition secretBindings already use. It never overrides
an authored dimension and never widens: the server still receives a fully
pinned reference and still checks it against the run.
Nothing that works today changes:
- a fully pinned reference keeps its authored spelling, so its plan digest
is unchanged (makan's plan is byte-identical before and after);
- with no workspace or project to bind from, the reference is kept as
authored instead of failing the plan;
- the server and stored secrets are untouched.
The reference-slot {{...}} deprecation warning from the SG3 plan is left
for a follow-up.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LBnxs7fMsmZeU9WRJwYtuj
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e6c3fc932f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| merged := make(map[string]string, len(secretEnv)+len(bindings)) | ||
| for k, v := range secretEnv { | ||
| merged[k] = v | ||
| bound, ok, err := bindContext(v, workspace, project, env) |
There was a problem hiding this comment.
Bind workflow grant refs with the job refs
When a workflow step’s connections grant and the job’s secretEnv declare the same contextual secret, this binds only the job ref; renderConnections leaves the grant as secret://KEY. The runner matches grants to job.SecretRefs by exact ref, so buildConnectionPayloads then fails with a grant-not-among-job-refs error. Bind the workflow grant through the same context too, or normalize it during lookup.
Useful? React with 👍 / 👎.
| if ref.Workspace == "" { | ||
| ref.Workspace = workspace |
There was a problem hiding this comment.
Bind from the effective CLI workspace context
When execution.state.workspace is omitted but the workspace comes from ORUN_WORKSPACE, a repo link, or orun workspace use, the CLI passes an empty workspace here: generatePlan initializes JobPlanner.Workspace from intentScope(intent) only. bindContext therefore leaves secret://KEY unbound, and the run still sends a ref missing the workspace that the backend requires. Pass the effective workspace and project scope into the planner before binding contextual refs.
Useful? React with 👍 / 👎.
feat(planner): SG3 — bind omitted secret ref dimensions from the job's scope
What
SG3 from
specs/orun-scope-engine: the CLI fills in a secret reference's omitted workspace, project and env from the job's own scope when it builds the plan.Why
The short form has parsed since SG1, but was sent unbound, and the server refuses any reference that doesn't pin workspace, project and env. So every baseline hard-codes its own name as the workspace (
secret://agent-visibility/agent-visibility/...). Built into a workspace with any other name, it fails:That's what happened building agent-visibility into the
makanworkspace (vijayakrishnans/agent-visibility, run 42372324428). The console's secret pages already tell people to writesecret://KEY, which until now didn't work in a run.Nothing that works today changes
mainand with this branch gives identicaljobs.secretBindingsare untouched. The component dimension is left to the lease.Verified
go test ./...passes. New tests coverbindContext(fully contextual, env-pinned, workspace-wide, version, authored-workspace, already-pinned, no scope),secretEnv,optionalSecretEnv, and a contextual entry agreeing with a binding.org_5a63…/project:agent-visibility/env:<env>, including bothWIRING_*cross-environment refs.Not in this PR
{{…}}reference-slot deprecation warning from the SG3 plan.orunversion.🤖 Generated with Claude Code
https://claude.ai/code/session_01LBnxs7fMsmZeU9WRJwYtuj