GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(coderd): evaluate read_template parameters for the chat owner by ibetitsmike · Pull Request #29561 · coder/coder

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Sep 18, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

The chat read_template tool returned the parameter defaults recorded at template import. Defaults that depend on the workspace owner, such as a region chosen from the owner's groups, were therefore wrong for many users, and an agent that omitted the parameter in create_workspace built a workspace with a different value than the tool had shown.

read_template now evaluates the active version's parameters for the chat owner with no inputs, through dynamicparameters.Prepare and the same Render call wsbuilder makes for a first build, via a RenderTemplateParametersFn hook wired from coderd like the other chat hooks. The result carries a parameters_note naming the source: owner-evaluated build values, import rows for templates on the classic parameter flow (which wsbuilder also builds from), a retry note while the version is still importing, or import rows with a warning when evaluation fails. A parameter whose evaluated default fails its own validation is reported as error instead of a usable default. Only an evaluated default is checked: without one, preview and the static renderer validate an empty value, so required parameters and unevaluated defaults are never reported as broken, and their remaining errors surface at build time. Fields preview cannot evaluate before the build are shown as evaluated rather than filled from the import row, because preview's output does not distinguish a default, option set, or validation bound that is unknown (it depends on data.coder_provisioner) from one that is null for this owner: an unevaluated default carries a default_note saying so, an option with an unknown value is omitted, with preview's invalid-options error surfaced as error when the parameter has an evaluated default, and bounds appear exactly as rendered. The one import-row fill is for parameters a module_not_loaded render dropped, keyed on the same diagnostic code wsbuilder uses. Import rows carry no module provenance, so that fill also restores root-level rows the render omitted for this owner; every restored row carries a note marking it an import-time estimate. The build-values note is scoped to a request that omits every parameter and matches no preset, since a default that depends on another parameter is re-evaluated against the values create_workspace passes, a preset can match without a preset_id, and a claimed prebuilt workspace can keep its own values. When evaluation falls back, the warning logs only diagnostic codes, because diagnostic text can quote owner attributes.

Measured on dogfood, evaluation adds about 4 ms for a two-parameter template and about 70 ms for the 6-parameter, 19-module coder template per read_template call, matching the workspace create form's evaluate endpoint, with no file cache growth across repeated calls.

