Repository navigation
fix(platform): shim the credential broker for work-lane agent turns - #3128
Merged
Merged
Conversation
A github connector granted to a task or automation agent injected no GITHUB_TOKEN: the Tier-2 broker's three ctx seams (resolveCredentialRefInternal, recordCredentialAccess, getSessionOwnerIdentity) were un-shimmed in the agent-turn handler family, and the equipment resolver swallows broker failures into warnings by design — so every granted turn ran without credentials and the agent reported it had none. Shim all three onto the 0.5 domain services (full credential row for the reused decrypt path, the sandbox_credential_access audit insert, and the session owner's git identity), add a turn-equipment import-graph guard beside the bridge one, and prove the chain on real Postgres: a stored github bearer credential resolves into GITHUB_TOKEN/GH_TOKEN, the git credential helper env, the owner's git identity, and one audit row.
This was referenced Sep 2, 2026
Israeltheminer
added a commit
that referenced
this pull request
Sep 3, 2026
Three legs the port left returning nothing, each under a comment saying no
0.5 table existed. All three tables existed.
kind="website" answered []. Migration 0045 created app.websites with every
column 0.4's reader projected, and listWebsites already existed.
kind="mail-attachment" answered {attachments: [], truncated: false}, while
migration 0037 shipped conversation_id and mail_received_at_ms and the email
binder writes both. truncated:false means "the walk reached the end of the
mail index", so the stub was also making a false claim. The new reader gates
every row on conversationAssignmentAllows against the conversation's current
assignment, resolving the caller's role and team ids rather than taking them
as arguments — a listing that skipped that would serve the whole inbox.
Migration 0064 adds the arrival index. The only existing index leads with
conversation_id, so it orders by conversation, which is the shape #3035
recorded as rejected: a by-arrival page reads most of its budget to return
one row, and above the budget reports "most recent" from an arbitrary window.
The task and project legs also lost their zero-hit listing fallback, leaving
listedSource unreachable. Restored in both.
Adds the reachability gate the chat map never had: every internal ref
reachable from the turn now needs a handler, using the walker the sandbox
bridge already had rather than a second copy. That absence is how #3112's
and #3128's missing handlers shipped.
Israeltheminer
added a commit
that referenced
this pull request
Sep 3, 2026
Three legs the port left returning nothing, each under a comment saying no
0.5 table existed. All three tables existed.
kind="website" answered []. Migration 0045 created app.websites with every
column 0.4's reader projected, and listWebsites already existed.
kind="mail-attachment" answered {attachments: [], truncated: false}, while
migration 0037 shipped conversation_id and mail_received_at_ms and the email
binder writes both. truncated:false means "the walk reached the end of the
mail index", so the stub was also making a false claim. The new reader gates
every row on conversationAssignmentAllows against the conversation's current
assignment, resolving the caller's role and team ids rather than taking them
as arguments — a listing that skipped that would serve the whole inbox.
Migration 0070 adds the arrival index. The only existing index leads with
conversation_id, so it orders by conversation, which is the shape #3035
recorded as rejected: a by-arrival page reads most of its budget to return
one row, and above the budget reports "most recent" from an arbitrary window.
The task and project legs also lost their zero-hit listing fallback, leaving
listedSource unreachable. Restored in both.
Adds the reachability gate the chat map never had: every internal ref
reachable from the turn now needs a handler, using the walker the sandbox
bridge already had rather than a second copy. That absence is how #3112's
and #3128's missing handlers shipped.
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.
Problem
Configuring a GitHub credential in Settings → Connectors and granting
githubon an automation (or task) agent's skills menu still left the agent with no credentials at run time — it would report it has no GitHub access.Root cause
The config chain was intact end to end (SkillsMenu →
node.connectors→ stepper request → host →resolveTurnEquipmentEnv). The break was in the shim layer: the Tier-2 credential broker (core/node_only/sandbox/session_credentials.ts) makes three ctx calls, and none of them were answered by the agent-turn shim family (agentTurnShimHandlers⊃sandboxToolShimHandlers) both work lanes run under:connector_credentials/queries:resolveCredentialRefInternal— only the conversations lane had a handler, and it returns an identity subset without the encrypted envelope, unusable for the decrypt pathsandbox/session_mutations:recordCredentialAccess— no handler anywheresandbox/session_queries:getSessionOwnerIdentity— no handler anywhereThe
[ctx-shim] un-shimmedthrows never surfaced because the equipment resolver deliberately downgrades broker failures to warnings (a credential gap must not kill a turn) — so every granted turn silently ran with an empty env overlay. Same failure shape as #3126: each half was tested, the chain was not, and the existing guard only walks the bridge entry points, not the turn-equipment entry.Fix
domains/sandbox/shim.ts— add the three handlers beside the agent-secrets one: the full 0.4-shaped credential row (nullable columns become absent fields) via a new null-returningfindCredentialForRef, thesandbox_credential_accessaudit insert (table shipped in migration 0017; agent secrets already write to it), and the session owner's git identity off the latest live session row (a syntheticsystem:automationowner resolves to null, as in 0.4).domains/connector_credentials/service.ts— exportfindCredentialForRef;loadRowForResolvebecomes a thin throwing wrapper over it.domains/sandbox/shim.test.ts— parameterize the import-graph walker and add a second guard: everyinternal.*name reachable fromcore/node_only/sandbox/turn_equipment.tsmust have a handler inagentTurnShimHandlers. This class of gap now fails in CI instead of shipping as a silent downgrade.integration-check.ts—checkTurnEquipmentBroker: on real Postgres, a stored github bearer credential + a grantedgithubconnector resolve through the automation shim intoGITHUB_TOKEN/GH_TOKEN, the git credential-helper env, the owner's git author identity (GIT_CONFIG_COUNT=3), and exactly onegithub/gitaudit row; an ungranted turn injects nothing.Verification
bun run check40/40; shim guard tests 4/4; backend integration 279/279 (was 277 — the two new checks).type: agent,connectors: ["github"]) started in live mode — the run settledsuccesswith the agent replyingGITHUB_OK:<login>fromgh api user, the audit row landed, and the backend log shows zero broker warnings. The task lane heals with the same change (same handler family).