Skip to content

[WIP] Copilot Request#3

Draft
vjvarada with Copilot wants to merge 1 commit into
mainfrom
copilot/fix-6223295-1249383041-162e53c9-dbfe-473b-9019-f02d766f356c
Draft

[WIP] Copilot Request#3
vjvarada with Copilot wants to merge 1 commit into
mainfrom
copilot/fix-6223295-1249383041-162e53c9-dbfe-473b-9019-f02d766f356c

Conversation

Copilot AI commented Jun 19, 2026

Copy link
Copy Markdown

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.

Fix the failing GitHub Actions job "Deploy to Hostinger"
Analyze the Actions logs, identify the root cause of the failure, and implement a fix.
Check run ID: 82400587391
Job URL: https://github.com/FracktalWorks/CommandCenter/actions/runs/27841211068/job/82400587391

Copilot AI requested a review from vjvarada June 19, 2026 18:04
vjvarada added a commit that referenced this pull request Jul 2, 2026
Ships server-side context assembly (module map review #3). C2 grade B- -> A-.

The gap: per-turn INPUT context was assembled client-side and trusted verbatim
by the gateway. The executor then re-sliced the client-sent messages[] in SIX
places with different COUNT caps (12/16/20/50) + char-truncation, all
token-blind; the code itself documented the streaming/batch duplication. And a
non-chat caller (API/webhook) with a thread_id but no messages[] got NO history
because nothing rebuilt it server-side. The token-accounting utilities in
acb_llm/context.py existed but were email-only.

Fix: one acb_llm.assemble_run_context(system_context, history, current_message,
model, history_loader, max_turns):
  - DB-rebuild-when-empty via an injected history_loader (so acb_llm keeps no
    gateway dependency) -> non-chat callers get the SAME context a browser would.
  - Server-side current-turn dedup (the withoutCurrentTurn equivalent).
  - Two-stage token-budget fit: drop oldest WHOLE history turns until it fits
    the model window, THEN char-trim the longest survivor. The existing
    single-message trimmer alone couldn't converge on many-medium-turn chat
    transcripts (only the email single-huge-body shape).

Wired into BOTH executor structured-message sites (_compose_maf_run_input
streaming + the Tier-2 batch path) using _active_run_model for the budget, so
streaming and batch feed the model identically. agent.py injects a
_get_messages-backed loader into the payload for thread_id-carrying callers with
no client history.

Backward-compatible: browser clients still send messages[], so the loader is a
no-op then; the client keeps assembling for the UI context-ring (additive, no
longer trusted for correctness). The email path keeps its own string-flatten
assembler (app-scoped, out of core C2).

Tests: tests/unit/test_context_assembly.py (12),
evals/trajectories/test_context_assembly_trajectory.py (4, CI-blocking). Full
suite 646 green, zero regressions.

Next core module: B6 sandboxing (grade C, top safety lever).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants