feat(drift): use adaptive sampling rate by default#229
Conversation
Update the setup agent prompts, onboard wizard, and cloud onboard wizard to use adaptive sampling mode by default instead of fixed mode when generating new configurations. Changes: - Setup agent config templates now use recording.sampling.mode: adaptive with recording.sampling.base_rate instead of the deprecated recording.sampling_rate - Onboard wizard (tusk init) generates configs with nested sampling config using adaptive mode - Cloud onboard wizard (tusk init-cloud) saves sampling.mode: adaptive and sampling.base_rate alongside the legacy sampling_rate field - Updated descriptions to mention adaptive sampling behavior - Updated integration test to verify new fields are saved Closes #223
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
There was a problem hiding this comment.
1 issue found across 7 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="internal/agent/prompts/phase_cloud_configure_recording.md">
<violation number="1" location="internal/agent/prompts/phase_cloud_configure_recording.md:45">
P2: The customization flow documents `fixed` sampling mode but never asks the user to choose a mode, so `fixed` cannot be selected.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ebe039f. Configure here.
There was a problem hiding this comment.
2 issues found across 10 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="internal/tui/onboard-cloud/save.go">
<violation number="1" location="internal/tui/onboard-cloud/save.go:216">
P2: Validate `samplingMode` before writing it to config; unsupported values can be persisted as-is and create invalid recording settings.</violation>
</file>
<file name="internal/tui/onboard-cloud/helpers.go">
<violation number="1" location="internal/tui/onboard-cloud/helpers.go:199">
P2: The empty-string check here is unreachable: the config parser already normalizes an absent `sampling.mode` to `"fixed"` during validation. For pre-existing configs without an explicit mode, `cfg.Recording.Sampling.Mode` will be `"fixed"` (not `""`), so this fallback to `"adaptive"` never triggers. To honour the PR's intent of defaulting to adaptive, this should check for `"fixed"` when the config file doesn't actually contain the field (e.g., check whether the raw YAML key was present), or default at the point before the config parser normalizes it.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.

Summary
Update setup agent prompts and onboard wizards to use adaptive sampling mode as the default, while also allowing users to choose
fixedmode.What changed
Agent prompts (
phase_create_config.md,phase_cloud_configure_recording.md): Config templates now outputrecording.sampling.mode: adaptivewithbase_rateinstead of the flatsampling_ratefield. The customization flow includes sampling mode selection (adaptive or fixed).Onboard wizard (
onboard/config.go):Recordingstruct uses nestedRecordingSamplingwithmode: adaptiveandbase_rate. Generated configs use the new structure.Cloud wizard (
onboard-cloud/):RecordingConfigTablenow includes a "Sampling Mode" row that toggles between adaptive/fixedSaveRecordingConfigaccepts asamplingModeparameter (defaults to adaptive if empty, validates allowed values)Agent tool (
cloud_save_config): Schema updated with optionalsampling_modeenum parameter (adaptive/fixed).SaveCloudConfigpasses mode through toSaveRecordingConfig.Config (
config.go): ExportedFindConfigFile()for raw YAML inspection by the cloud wizard.Why
Adaptive sampling automatically reduces recording rate under load, which reduces performance overhead for high-traffic services. Making it the default ensures new setups get this benefit without manual configuration, while still allowing users to opt into fixed mode when they need predictable sampling.
Fixes #223
Review & Testing Checklist for Human
tusk initand verify generated.tusk/config.yamlcontainsrecording.sampling.mode: adaptiveandrecording.sampling.base_rate: 1instead of flatsampling_ratefixedmode selected and verify the saved config reflectsmode: fixedsampling.mode) and verify it defaults to adaptive, not fixedNotes
sampling_ratefield alongside the new nested fields for backward compatibility with older SDK versions.SaveRecordingConfigdefaults toadaptiveif an empty mode string is passed and validates that mode is one ofadaptive/fixed.loadExistingConfigreads the raw YAML to check ifsampling.modewas explicitly set, avoiding the config parser's normalization of absent mode to"fixed".Link to Devin session: https://app.devin.ai/sessions/82231cf6c58342128ed7bf072ea79f1c
Requested by: @jy-tan