Repository navigation
feat(runners): add the runners table and the Runner model - #583
Merged
Merged
Conversation
added 3 commits
October 27, 2026 11:49
Signed-off-by: Aixle Flow <[email protected]>
Signed-off-by: Aixle Flow <[email protected]>
Signed-off-by: Aixle Flow <[email protected]>
aixle-com Bot
pushed a commit
that referenced
this pull request
Oct 27, 2026
# Conflicts: # db/schema.rb
…ation a runner uses - RunnerStateMachine turns on whiny_persistence, as TerminalSessionStateMachine does, so a bang event whose save fails raises instead of returning false. - Integration has_many :runners, dependent: :restrict_with_error, so the restrictive runners keys fail with a model error, not InvalidForeignKey. - DESIGN.md §15 task 2: the integrations controller must surface that refusal. Signed-off-by: Aixle Flow <[email protected]>
artempartos
added a commit
to Hitin/flow
that referenced
this pull request
Oct 28, 2026
* origin/develop: docs(workflows): describe workflows as sessions made of steps (AixleHQ#595) feat(workflows): open archived workflows read-only in the builder (AixleHQ#594) feat(task-comments): let authors delete their own recent comments (AixleHQ#593) feat(mcp): log the JSON-RPC method and tool name of each MCP call (AixleHQ#592) fix(board): show a run waiting for a session slot as Queued on its card (AixleHQ#591) feat(brand): use the new Aixle Flow lockup and route fonts through tokens (AixleHQ#590) feat(overview): show tokens used and session time instead of token cost (AixleHQ#589) fix(agents): pre-acknowledge Claude Code's cost-threshold notice (AixleHQ#587) test(playwright): QA helpers batch 2 (appRequest, readInertiaPage, shot, probeRoutes, signOut) (AixleHQ#586) test(playwright): plain-JS QA helpers for browser_run_code on staging (AixleHQ#584) feat(runners): add the runners table and the Runner model (AixleHQ#583) refactor(feature-flags): plain cached reads, no usage tooling (AixleHQ#579) # Conflicts: # CHANGELOG.md
artempartos
added a commit
to Hitin/flow
that referenced
this pull request
Oct 28, 2026
* origin/develop: docs(workflows): describe workflows as sessions made of steps (AixleHQ#595) feat(workflows): open archived workflows read-only in the builder (AixleHQ#594) feat(task-comments): let authors delete their own recent comments (AixleHQ#593) feat(mcp): log the JSON-RPC method and tool name of each MCP call (AixleHQ#592) fix(board): show a run waiting for a session slot as Queued on its card (AixleHQ#591) feat(brand): use the new Aixle Flow lockup and route fonts through tokens (AixleHQ#590) feat(overview): show tokens used and session time instead of token cost (AixleHQ#589) fix(agents): pre-acknowledge Claude Code's cost-threshold notice (AixleHQ#587) test(playwright): QA helpers batch 2 (appRequest, readInertiaPage, shot, probeRoutes, signOut) (AixleHQ#586) test(playwright): plain-JS QA helpers for browser_run_code on staging (AixleHQ#584) feat(runners): add the runners table and the Runner model (AixleHQ#583) refactor(feature-flags): plain cached reads, no usage tooling (AixleHQ#579) # Conflicts: # CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Task #181 (Runners 1b): the
runnerstable and theRunnermodel, scoped to what task 2 (policies and controllers) reads and writes. Design:docs/design/agent-runtimes/DESIGN.md§2.1, §2.5–§2.7, §3.1, §15.This replaces #582. Its commits had no DCO sign-off, so they were replayed here with
git rebase --signoffrather than force-pushed. The tree is identical.What changed
Migration
20261027100000_create_runners.rbcreatesrunnerswith the §2.1 columns, minusencrypted_secrets. It touches no existing table.(company_id, coalesce(project_id, 0), lower(name)) WHERE deleted_at IS NULL.max_concurrency > 0,(runner_type = 'coder') = (integration_id IS NOT NULL),runner_type <> 'manual' OR max_environments IS NULL,max_environments IS NULL OR max_environments > 0.(project_id, company_id) → projects (id, company_id)and(integration_id, company_id) → integrations (id, company_id), using the unique indexes fromAddTenantColumnsToScopedResources.Runner: enumerizerunner_type(manual,coder,kubernetes) andreuse_policy(reuse,fresh), defaulted by type.kubernetesaccepts onlyfresh. Validations mirror the database, plus the §2.6 Coder integration rule: providercoder, same company, company runner → company-wide integration only, project runner → company-wide or its own project's.Runner.visible_for_projecthas the same shape asIntegration.visible_for_projectand excludes deleted rows.CompanyandProjectgethas_many :runners, declared before:integrationsso a Coder runner is gone before the restrictive integration key could block the destroy.RunnerStateMachine(AASM onstatus):mark_connected/mark_degraded(reason)/mark_unreachable(reason),disable/enable(back topending),revoke(terminal). It sets and clearsstatus_reason,disabled_atandrevoked_at.soft_delete!setsdeleted_atand revokes in the same write.DESIGN.md: the §2 opening (column convention and composite keys instead of
TenantColumns), §2.1 (encrypted_secretsarrives with the first type that needs a secret,capabilitiesdefault,created_by_id), the §2.4 sketch, the two §2.5 clarifications, and §15 row 1b rewritten, with the moved items added to rows 4 and 5.One deviation from the task:
created_by_idis nullableThe task lists
created_by_idasnot null. With a NOT NULL, restrictive key,Users::PermanentDeletionServicecould not delete a user who created a runner.PermanentDeletionServiceTest("a row behind every foreign key that reaches them") fails for exactly that reason. Every other authorship column was made nullable withON DELETE SET NULLinEnablePermanentUserDeletion(e.g.integrations.connected_by_id), andrunners.created_by_idfollows that rule. The model still requires a creatoron: :create.FullyWiredUserScenarionow includes a runner, so the service test covers the key. DESIGN.md §2.1 records this.Tests
test/factories/runners.rb: one trait per type, plus:project_runner.test/models/runner_test.rb: validations, the §2.6 rule,reuse_policydefaults,visible_for_project(own project, company, another project, another company, deleted), and one test that writes past validations. That test checks each check constraint, composite key and the unique index refuses the row, by constraint name.test/state_machines/runner_state_machine_test.rb: the allowed and refused source states for every event,status_reason,disabled_at,revoked_at, and soft delete.How to test
I ran the migration, rolled it back (the schema after rollback matches
develop's exactly), and ran it again.db/schema.rbis the dump from that run. On #582's head, CI's Rails shards 1–3, Lint, System Tests and Coverage all passed.No CHANGELOG entry: nothing a user or operator can see yet. Everything stays behind task 2's flag-checked controllers.