Xum acted for Mike on this pull request.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chatgpt-codex-connector[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
ibetitsmike added 4 commits September 18, 2026 09:12
@ibetitsmike
feat(coderd): evaluate read_template parameters for the chat owner
44543c8
read_template reported template_version_parameters.default_value, which is
the default evaluated at template import. Templates whose defaults depend
on the workspace owner (for example a region chosen from the owner's
groups) therefore showed a default the owner never receives, and the
chat agent created workspaces in the wrong region while believing it had
the default.

Render the active version's parameters through dynamicparameters for the
chat owner with no inputs, which is the form state the owner sees on the
create page, and report those defaults. Fall back to the import-time rows
when no renderer is configured or evaluation fails, and say which source
was used in a parameters_note. Always report mutable so immutable
parameters are explicit.
@ibetitsmike
fix(coderd): label read_template fallbacks accurately and reject erro…
2e96c3e
…red defaults

UAT of the owner-evaluated read_template found four gaps:

- A parameter whose owner-evaluated default fails its own validation
  (for example a value outside the option set) carries the error only in
  the parameter's diagnostics, so it was reported as a usable default and
  create_workspace then rejected the build. Report an error for that
  parameter instead of a default and log a warn naming it.
- Versions imported by a provisioner that predates dynamic parameters
  render statically, so import-time defaults were labelled as evaluated
  for the owner. Detect the provisioner version up front and use the
  import-defaults note.
- A still-importing active version returned an empty list under the
  generic import note. Say the import has not finished and to retry.
- Defaults that only resolve on the provisioner at build time were
  dropped. Show the import-time value with a note saying why.

The template version, job, and terraform values loaded for these checks
are passed into dynamicparameters.Prepare so the hot path issues no extra
queries.
@ibetitsmike
fix(coderd/x/chatd/chattool): do not report required parameters as br…
8939357
…oken defaults

preview tags every required parameter rendered without a value with an
error diagnostic coded "required". read_template treated that like any
other parameter error, so ordinary required parameters showed an error
key and every read of such a template logged a warn, hiding the genuinely
broken-default case. Skip the required diagnostic, and never synthesize
an import-time default for a required parameter.
@ibetitsmike
refactor(coderd): let dynamicparameters.Prepare drive read_template e…
523601e
…valuation

chatRenderTemplateParameters re-implemented the readiness and legacy
provisioner checks that Prepare already performs, and signalled both
through chattool-owned sentinel errors. It now authorizes as the owner
like the other chat hooks and just calls Prepare, which selects the
static renderer for legacy versions and returns
dynamicparameters.ErrTemplateVersionNotReady while importing.

read_template now skips owner evaluation for templates using the classic
parameter flow, because wsbuilder resolves those builds from the import
rows. The tool description points the model at parameters_note, the
per-call warning for invalid owner defaults is gone, and the required
diagnostic code comes from preview types.

A coderd-level test drives the hook with a plain context against an
owner-derived default and a still-importing version.
@github-actions github-actions Bot assigned ibetitsmike Sep 18, 2026
@ibetitsmike

ibetitsmike commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 18, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-18T19:02:45.910758Z cdb6955 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chatgpt-codex-connector[bot]
chatgpt-codex-connector Bot reviewed Sep 18, 2026
View reviewed changes

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 523601e94d

ℹ️ 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".

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread coderd/x/chatd/chattool/readtemplate.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread coderd/x/chatd/chattool/readtemplate.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

@ibetitsmike
fix(coderd/x/chatd/chattool): keep import rows for parameters preview…
f3c7978
… cannot evaluate

preview reports a module it cannot load as a module_not_loaded warning
and omits every parameter that module declares, so read_template
replaced the complete import rows with the incomplete render. The
missing parameters are now appended from the import rows with the
build-time default note, mirroring dynamicparameters.incompleteRender.

An option whose value preview cannot know rendered as an empty string.
It now takes the value recorded at import by option name, with an
options_note, and is omitted when no import value exists.
@ibetitsmike

ibetitsmike commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chatgpt-codex-connector[bot]
chatgpt-codex-connector Bot reviewed Sep 18, 2026
View reviewed changes

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f3c79787e6

ℹ️ 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".

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread coderd/x/chatd/chattool/readtemplate.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread coderd/x/chatd/chattool/readtemplate.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

@ibetitsmike
fix(coderd/x/chatd/chattool): fill every field preview cannot evaluat…
00b2f57
…e from the import row

Option labels can depend on the owner, so recovering an unknown option
value by its evaluated label missed the import row and dropped the
option. A validation bound preview cannot evaluate comes back nil, the
same as an absent one, and was silently omitted although the
provisioner enforces it at build time.

renderedParameterEntry now omits whatever preview could not evaluate
and fills default, options, and validation bounds from the import row
in one place, each with a note naming the source. A partially unknown
option list is replaced as a whole.
@ibetitsmike

ibetitsmike commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chatgpt-codex-connector[bot]
chatgpt-codex-connector Bot reviewed Sep 18, 2026
View reviewed changes

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 00b2f57de8

ℹ️ 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".

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread coderd/x/chatd/chattool/readtemplate.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread coderd/x/chatd/chattool/readtemplate.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

@ibetitsmike
fix(coderd/x/chatd/chattool): keep evaluated empty options and descri…
99a3eca
…be prebuild matching

renderedOptions treated an empty rendered list as unknown, so a
parameter whose option blocks evaluate to nothing for this owner was
filled with the importer's options. An empty list is now a known result
and is left alone.

The build-values note claimed a build matches a preset by the resolved
values. wsbuilder records the preset that way, but workspace creation
claims a prebuilt workspace from the raw request values only, so an
agent relying on defaults misses the prebuild. The note now tells the
model to pass preset_id or the preset's parameter values.
@ibetitsmike

ibetitsmike commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chatgpt-codex-connector[bot]
chatgpt-codex-connector Bot reviewed Sep 18, 2026
View reviewed changes

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 99a3eca8da

ℹ️ 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".

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread coderd/x/chatd/chattool/readtemplate.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread coderd/x/chatd/chattool/readtemplate.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

@ibetitsmike
fix(coderd/x/chatd/chattool): stop guessing unevaluated parameter fie…
47bf7d6
…lds from the import row

read_template filled a default, option list, or validation bound that
preview could not evaluate for the owner from the import-time row. Preview's
output carries no signal that distinguishes those from fields that evaluate
to null for this owner: a default that depends on data.coder_provisioner and
a default that is null for the owner both render as Valid false with no
diagnostic, a null validation bound is a nil pointer like an absent one (an
unknown bound panics preview and fails the whole render, which already falls
back to import rows), and a wholly unknown dynamic option set renders as an
empty list with no diagnostic. Every fill therefore guessed on one side of
that line, and each review round found the counterexample on the other.

Show these fields exactly as preview evaluates them, as the create-workspace
form does. An option whose value is unknown is omitted rather than shown
empty, and preview's invalid-options error is already surfaced as error. A
non-required parameter whose default could not be evaluated gets a
default_note saying so instead of a borrowed value. The module_not_loaded
whole-parameter fill stays: its diagnostic code is the signal wsbuilder also
keys on.
@ibetitsmike

ibetitsmike commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chatgpt-codex-connector[bot]
chatgpt-codex-connector Bot reviewed Sep 18, 2026
View reviewed changes

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 47bf7d60cd

ℹ️ 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".

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread coderd/x/chatd/chattool/readtemplate.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread coderd/x/chatd/chattool/readtemplate.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

@ibetitsmike
chore(coderd/x/chatd/chattool): fix import grouping flagged by fmt
dec9968
@ibetitsmike

ibetitsmike commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 18, 2026

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: dec9968af6

ℹ️ 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".

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ibetitsmike
fix(coderd/x/chatd/chattool): qualify read_template default notes
cdb6955
The build-defaults note promised the values a build uses when a parameter
is omitted, but a default that depends on another parameter is re-evaluated
against the values create_workspace passes. Say so, and scope the promise
to a request that omits every parameter.

Import rows carry no module provenance, so the module_not_loaded fill also
restores root-level rows the render omitted for this owner. Label every
restored row as an import-time estimate instead of noting only its default.
@ibetitsmike

ibetitsmike commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 18, 2026

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: cdb6955515

ℹ️ 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".

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ibetitsmike
ibetitsmike marked this pull request as ready for review September 18, 2026 18:59
f0ssel
f0ssel approved these changes Sep 18, 2026
View reviewed changes
kylecarbs
kylecarbs approved these changes Sep 18, 2026
View reviewed changes
jscottmiller
jscottmiller reviewed Sep 18, 2026
View reviewed changes
Comment thread coderd/x/chatd/chattool/readtemplate.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

jscottmiller
jscottmiller reviewed Sep 18, 2026
View reviewed changes
Comment thread coderd/x/chatd/chattool/readtemplate.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

jscottmiller
jscottmiller reviewed Sep 18, 2026
View reviewed changes
Comment thread coderd/x/chatd/chattool/readtemplate.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

@linear-code

linear-code Bot commented Sep 30, 2026

Copy link
Copy Markdown

CODAGT-1118

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

ibetitsmike added 2 commits October 7, 2026 12:37
@ibetitsmike
fix(coderd/x/chatd/chattool): tighten read_template errors, logs, and…
57072f6
… preset note

Report a parameter error only for an evaluated default. With no default,
preview and the static renderer validate an empty value, so a required
parameter with a validation block, or an optional one whose default could
not be evaluated, was reported as broken.

Log only diagnostic codes when evaluation falls back, since diagnostic text
can quote owner attributes seeded into the render, and skip the warning when
the context was cancelled.

Qualify the build defaults note for presets matched without a preset_id and
for claimed prebuilt workspaces, which keep their own parameter values.
@ibetitsmike
Merge remote-tracking branch 'origin/main' into mike/chatd-read-templ…
5f051f7
…ate-owner-params

# Conflicts:
#	coderd/export_test.go
@ibetitsmike
ibetitsmike requested a review from jscottmiller October 7, 2026 13:00
@ibetitsmike
ibetitsmike merged commit 28fe61f into main Oct 7, 2026
54 of 56 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@ibetitsmike
ibetitsmike deleted the mike/chatd-read-template-owner-params branch October 7, 2026 13:55
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 7, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@chatgpt-codex-connector chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] left review comments
@kylecarbs kylecarbs kylecarbs approved these changes
@f0ssel f0ssel f0ssel approved these changes
@jscottmiller jscottmiller Awaiting requested review from jscottmiller

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@ibetitsmike ibetitsmike

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@ibetitsmike @jscottmiller @kylecarbs @f0ssel
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.