Skip to content

feat: BRIDGE_AGENT_TOKEN_KEY env override + orchestrator calibrate subcommand - #93

Merged
Icaro0310 merged 5 commits into
mainfrom
scout-p4-bridge-fanout
Oct 28, 2026
Merged

Icaro0310 merged 5 commits into
mainfrom
scout-p4-bridge-fanout

Conversation

@Icaro0310

Copy link
Copy Markdown
Owner

Summary

  • bridge: BRIDGE_AGENT_TOKEN_KEY env override in readSessionToken (packages/bridge/src/acp-client.js). Resolution order is now BRIDGE_AGENT_TOKEN_KEY → strategy tokenKey → "windsurf_api_key", so a custom agent driven via BRIDGE_AGENT_BIN can read its own credentials.toml key name instead of being forced to write windsurf_api_key. Documents the var in the file header, the function JSDoc and the README agent-config table (which previously declared verbatim that the var did not exist).
  • orchestrator: new devin-orchestrator calibrate subcommand closes the feedback loop on plan --cost-estimate: it re-reads recorded runs (plans.jsonl + metrics/<run_id>.json) and recomputes unit-duration defaults — mean/p50 minutes overall, per planned worker count and per unit id. Read-only, local only; --json prints the full report. Aggregation lives in registry.py (calibrate()); the cli.py diff is limited to the subparser + dispatch so it stays merge-friendly with feat: SQLite task queue + worktree fanout + switch JSONC/verify-env #92.
    • Note: the recorded schema persists no spec kind/estimated_scope, so buckets are worker-count/unit-id based; per-scope recalibration would need a registry schema extension (documented in code + README).

Test plan

  • npm test in packages/bridge: 171 tests pass (new: env override wins over windsurf_api_key; default key resolution unchanged).
  • pytest packages/orchestrator/tests: 57 pass (new: calibrate aggregation, empty registry, missing-metrics skip). ruff check clean.

Icaro0310 and others added 2 commits October 28, 2026 10:14
… key

readSessionToken resolved the credentials.toml key name only from the
selected strategy's tokenKey, so a custom agent driven purely via
BRIDGE_AGENT_BIN had to write windsurf_api_key into its own
credentials.toml (or skip authenticate). The env var now wins over the
strategy tokenKey, matching the BRIDGE_AGENT_* override family:
BRIDGE_AGENT_TOKEN_KEY || tokenKey || "windsurf_api_key".

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
plan --cost-estimate, plans.jsonl and metrics/<run_id>.json existed but
had no feedback loop: unit durations observed in real runs never flowed
back into the per-scope estimate defaults. devin-orchestrator calibrate
re-reads the recorded runs and aggregates observed unit durations into
mean/p50 minutes — overall, per planned worker count and per unit id.
Inline runs (workers=0) with no unit detail contribute their duration_s
as one observation; missing/corrupt metrics files are skipped and
counted. Read-only; --json prints the full report.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Oct 28, 2026
@github-actions

Copy link
Copy Markdown

AI Code Review Summary

0 finding(s) across 0 reviewed file(s).

Severity Count
🔴 Critical 0
🟠 High 0
🟡 Medium 0
🔵 Low 0

Top issues

No issues found. LGTM ✅

Skipped files

  • Provider error — not reviewed (7): packages/bridge/README.md, packages/bridge/src/acp-client.js, packages/bridge/tests/paths.test.js, packages/orchestrator/README.md, packages/orchestrator/src/devin_orchestrator/cli.py, packages/orchestrator/src/devin_orchestrator/registry.py, packages/orchestrator/tests/test_cli.py

Token usage: 0 in / 0 out.

Reviewed by: ai-code-reviewer · ollama / qwen2.5-coder:1.5b

@Icaro0310

Copy link
Copy Markdown
Owner Author

devin-judge (ACP, high model): approve

Both sides added orchestrator CLI surface — keep all.

Generated with [Devin](https://devin.ai) & QA Engineer Icaro Galvao

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@Icaro0310

Copy link
Copy Markdown
Owner Author

devin-judge (ACP, high model): approve — {"samples": 1, "blocks": 0, "probs": [{"secrets": 0.18, "unsafe_code": 0.1, "deception": 0.08}]}

Generated with [Devin](https://devin.ai) & QA Engineer Icaro Galvao

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@Icaro0310

Copy link
Copy Markdown
Owner Author

devin-judge (ACP, high model): approve — {"samples": 1, "blocks": 0, "probs": [{"secrets": 0.2, "unsafe_code": 0.1, "deception": 0.05}]}

@Icaro0310
Icaro0310 merged commit 641586e into main Oct 28, 2026
15 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant