Fix agent worker API config, not_met enum warning, and untrusted workspace - #131
Merged
Merged
Conversation
…space - Criterion status enum: disable auto-generated scopes so `not_met` no longer collides with the `not_met` negative scope Rails builds for `met` - Worker container: point RAILS_API_URL at the web service (localhost:3000 is not the API when GoodJob runs in its own container) and pass AGENT_API_KEY / AGENT_MODEL through to both services - Dockerfile: pre-trust /rails/agent in ~/.claude.json so headless Claude Code runs honour agent/.claude/settings.json - Extract shared agent subprocess plumbing into RunsClaudeAgent concern and add a preflight check (API key present, /up reachable) so a misconfigured worker fails and retries instead of burning an agent run that exits 0 while blocked
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.
Summary
Fixes the issues seen in the production worker logs on 2026-09-10:
not_metenum warning — Rails auto-generates anot_metnegative scope for themetvalue, colliding with the realnot_metstatus.Criterion.statusnow usesscopes: false. Predicates (met?,not_met?) are unchanged; no class-level scopes were in use.RAILS_API_URLdefaulted tolocalhost:3000, which is not the web container. The worker now defaults it tohttp://web:3000(overridable).RAILS_API_KEYnot set — neither container passedAGENT_API_KEYthrough. Both services now do; the worker also passesAGENT_MODEL./home/rails/.claude.jsonwith/rails/agenttrusted soagent/.claude/settings.jsonpermissions are honoured.AgentEvaluateCommitmentJobandAgentProcessEntryJobis extracted into aRunsClaudeAgentconcern with a preflight that checks the API key is present and/upresponds. Misconfiguration now raises and goes through the existingretry_onpath instead of launching an agent.Deploy notes
AGENT_API_KEYin the deploy environment (production credentials don't carryagent.api_key). It's a shared secret you generate, e.g.openssl rand -hex 32; the same value on web and worker.GEMINI_API_KEYin production has been suspended by Google. The RubyLLM registry refresh and every Gemini-backed pipeline (criteria generation, dedup, extraction, target dates) will keep failing until the key is rotated. The refresh can't just be removed — the pinned ruby_llm fork's bundled model list has no gemini-3.1 models.Testing
bin/rubocop— no offensesConfigurationError/ApiUnreachableErrorbefore launching the agentmain(time-dependent, unrelated)