Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fca955e

Browse files
committed
Merge origin/main into f0ssel/chat-projects
Renumbers the chat projects migrations to 000595/000596 behind main's 000594_drop_task_tables and regenerates database and API artifacts.
2 parents 032cac3 + 5e058aa commit fca955e

74 files changed

Lines changed: 2507 additions & 3983 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/skills/doc-check/SKILL.md

Lines changed: 77 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ writing them.
4444
- Or is everything already covered?
4545

4646
6. **Report findings.** Use the method provided in the prompt, or if none
47-
specified, summarize findings directly.
47+
specified, summarize findings directly. When the prompt asks for a
48+
comment on a pull request, follow [Writing the comment](#writing-the-comment).
4849

4950
## Evidence discipline
5051

@@ -96,6 +97,81 @@ Follow this order on every review.
9697
`docs/reference/`. "The diff already updates its own reference page" is
9798
not a reason to skip the search.
9899

100+
## Writing the comment
101+
102+
### A finding needs a page and a sentence
103+
104+
Name the page, and name the sentence that is now wrong or the list that is
105+
now missing an entry. If you cannot name both, you have a hunch, not a
106+
finding, and a hunch costs the author more than it saves.
107+
108+
Two habits produce weak findings:
109+
110+
- **Documenting the interface.** A button, a filter preset, or a dialog is
111+
not a documented surface on its own. Flag it only when a page already
112+
enumerates the thing it belongs to, such as a table of settings or a
113+
list of filters.
114+
- **Filing on the nearest page instead of the right one.** An
115+
admin-facing change does not belong on an agents page because that page
116+
happens to mention a similar option. When no page is the right home,
117+
say so in one sentence and file nothing.
118+
119+
One surface earns one item. Do not split a single change into a required
120+
item plus two nearby suggestions.
121+
122+
### Checkboxes are work, not opinions
123+
124+
Every `[ ]` is work the author owes. Anything optional belongs in the
125+
sentence under an item, or nowhere. An item that says "consider" or "not
126+
strictly required" is not an item.
127+
128+
### Links resolve on GitHub, not in the docs tree
129+
130+
A relative docs link resolves against the repository in a comment and
131+
404s. Write the path in backticks, or link the published page in full,
132+
such as `https://coder.com/docs/reference/api/enterprise`.
133+
134+
Link an anchor only when that heading exists on the base branch today. A
135+
heading this pull request generates does not exist yet, so name the
136+
endpoint or section in words instead.
137+
138+
### One comment per pull request
139+
140+
Search the pull request for `<!-- doc-check-sticky -->` and edit that
141+
comment instead of adding another. Search again immediately before you
142+
post: a comment you wrote earlier in this same review counts, and reviews
143+
of one pull request can overlap. Edit it, never post a second.
144+
145+
When a comment already exists, compare your findings against it. Check off
146+
`[x]` items that are now addressed, strike through items the code reverted,
147+
and add `[ ]` items for new gaps. If an item is checked but you cannot
148+
verify the documentation landed, add a warning note below it. If nothing
149+
meaningful changed, leave the comment alone.
150+
151+
### Comment format
152+
153+
Include only the sections that apply.
154+
155+
```markdown
156+
## Documentation Check
157+
158+
### Updates Needed
159+
- [ ] `docs/path/file.md` - What needs to change
160+
- [x] `docs/other/file.md` - This was addressed
161+
- ~~`docs/removed.md` - No longer needed~~ *(reverted in abc123)*
162+
163+
### New Documentation Needed
164+
- [ ] `docs/suggested/path.md` - What should be documented
165+
> ⚠️ *Checked but no corresponding documentation changes found in this PR*
166+
167+
---
168+
*Automated review via [Coder Agents](https://coder.com/docs/ai-coder/agents)*
169+
<!-- doc-check-sticky -->
170+
```
171+
172+
The `<!-- doc-check-sticky -->` marker goes last, so the next review can
173+
find this comment.
174+
99175
## What to Check
100176

101177
- **Accuracy**: Does documentation match current code behavior?

.github/workflows/doc-check.yaml

Lines changed: 20 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -203,61 +203,35 @@ jobs:
203203
;;
204204
esac
205205
206-
# Build chat prompt with sticky comment logic
206+
# Build the chat prompt. Durable rules live in the skill
207+
# (.claude/skills/doc-check/SKILL.md), so this prompt stays short
208+
# and carries only what changes per run.
207209
CHAT_PROMPT="Use the doc-check skill to review PR #${PR_NUMBER} in coder/coder.
208210
209211
${CONTEXT}
210212
211-
When creating a new workspace, use the \"coder-workflow-bot\" template.
213+
Use \`gh\` to read the PR details, the diff, and every comment.
212214
213-
If a tool call fails with \`get workspace agents in latest build: unauthorized: rbac: forbidden\`, this chat has no working workspace. That is an infrastructure state, not a mistake in your command, so the same command fails again if you retry it.
215+
Follow the skill in full: its evidence discipline, its comment
216+
rules, and its comment format. **Do not comment if no
217+
documentation changes are needed.**
214218
215-
Call \`start_workspace\` with no arguments to start the workspace this chat owns. If it answers \`workspace was deleted\` or \`chat has no workspace\`, the old one is gone: call \`list_templates\` to get the ID of the \`coder-workflow-bot\` template, then call \`create_workspace\` with that ID. Wait for the workspace to be ready, then run the failed tool call again.
219+
## When the workspace is broken
216220
217-
If \`start_workspace\` answers \`load workspace: unauthorized: rbac: forbidden\`, the workspace is dormant and you cannot repair it. Stop there.
221+
A tool call that fails with \`unauthorized: rbac: forbidden\` is an
222+
infrastructure state, not a bad command, so retrying the same
223+
command changes nothing.
218224
219-
When you cannot repair the workspace, say that you could not review the PR, and name the error you got. Post no doc-check comment. Do not say or imply the docs are fine, because you did not read them.
225+
Call \`start_workspace\` with no arguments. If it answers
226+
\`workspace was deleted\` or \`chat has no workspace\`, call
227+
\`list_templates\` for the \`coder-workflow-bot\` template ID, then
228+
\`create_workspace\` with it, and run the failed call again. If it
229+
answers \`load workspace: unauthorized: rbac: forbidden\`, the
230+
workspace is dormant and you cannot repair it: stop, say you could
231+
not review the PR, and name the error. Post no comment, and do not
232+
imply the docs are fine, because you did not read them.
220233
221-
Use \`gh\` to get PR details, diff, and all comments. Look for an existing doc-check comment containing \`<!-- doc-check-sticky -->\` - if one exists, you'll update it instead of creating a new one.
222-
223-
Follow the skill's evidence discipline, including its mandatory
224-
search: list every literal this diff changes, then search the whole
225-
docs tree for each OLD literal before you decide. Do not review only
226-
the files in the diff. Report each search you ran and what it
227-
returned, and post nothing only after every search came back empty
228-
outside \`docs/reference/\`.
229-
230-
**Do not comment if no documentation changes are needed.**
231-
232-
If a sticky comment already exists, compare your current findings against it:
233-
- Check off \`[x]\` items that are now addressed
234-
- Strikethrough items no longer needed (e.g., code was reverted)
235-
- Add new unchecked \`[ ]\` items for newly discovered needs
236-
- If an item is checked but you can't verify the docs were added, add a warning note below it
237-
- If nothing meaningful changed, don't update the comment at all
238-
239-
## Comment format
240-
241-
Use this structure (only include relevant sections):
242-
243-
\`\`\`
244-
## Documentation Check
245-
246-
### Updates Needed
247-
- [ ] \`docs/path/file.md\` - What needs to change
248-
- [x] \`docs/other/file.md\` - This was addressed
249-
- ~~\`docs/removed.md\` - No longer needed~~ *(reverted in abc123)*
250-
251-
### New Documentation Needed
252-
- [ ] \`docs/suggested/path.md\` - What should be documented
253-
> ⚠️ *Checked but no corresponding documentation changes found in this PR*
254-
255-
---
256-
*Automated review via [Coder Agents](https://coder.com/docs/ai-coder/agents)*
257-
<!-- doc-check-sticky -->
258-
\`\`\`
259-
260-
The \`<!-- doc-check-sticky -->\` marker must be at the end so future runs can find and update this comment."
234+
Create any new workspace from the \"coder-workflow-bot\" template."
261235
262236
# Output the prompt
263237
{

aibridge/config/config.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ type AWSBedrock struct {
6969
// Protocol selects the Bedrock wire protocol. The zero value behaves as
7070
// BedrockProtocolInvokeModel.
7171
Protocol BedrockProtocol
72+
// ResolvedModel is the model ID behind Model, which differs from it only
73+
// when Model is an application inference profile ARN. coderd resolves it
74+
// when the provider is written, so the gateway never calls AWS for it.
75+
ResolvedModel string
76+
// ResolvedSmallFastModel is ResolvedModel for SmallFastModel.
77+
ResolvedSmallFastModel string
7278
}
7379

7480
// ResolvedProtocol returns the configured protocol, mapping the empty value to
@@ -81,6 +87,20 @@ func (c AWSBedrock) ResolvedProtocol() BedrockProtocol {
8187
return c.Protocol
8288
}
8389

90+
func (c AWSBedrock) ResolvedModelWithFallback() string {
91+
if c.ResolvedModel != "" {
92+
return c.ResolvedModel
93+
}
94+
return c.Model
95+
}
96+
97+
func (c AWSBedrock) ResolvedSmallFastModelWithFallback() string {
98+
if c.ResolvedSmallFastModel != "" {
99+
return c.ResolvedSmallFastModel
100+
}
101+
return c.SmallFastModel
102+
}
103+
84104
// Validate verifies protocol-specific Bedrock configuration.
85105
func (c AWSBedrock) Validate() error {
86106
switch c.ResolvedProtocol() {

aibridge/intercept/messages/base.go

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -72,22 +72,13 @@ var bedrockSupportedBetaFlags = map[string]bool{
7272
type BedrockRuntime struct {
7373
Cfg aibconfig.AWSBedrock
7474
Creds aws.CredentialsProvider
75-
76-
resolvedModel string
77-
resolvedSmallFastModel string
7875
}
7976

80-
// NewBedrockRuntime bundles the Bedrock config and credentials with the model
81-
// IDs behind the configured identifiers. The resolved IDs differ from the
82-
// configured ones only when those are application inference profile ARNs, which
83-
// are opaque and must be resolved through AWS; every other identifier resolves
84-
// to itself.
85-
func NewBedrockRuntime(cfg aibconfig.AWSBedrock, creds aws.CredentialsProvider, resolvedModel, resolvedSmallFastModel string) *BedrockRuntime {
77+
// NewBedrockRuntime bundles the Bedrock config and credentials.
78+
func NewBedrockRuntime(cfg aibconfig.AWSBedrock, creds aws.CredentialsProvider) *BedrockRuntime {
8679
return &BedrockRuntime{
87-
Cfg: cfg,
88-
Creds: creds,
89-
resolvedModel: resolvedModel,
90-
resolvedSmallFastModel: resolvedSmallFastModel,
80+
Cfg: cfg,
81+
Creds: creds,
9182
}
9283
}
9384

@@ -108,13 +99,13 @@ func (b *BedrockRuntime) ConfiguredSmallFastModel() string {
10899
// Model capabilities, usage records, pricing, and metrics all key off this
109100
// rather than the configured identifier.
110101
func (b *BedrockRuntime) ResolvedModel() string {
111-
return b.resolvedModel
102+
return b.Cfg.ResolvedModelWithFallback()
112103
}
113104

114105
// ResolvedSmallFastModel is [BedrockRuntime.ResolvedModel] for the small/fast
115106
// model.
116107
func (b *BedrockRuntime) ResolvedSmallFastModel() string {
117-
return b.resolvedSmallFastModel
108+
return b.Cfg.ResolvedSmallFastModelWithFallback()
118109
}
119110

120111
type interceptionBase struct {

aibridge/intercept/messages/base_internal_test.go

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ func TestAWSBedrockValidation(t *testing.T) {
179179
t.Parallel()
180180

181181
base := &interceptionBase{
182-
bedrock: NewBedrockRuntime(tt.cfg, credentials.NewStaticCredentialsProvider("test-key", "test-secret", ""), "", ""),
182+
bedrock: NewBedrockRuntime(tt.cfg, credentials.NewStaticCredentialsProvider("test-key", "test-secret", "")),
183183
}
184184
opts, err := base.withBedrockInvokeModelOptions(context.Background())
185185

@@ -217,9 +217,11 @@ func TestModelForBedrockInvokeModel(t *testing.T) {
217217
)
218218

219219
runtime := NewBedrockRuntime(config.AWSBedrock{
220-
Model: profileARN,
221-
SmallFastModel: smallFastProfileARN,
222-
}, nil, "anthropic.claude-opus-4-8", "anthropic.claude-haiku-4-5")
220+
Model: profileARN,
221+
SmallFastModel: smallFastProfileARN,
222+
ResolvedModel: "anthropic.claude-opus-4-8",
223+
ResolvedSmallFastModel: "anthropic.claude-haiku-4-5",
224+
}, nil)
223225

224226
tests := []struct {
225227
name string
@@ -274,9 +276,11 @@ func TestSmallFastModelCapturedAtConstruction(t *testing.T) {
274276
)
275277

276278
runtime := NewBedrockRuntime(config.AWSBedrock{
277-
Model: profileARN,
278-
SmallFastModel: smallFastProfileARN,
279-
}, nil, "anthropic.claude-opus-4-8", "anthropic.claude-haiku-4-5")
279+
Model: profileARN,
280+
SmallFastModel: smallFastProfileARN,
281+
ResolvedModel: "anthropic.claude-opus-4-8",
282+
ResolvedSmallFastModel: "anthropic.claude-haiku-4-5",
283+
}, nil)
280284

281285
const haikuPayload = `{"model":"claude-haiku-4-5","max_tokens":10000}`
282286
const opusPayload = `{"model":"claude-opus-4-8","max_tokens":10000}`
@@ -336,7 +340,7 @@ func TestModelForPlainBedrockModelID(t *testing.T) {
336340
bedrock: NewBedrockRuntime(config.AWSBedrock{
337341
Model: "eu.anthropic.claude-opus-4-8",
338342
SmallFastModel: "anthropic.claude-haiku-4-5",
339-
}, nil, "eu.anthropic.claude-opus-4-8", "anthropic.claude-haiku-4-5"),
343+
}, nil),
340344
logger: slog.Make(),
341345
}
342346

@@ -958,18 +962,14 @@ func TestAugmentRequestForBedrock_AdaptiveThinking(t *testing.T) {
958962
}
959963

960964
// Plain model IDs resolve to themselves; an application inference
961-
// profile ARN resolves to the model behind it.
962-
resolvedModel := tc.resolvedModel
963-
if resolvedModel == "" {
964-
resolvedModel = tc.bedrockModel
965-
}
966-
967965
i := &interceptionBase{
968966
reqPayload: mustMessagesPayload(t, tc.requestBody),
969967
bedrock: NewBedrockRuntime(config.AWSBedrock{
970-
Model: tc.bedrockModel,
971-
SmallFastModel: "anthropic.claude-haiku-3-5",
972-
}, nil, resolvedModel, "anthropic.claude-haiku-3-5"),
968+
Model: tc.bedrockModel,
969+
SmallFastModel: "anthropic.claude-haiku-3-5",
970+
ResolvedModel: tc.resolvedModel,
971+
ResolvedSmallFastModel: "anthropic.claude-haiku-3-5",
972+
}, nil),
973973
clientHeaders: clientHeaders,
974974
logger: slog.Make(),
975975
}
@@ -1322,7 +1322,7 @@ func TestBedrockMantleIsPassthrough(t *testing.T) {
13221322
Region: "us-east-1",
13231323
BaseURL: "https://bedrock-mantle.us-east-1.api.aws/anthropic",
13241324
Protocol: config.BedrockProtocolMantle,
1325-
}, credentials.NewStaticCredentialsProvider("test-key", "test-secret", ""), "", ""),
1325+
}, credentials.NewStaticCredentialsProvider("test-key", "test-secret", "")),
13261326
logger: slog.Make(),
13271327
}
13281328

@@ -1373,7 +1373,7 @@ func TestAWSMantleOptionsValidation(t *testing.T) {
13731373
t.Parallel()
13741374

13751375
base := &interceptionBase{
1376-
bedrock: NewBedrockRuntime(tt.cfg, credentials.NewStaticCredentialsProvider("test-key", "test-secret", ""), "", ""),
1376+
bedrock: NewBedrockRuntime(tt.cfg, credentials.NewStaticCredentialsProvider("test-key", "test-secret", "")),
13771377
}
13781378
opts, err := base.withBedrockMantleOptions(t.Context())
13791379
if tt.errorMsg != "" {

aibridge/provider/anthropic.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,7 @@ func NewAnthropic(ctx context.Context, cfg config.Anthropic, bedrockCfg *config.
8383
return nil, xerrors.Errorf("bedrock config: %w", err)
8484
}
8585

86-
// Resolution only calls AWS for application inference profile ARNs, so
87-
// deployments configured with plain model IDs need no extra permission.
88-
resolveCtx, cancel := context.WithTimeout(ctx, inferenceProfileResolutionTimeout)
89-
defer cancel()
90-
model, smallFastModel, err := resolveBedrockModels(resolveCtx, runtimeCfg, awsCfg)
91-
if err != nil {
92-
return nil, xerrors.Errorf("resolve bedrock models: %w", err)
93-
}
94-
95-
bedrock = messages.NewBedrockRuntime(runtimeCfg, awsCfg.Credentials, model, smallFastModel)
86+
bedrock = messages.NewBedrockRuntime(runtimeCfg, awsCfg.Credentials)
9687
}
9788

9889
return &Anthropic{

0 commit comments

Comments
 (0)