Go to file
rabbitblood d4ab584deb fix: wire up GitHub App token refresh — fixes #1933
Symptoms before this PR:
- After ~60 min of workspace uptime, every git push/clone returns 401
- PMM, DevRel, Social Media Brand and other content agents infinite-loop
  status reports back to PMs ("I tried, GH_TOKEN dead")
- PM A2A queues overflow with retry-status messages (depth 27 on Marketing
  Lead, 18 on Dev Lead, 11 on Core Platform Lead at peak)

Root cause:
- GH_TOKEN/GITHUB_TOKEN injected at provision time has a ~60 min TTL
  (GitHub App installation tokens cap at one hour)
- Workspace env is frozen at container start — no in-process mechanism
  to refresh after expiry
- The credential-helper architecture exists in the codebase but was
  never wired up at template boot. Specifically the claude-code template:
  - did not COPY the helper scripts into the image
  - did not configure git credential.helper at boot
  - did not start the background refresh daemon
  - did not run initial gh auth login

Fix:
1. Dockerfile COPYs scripts/molecule-git-token-helper.sh and
   scripts/molecule-gh-token-refresh.sh into /app/scripts/
2. entrypoint.sh (root half) configures git credential helper for
   github.com and creates the per-user token cache directory
3. entrypoint.sh (agent half) starts the refresh daemon under a
   respawn loop and runs initial `gh auth login --with-token`

The helper hits the platform's /admin/github-installation-token endpoint
(fallback to env-var GH_TOKEN when platform unreachable). The refresh
daemon calls _refresh_gh every ~45 min ± 2 min jitter so cli auth and
helper cache stay warm even when no git operation triggers a refresh.

Acceptance:
- After this image deploys, `gh api /user` from inside a workspace
  should keep returning 200 even after >60 min uptime
- Marketing Lead / Dev Lead a2a queues should drain to <5 within one
  cycle of the new image rolling

Follow-up issues to file (not in this PR):
- Replicate this wiring in the other 7 template repos (autogen, crewai,
  deepagents, gemini-cli, hermes, langgraph, openclaw)
- Lift the wiring into the molecule-runtime PyPI package so future
  templates inherit it instead of re-implementing

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-23 17:57:30 -07:00
.claude feat: initial template content (extracted from molecule-monorepo) 2026-04-16 03:05:40 -07:00
.github/workflows fix(security): remove .auth-token API key from git history 2026-04-23 00:06:36 +00:00
.molecule-ci/scripts docs: add CI validation scripts (#4) 2026-04-21 03:17:30 +00:00
runbooks docs: add known-issues.md and runbooks/local-dev-setup.md 2026-04-22 08:36:22 +00:00
scripts fix: wire up GitHub App token refresh — fixes #1933 2026-04-23 17:57:30 -07:00
__init__.py feat: add adapter code + Dockerfile for standalone deployment 2026-04-16 04:27:22 -07:00
.gitignore chore: gitignore credentials for molecule-ai-workspace-template-claude-code 2026-04-16 09:15:36 -07:00
adapter.py feat: add adapter code + Dockerfile for standalone deployment 2026-04-16 04:27:22 -07:00
CLAUDE.md feat: initial template content (extracted from molecule-monorepo) 2026-04-16 03:05:40 -07:00
config.yaml feat(config): split OAuth vs API-key in models[] registry (plugin-dev-agent) 2026-04-22 05:36:03 +00:00
Dockerfile fix: wire up GitHub App token refresh — fixes #1933 2026-04-23 17:57:30 -07:00
entrypoint.sh fix: wire up GitHub App token refresh — fixes #1933 2026-04-23 17:57:30 -07:00
known-issues.md docs: add known-issues.md and runbooks/local-dev-setup.md 2026-04-22 08:36:22 +00:00
README.md feat: initial template content (extracted from molecule-monorepo) 2026-04-16 03:05:40 -07:00
requirements.txt feat: add adapter code + Dockerfile for standalone deployment 2026-04-16 04:27:22 -07:00

template-claude-code-default

Molecule AI workspace template for the claude-code-default runtime.

Usage

In Molecule AI canvas

Select this template when creating a new workspace — it appears in the template picker automatically.

From a URL (community install)

Paste this URL when creating a workspace:

github://Molecule-AI/template-claude-code-default

Files

  • config.yaml — workspace configuration (runtime, model, skills, etc.)
  • system-prompt.md — agent system prompt (if present)

Schema version

template_schema_version: 1 — compatible with Molecule AI platform v1.x.

License

Business Source License 1.1 — © Molecule AI.